:root{
  --paper: #f7f2e8;
  --ink: #1d1d1f;
  --muted: rgba(0,0,0,0.25);
  --shadow: rgba(0,0,0,0.12);
  
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Lyon Text", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  user-select: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

/* Sketchbook-ish background: faint lines + subtle crosshatch */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.035) 0px,
      rgba(0,0,0,0.035) 1px,
      transparent 1px,
      transparent 28px
    ),
    repeating-linear-gradient(
      135deg,
      rgba(0,0,0,0.02) 0px,
      rgba(0,0,0,0.02) 1px,
      transparent 1px,
      transparent 14px
    );
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* The viewport is the "camera"; the world is the infinite plane */
#viewport{
  position: fixed;
  inset: 0;
  cursor: text;
}
#viewport.dragging{
  cursor: grabbing;
}

#world{
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* Journal entry styling - subtle, like Notion */
.entry, #anchor{
  position: absolute;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 1.6;
  font-size: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: none;
  color: var(--ink);
  max-width: 600px;
  cursor: move;
  transition: background-color 0.2s ease;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.entry:has(.link-card:hover),
.entry:has(.link-card-placeholder:hover),
.entry.has-link-card-hover {
  cursor: pointer !important;
}

.entry.editing{
  border: 2px solid rgba(59, 130, 246, 0.4);
  border-radius: 4px;
  padding: 2px;
  margin: -2px;
}

.entry.editing .link-card,
.entry.editing .link-card-placeholder{
  display: none;
}

#anchor{
  white-space: nowrap;
}

/* The inline editor - seamless, no visible box */
#editor{
  position: absolute;
  display: none;
  min-width: 220px;
  width: 520px;
  max-width: 640px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  outline: none;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

#editor:focus{
  outline: none;
}

/* Melt animation - intermittent letter bleed */
.melt span{
  position: relative;
  display: inline-block;
  will-change: transform, opacity, filter;
  animation: inkIn 900ms ease-out forwards;
}

/* The bleed/soak layer: a shadowy clone behind the letter that expands then fades */
.melt span::after{
  content: attr(data-ch);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  opacity: 0;
  transform: scale(1);
  filter: contrast(1.1);
  /* "Bleed" without blur: multiple micro-shadows */
  text-shadow:
    0.4px 0.0px 0 rgba(0,0,0,0.35),
   -0.4px 0.0px 0 rgba(0,0,0,0.25),
    0.0px 0.4px 0 rgba(0,0,0,0.22),
    0.0px -0.4px 0 rgba(0,0,0,0.18),
    0.6px 0.6px 0 rgba(0,0,0,0.12),
   -0.6px 0.6px 0 rgba(0,0,0,0.10);
  animation: bleed 1100ms ease-out forwards;
}

/* Occasional drip: only apply to some spans via class */
.melt span.drip{
  animation: inkIn 900ms ease-out forwards, drip 1200ms ease-in forwards;
}

@keyframes inkIn{
  0%   { opacity: 0; filter: brightness(0.65) contrast(1.08); transform: translateY(-1px); }
  35%  { opacity: 0.7; filter: brightness(0.78) contrast(1.05); transform: translateY(0px); }
  100% { opacity: 1; filter: brightness(1) contrast(1); transform: translateY(0px); }
}

@keyframes bleed{
  0%   { opacity: 0; transform: scale(1); }
  20%  { opacity: 0.35; transform: scale(1.08); }
  55%  { opacity: 0.18; transform: scale(1.14); }
  100% { opacity: 0; transform: scale(1.16); }
}

/* Very subtle downward creep + tiny smear */
@keyframes drip{
  0%   { transform: translateY(0px); }
  60%  { transform: translateY(1px); }
  100% { transform: translateY(0px); }
}

