/* ==========================================================================
   Writing — a walnut writing desk, seen from above
   ========================================================================== */

.label--spaced { letter-spacing: 0.32em; }

.writing-head { padding-block: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); }
.writing-head__title { margin-top: 0.75rem; font-size: clamp(3.5rem, 12vw, 9rem); line-height: 0.88; }
.writing-head__intro { margin-top: 1rem; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.2rem); }

/* ---------- The desk (phones first: a simple vertical stack) ---------- */

.desk-wrap { max-width: 76rem; }
.desk {
  position: relative;
  display: grid;
  gap: 1.5rem;
  padding: 1.25rem 1rem 1.5rem;
  overflow: hidden;
  border-radius: 0.8rem;
  background:
    radial-gradient(ellipse 60% 50% at 18% 12%, rgba(245, 185, 113, 0.45), rgba(245, 185, 113, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .25' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .07 0 0 0 0 .03 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #5A3A22, #3E2614);
  background-size: auto, 600px 300px, auto;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.desk__lamp,
.desk__mug,
.desk__ring,
.desk__pen,
.desk__glasses,
.desk__bible,
.typewriter__roller,
.typewriter__body,
.subscribe__pad,
.subscribe__stamp { display: none; }

/* the page in the typewriter */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 1.4rem 1.25rem;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.55em, rgba(0, 0, 0, 0.03) 1.55em calc(1.55em + 1px)),
    #FAF7F0;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  color: #1B1B1B;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.55;
  text-decoration: none;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.page:hover { color: #1B1B1B; transform: translateY(-4px); box-shadow: 0 16px 28px rgba(0, 0, 0, 0.4); }
.page:focus-visible { outline: 3px solid #F5B971; outline-offset: 4px; }
.page__stamp {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  padding: 0.15em 0.5em 0.05em;
  border: 3px double var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(8deg);
  opacity: 0.88;
  mix-blend-mode: multiply;
}
.page__kicker { color: #6B6B6B; font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; }
.page__title { padding-right: 4.5rem; font-size: 1.5rem; font-weight: 700; line-height: 1.2; text-transform: uppercase; }
.page__date { color: #555; font-size: 0.875rem; }
.page__body { margin-top: 0.25rem; }
.page__more { margin-top: 0.5rem; color: var(--accent); font-weight: 700; }

/* drafts: swipeable on phones */
.drafts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 82%;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.draft {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 11rem;
  padding: 1.15rem 1.15rem 2.2rem;
  scroll-snap-align: start;
  background: #FAF7F0;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  color: #1B1B1B;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.9375rem;
  line-height: 1.5;
  text-decoration: none;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.draft:hover,
.draft:focus-visible {
  z-index: 10;
  color: #1B1B1B;
  transform: translateY(-8px) rotate(0deg) scale(1.02);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.45);
}
.draft:focus-visible { outline: 3px solid #F5B971; outline-offset: 3px; }
.draft__title {
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: underline wavy rgba(200, 16, 46, 0.75);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
}
.draft__date { color: #555; font-size: 0.8125rem; }
.mark-para { color: var(--accent); font-weight: 700; }
.mark-del {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.mark-del::after {
  content: "^";
  position: relative;
  top: 0.55em;
  margin-left: 0.15em;
  color: var(--accent);
  font-weight: 700;
}
.draft__note {
  position: absolute;
  right: 0.9rem;
  bottom: 0.45rem;
  color: #1D4E9A;
  font-family: "Caveat", cursive;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-5deg);
}

/* subscribe card */
.subscribe { position: relative; }
.subscribe__card {
  position: relative;
  padding: 1.25rem 1.2rem 1rem;
  overflow: hidden;
  border-radius: 0.2rem;
  background: #FAF7F0;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}
.subscribe__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}
.subscribe__card input {
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  background: #FFFFFF;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.subscribe__card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.subscribe__go { width: 100%; margin-top: 0.6rem; }
.subscribe__status { margin-top: 0.6rem; color: #444; font-size: 0.875rem; }
.subscribe__status:empty { display: none; }

/* the red "SUBSCRIBED" impression */
.subscribe__mark {
  position: absolute;
  z-index: 3;
  top: 42%;
  left: 50%;
  padding: 0.1em 0.5em 0;
  border: 4px double var(--accent);
  border-radius: 0.2em;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 2.6rem;
  letter-spacing: 0.1em;
  pointer-events: none;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-12deg) scale(1.4);
}
.subscribe__card.is-stamped .subscribe__mark { opacity: 0.85; transform: translate(-50%, -50%) rotate(-12deg) scale(1); transition: opacity 0.15s ease 0.35s, transform 0.2s ease 0.3s; }

/* ---------- Larger screens: the top-down desk ---------- */

@media (min-width: 60em) {
  .desk {
    display: block;
    aspect-ratio: 16 / 10.5;
    padding: 0;
    container-type: inline-size;
  }
  .desk__lamp,
  .desk__mug,
  .desk__ring,
  .desk__pen,
  .desk__glasses,
  .desk__bible,
  .typewriter__roller,
  .typewriter__body,
  .subscribe__pad,
  .subscribe__stamp { display: block; }

  /* lamp (seen from above) in the top-left corner */
  .desk__lamp {
    position: absolute;
    top: -6%;
    left: -4%;
    width: 16%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 45% 45%, #FFF2D0 0 18%, #3A2A1C 19% 55%, #1E140C 56%);
    box-shadow: 0 0 80px 40px rgba(245, 185, 113, 0.35);
  }

  /* typewriter */
  .typewriter { position: absolute; top: 5%; left: 6%; width: 44%; height: 90%; }
  .page {
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 66%;
    z-index: 2;
    padding: 4.5% 5% 3%;
    overflow: hidden;
    font-size: 1.25cqw;
    gap: 0.6cqw;
  }
  .page__title { font-size: 1.9cqw; padding-right: 6cqw; }
  .page__stamp { font-size: 2cqw; }
  .page__kicker, .page__date { font-size: 1cqw; }
  .typewriter__roller {
    position: absolute;
    top: 62%;
    left: 4%;
    right: 4%;
    z-index: 3;
    height: 6%;
    border-radius: 0.6cqw;
    background: linear-gradient(180deg, #2B2B2B, #0E0E0E 50%, #333);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  }
  .typewriter__body {
    position: absolute;
    top: 66%;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    border-radius: 1.2cqw 1.2cqw 2cqw 2cqw;
    background: linear-gradient(180deg, #34302C, #1D1A17);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.08);
  }
  .typewriter__keys {
    position: absolute;
    inset: 22% 10% 16%;
    background: radial-gradient(circle, #EDE6D6 0 0.62cqw, #2A2622 0.7cqw, transparent 0.75cqw) 0 0 / 3.4cqw 2.6cqw;
    opacity: 0.85;
  }

  /* the stack of drafts, beside the typewriter */
  .drafts {
    position: absolute;
    top: 4%;
    left: 53%;
    width: 30%;
    height: 60%;
    display: block;
    overflow: visible;
    padding: 0;
  }
  .draft {
    position: absolute;
    top: calc(var(--i) * 19%);
    left: calc(var(--i) * 2.5%);
    width: 92%;
    min-height: 0;
    height: 42%;
    padding: 4% 5% 3%;
    overflow: hidden;
    font-size: 1.05cqw;
    gap: 0.3cqw;
    z-index: calc(1 + var(--i));
  }
  .draft__date { font-size: 0.9cqw; }
  .draft__note { font-size: 1.6cqw; bottom: 6%; right: 5%; }

  /* decorative things */
  .desk__mug {
    position: absolute;
    top: 8%;
    right: 4%;
    width: 8.5%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, #3A1F0D 0 52%, #F1EEE7 54% 78%, #D9D5CC 80%);
    box-shadow: 0.6cqw 0.8cqw 1.2cqw rgba(0, 0, 0, 0.45);
  }
  .desk__mug::after {
    content: "";
    position: absolute;
    top: 38%;
    right: -26%;
    width: 30%;
    height: 24%;
    border-radius: 0 50% 50% 0;
    background: #E7E3DA;
  }
  .desk__ring {
    position: absolute;
    top: 21%;
    right: 12.5%;
    width: 7.5%;
    aspect-ratio: 1;
    border: 0.35cqw solid rgba(70, 35, 12, 0.55);
    border-radius: 50%;
    filter: blur(0.5px);
  }
  .desk__pen {
    position: absolute;
    top: 70%;
    left: 50%;
    width: 1cqw;
    height: 14%;
    border-radius: 0.5cqw 0.5cqw 0.1cqw 0.1cqw;
    background: linear-gradient(90deg, #8C0B21, #D81F3B 50%, #8C0B21);
    box-shadow: 0.4cqw 0.6cqw 0.8cqw rgba(0, 0, 0, 0.4);
    transform: rotate(28deg);
  }
  .desk__glasses {
    position: absolute;
    top: 74%;
    left: 53%;
    width: 9%;
    height: 6%;
    transform: rotate(-12deg);
  }
  .desk__glasses span {
    position: absolute;
    top: 0;
    width: 42%;
    height: 100%;
    border: 0.35cqw solid #1A1A1A;
    border-radius: 45%;
    background: rgba(200, 220, 230, 0.12);
  }
  .desk__glasses span:first-child { left: 0; }
  .desk__glasses span:last-child { right: 0; }
  .desk__glasses::after {
    content: "";
    position: absolute;
    top: 30%;
    left: 40%;
    width: 20%;
    height: 0.35cqw;
    background: #1A1A1A;
  }
  .desk__bible {
    position: absolute;
    top: 36%;
    right: 3%;
    width: 10%;
    height: 22%;
    border-radius: 0.4cqw;
    background: linear-gradient(90deg, #1E140D, #3A2617 15%, #2A1B10);
    box-shadow: 0.5cqw 0.8cqw 1.2cqw rgba(0, 0, 0, 0.45), inset 0 0 0 0.2cqw rgba(201, 162, 39, 0.35);
    transform: rotate(6deg);
  }
  .desk__ribbon {
    position: absolute;
    bottom: -12%;
    left: 60%;
    width: 0.7cqw;
    height: 22%;
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  }

  /* stamp + ink pad + subscribe card, bottom right */
  .subscribe { position: absolute; top: 64%; left: 62%; width: 34%; height: 33%; }
  .subscribe__card {
    position: absolute;
    top: 0;
    right: 0;
    width: 72%;
    padding: 6% 6% 5%;
    font-size: 1cqw;
  }
  .subscribe__title { font-size: 1.55cqw; }
  .subscribe__pad {
    position: absolute;
    top: 6%;
    left: 0;
    width: 22%;
    aspect-ratio: 1.4;
    border-radius: 0.4cqw;
    background: radial-gradient(ellipse at 50% 45%, #A00D25, #5E0715 70%), #333;
    box-shadow: inset 0 0 0 0.5cqw #2A2A2A, 0.4cqw 0.6cqw 1cqw rgba(0, 0, 0, 0.45);
  }
  .subscribe__stamp {
    position: absolute;
    top: 52%;
    left: 4%;
    z-index: 5;
    width: 14%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #8B5A34, #4E2F17 70%);
    box-shadow: 0.4cqw 0.8cqw 1.2cqw rgba(0, 0, 0, 0.5);
  }
  .subscribe__stamp span {
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #A7764E, #6B4325);
  }
  .subscribe__stamp.is-pressing { animation: stamp-press 0.75s var(--ease); }
  @keyframes stamp-press {
    0%   { transform: none; }
    35%  { transform: translate(220%, -110%) scale(1.25); }
    55%  { transform: translate(250%, -130%) scale(0.92); }
    100% { transform: none; }
  }
  .subscribe__mark { font-size: 3cqw; }
}

/* ---------- The archive ---------- */

.archive { max-width: 76rem; padding-block: clamp(3.5rem, 8vw, 6rem) clamp(4rem, 9vw, 7rem); }
.archive__title { margin-bottom: clamp(1.25rem, 3vw, 2rem); font-size: clamp(2.75rem, 7vw, 5rem); line-height: 0.9; }
.archive__list { border-top: 1px solid var(--hairline); }
.archive__list li { border-bottom: 1px solid var(--hairline); }
.archive__row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  grid-template-areas: "num name arrow" "num meta arrow";
  align-items: baseline;
  column-gap: clamp(0.75rem, 3vw, 2rem);
  padding-block: clamp(1.1rem, 2.6vw, 1.6rem);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.45s var(--ease), color 0.25s;
}
.archive__num { grid-area: num; color: var(--accent); font-family: var(--font-display); font-size: 1.5rem; }
.archive__name { grid-area: name; font-family: var(--font-display); font-size: clamp(1.75rem, 4.5vw, 3rem); line-height: 1; text-transform: uppercase; }
.archive__meta { grid-area: meta; margin-top: 0.35rem; color: var(--muted); font-size: 0.9375rem; }
.archive__arrow { grid-area: arrow; align-self: center; font-size: 1.5rem; opacity: 0; transition: opacity 0.3s; }
.archive__row:hover,
.archive__row:focus-visible { color: var(--accent); transform: translateX(clamp(0.4rem, 1.5vw, 1rem)); }
.archive__row:hover .archive__arrow,
.archive__row:focus-visible .archive__arrow { opacity: 1; }
@media (hover: none) { .archive__row:hover { transform: none; } }
.archive__note { margin-top: 1rem; color: var(--muted); font-size: 0.875rem; }

@media (prefers-reduced-motion: reduce) {
  .page:hover,
  .draft:hover,
  .draft:focus-visible { transform: rotate(var(--tilt, 0deg)); }
  .subscribe__stamp.is-pressing { animation: none; }
  .subscribe__card.is-stamped .subscribe__mark { transition: none; transform: translate(-50%, -50%) rotate(-12deg); }
}