/* Fade out after melt */
.fade-out{
  animation: fadeOut 600ms ease-out forwards;
}
@keyframes fadeOut{
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Link card styling - Substack-like */
.link-card,
.link-card *,
.link-card::before,
.link-card::after {
  cursor: pointer !important;
}

.link-card{
  margin-top: 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.6);
  transition: all 0.2s ease;
  display: flex;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.link-card:hover{
  border-color: rgba(0,0,0,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.link-card-image{
  width: 120px;
  min-width: 120px;
  height: 120px;
  background-size: cover;
  background-position: center;
  background-color: rgba(0,0,0,0.03);
  flex-shrink: 0;
}

.link-card-content{
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.link-card-site{
  font-size: 12px;
  color: rgba(0,0,0,0.5);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
  font-weight: 500;
}

.link-card-title{
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card-description{
  font-size: 13px;
  color: rgba(0,0,0,0.65);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Link card without image */
.link-card-no-image .link-card-content{
  padding: 16px;
}

/* Link card placeholder - sinking animation */
.link-card-placeholder,
.link-card-placeholder * {
  cursor: pointer !important;
}

.link-card-placeholder{
  margin-top: 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.4);
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  animation: sinkIn 1.2s ease-out forwards;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
}

.link-card-placeholder-content{
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.link-card-placeholder-url{
  font-size: 13px;
  color: rgba(0,0,0,0.5);
  word-break: break-all;
  margin-bottom: 4px;
}

.link-card-placeholder-loading{
  font-size: 12px;
  color: rgba(0,0,0,0.35);
  font-style: italic;
}

@keyframes sinkIn{
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  40% {
    opacity: 0.6;
    transform: translateY(2px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Breadcrumb navigation */
#breadcrumb {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 24px;
  background: rgba(247, 242, 232, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 1000;
  font-size: 14px;
  user-select: none;
}

.breadcrumb-item {
  color: var(--ink);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.breadcrumb-item:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.breadcrumb-separator {
  color: var(--ink);
  user-select: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050509;
  z-index: 1500;
}

.auth-overlay.hidden {
  display: none;
}

.auth-modal {
  max-width: 520px;
  width: 100%;
  padding: 60px 64px 56px;
  color: #e5e7eb;
}

.auth-title {
  font-family: "Lyon Text", "Times New Roman", serif;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
}

.auth-subtitle {
  font-size: 15px;
  color: rgba(229, 231, 235, 0.78);
  margin-bottom: 28px;
}

.auth-label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: rgba(229, 231, 235, 0.82);
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  font-size: 14px;
  outline: none;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
}

.auth-input::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

.auth-input:focus {
  border-color: rgba(148, 163, 184, 0.9);
}

.auth-phone-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(31, 41, 55, 0.9);
  margin-bottom: 24px;
}

.auth-phone-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(17, 24, 39, 0.9);
  color: #e5e7eb;
  cursor: default;
}

.auth-phone-flag-emoji {
  font-size: 16px;
}

.auth-phone-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 16px;
}

.auth-phone-input::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

.auth-button {
  margin-top: 12px;
  width: 100%;
  padding: 18px 10px;
  border-radius: 999px;
  border: none;
  background: #e5e7eb;
  color: #111827;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.auth-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.auth-link-button {
  margin-top: 16px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: rgba(209, 213, 219, 0.8);
  text-decoration: underline;
  cursor: pointer;
}

.auth-error {
  margin-top: 16px;
  font-size: 13px;
  color: #fecaca;
}

.auth-error.hidden {
  display: none;
}

.auth-step.hidden {
  display: none;
}

.auth-code-hint {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: rgba(209, 213, 219, 0.9);
}

.auth-code-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.auth-code-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.auth-code-boxes {
  display: flex;
  gap: 12px;
}

.auth-code-box {
  flex: 1;
  max-width: 56px;
  height: 64px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #e5e7eb;
}

.auth-code-boxes:focus-within .auth-code-box,
.auth-code-box:focus {
  border-color: rgba(148, 163, 184, 0.9);
}

