@layer components {

/* ============================================================
   TY MABEE - FIELD JOURNAL · the journal itself
   ============================================================ */

/* ============================================================
   COVER
   ============================================================ */
.cover {
  min-height: 100svh;
  display: grid; place-items: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  position: relative;
}
.cover-frame {
  width: 100%; max-width: 1120px; min-height: calc(100svh - 5rem);
  border: 2px solid var(--ink);
  border-radius: 255px 18px 245px 20px / 20px 235px 16px 255px; /* wobbly hand-drawn box */
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(1.2rem, 3vw, 2.5rem);
  background:
    radial-gradient(ellipse at 70% 20%, var(--cover-wash), transparent 50%),
    var(--paper);
}
.cover-topline {
  display: flex; justify-content: space-between; gap: 1rem;
  color: var(--ink-soft);
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 0.7rem;
}
/* no z-index here - the draggable ephemera (later in the DOM) must stay
   grabbable and stack above this block */
.cover-center { text-align: center; padding: 2rem 0 3rem; position: relative; }
.cover-kicker {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  color: var(--brown);
  transform: rotate(-1.5deg);
}
.cover-name {
  font-size: clamp(4rem, 14vw, 11rem);
  font-weight: 800;
  font-variation-settings: "opsz" 144;
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.9rem;
}
.cover-name-line { display: block; position: relative; }
.cover-name-line:last-child { color: var(--green); }
/* in normal flow between name and tagline - it can push text but never cross it */
.cover-flourish {
  display: block;
  width: min(58%, 430px);
  height: clamp(8px, 1.6vw, 15px);
  margin: 0 auto 1.1rem;
  color: var(--rust);
  overflow: visible;
}
.cover-role {
  max-width: 34ch; margin: 0 auto;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: var(--ink-soft);
}
.cover-role em { font-style: italic; font-weight: 600; color: var(--ink); }

/* Keep the name - the LCP element - clear of the taped portrait on wide
   covers. The asymmetric writing block reads like space deliberately
   left for an enclosure and avoids shrinking either showpiece. */
@media (min-width: 861px) {
  .cover-center { padding-right: clamp(11.5rem, 19vw, 17rem); }
}
.stamp-cover {
  position: absolute; left: clamp(0.5rem, 5vw, 4rem); bottom: 8%;
  transform: rotate(-9deg);
}
.sticker {
  position: absolute; left: clamp(1rem, 10vw, 9rem); top: 18%;
  filter: drop-shadow(var(--drop-sticker));
}
.coffee-ring {
  position: absolute; width: 120px; height: 120px;
  right: 12%; bottom: 8%;
  color: var(--brown);
  pointer-events: none;
  overflow: visible;
}
.scroll-cue {
  align-self: center;
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--green); text-decoration: none;
  padding: 0.4rem 0.8rem;
}

/* ============================================================
   MARQUEE · a strip of washi tape stuck across the page
   ============================================================ */
.marquee-wrap { padding: 0.5rem 0 2.5rem; overflow: hidden; }
.marquee {
  background: var(--tape-strip);
  border-top: 1.5px solid var(--rule-hair);
  border-bottom: 1.5px solid var(--rule-hair);
  transform: rotate(-1.2deg) scale(1.02);
  padding: 0.6rem 0;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}
.marquee-track {
  display: flex; width: max-content;
  font-family: var(--font-mono); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.14em;
  color: var(--green-deep);
  /* The rough mask supplies the faded edge; solid glyph opacity keeps the
     lamplight palette above AA contrast even on the amber tape. */
  opacity: 1;
  mix-blend-mode: var(--stamp-blend);
  -webkit-mask-image: var(--mask-rough);
          mask-image: var(--mask-rough);
}
.marquee-track span { white-space: pre; }

/* ============================================================
   SECTION HEADS
   ============================================================ */
.entry-head { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.entry-meta { color: var(--rust); margin-bottom: 0.5rem; }
.entry-title {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 700;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.015em;
  line-height: 1.05;
  display: inline-block; position: relative;
}
.entry-title .underline {
  position: absolute; left: -2%; right: -4%; bottom: -0.22em; height: 0.28em;
  width: 104%; color: var(--amber);
}
.entry-sub { font-size: 1.5rem; color: var(--brown); margin-top: 0.8rem; transform: rotate(-0.8deg); }

/* torn paper dividers */
.torn { line-height: 0; margin-top: -1px; }
.torn svg { width: 100%; height: 28px; }
.torn path { fill: var(--paper-warm); }
.torn--flip { transform: scaleY(-1); background: var(--paper-warm); }
.torn--flip path { fill: var(--paper); }

/* ============================================================
   ENTRY 01 · ABOUT
   ============================================================ */
.entry-text p { margin-bottom: 1.1rem; max-width: 58ch; }
.entry-text strong { color: var(--green); }
.dropcap {
  float: left;
  font-size: 4.2rem; line-height: 0.8;
  padding: 0.08em 0.12em 0 0;
  font-weight: 800; color: var(--brown);
  font-variation-settings: "opsz" 144;
}
.measurements {
  border: 2px solid var(--ink);
  border-radius: 12px 200px 10px 220px / 200px 12px 230px 10px;
  padding: 1.4rem 1.5rem 1.8rem;
  background: var(--paper-warm);
  transform: rotate(1deg);
  position: relative;
}
.measurements-title {
  color: var(--green);
  border-bottom: 1.5px dashed var(--ink-soft);
  padding-bottom: 0.5rem; margin-bottom: 0.8rem;
}
.measurements ul { list-style: none; }
.measurements li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.45rem 0; font-size: 0.78rem;
  border-bottom: 1px dotted var(--rule-dot);
}
.measurements li b { color: var(--rust); font-size: 0.95rem; }
.margin-note {
  font-size: 1.35rem; line-height: 1.15; color: var(--green);
  transform: rotate(-3deg);
  display: inline-block;
}
/* hangs outside the card, so cap it rather than let it push the page */
.measurements .margin-note {
  position: absolute; right: -0.5rem; bottom: -3.2rem; max-width: 100%;
}
.coffee-ring--about { left: 6%; bottom: 4%; right: auto; width: 90px; height: 90px; }

/* ============================================================
   SPECIMENS · graph paper zone
   ============================================================ */
.specimens {
  background:
    linear-gradient(var(--graph-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--graph-line) 1px, transparent 1px),
    var(--paper-warm);
  background-size: 28px 28px, 28px 28px, auto;
}
.specimen {
  background: var(--paper);
  border: 1.8px solid var(--ink);
  border-radius: 10px 180px 8px 190px / 190px 10px 180px 8px;
  padding: 1.3rem 1.3rem 1.1rem;
  position: relative;
  contain: layout style;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}
.specimen:nth-child(odd) { transform: rotate(-0.7deg); }
.specimen:nth-child(even) { transform: rotate(0.6deg); }
.specimen:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: var(--shadow-lift);
}
.specimen::before { /* pin */
  content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--rust); border: 1.5px solid var(--ink);
}
.specimen-leaf { width: 44px; height: 44px; margin-bottom: 0.6rem; }
.specimen-leaf path:first-child, .specimen-leaf circle, .specimen-leaf rect {
  fill: var(--leaf-fill); stroke: var(--green); stroke-width: 1.6;
}
.specimen-leaf .vein { fill: none; stroke: var(--green); stroke-width: 1.2; stroke-linecap: round; }
.specimen h3 {
  font-size: 1.35rem; font-weight: 700; margin-bottom: 0.4rem;
  font-variation-settings: "opsz" 60;
}
.specimen p { color: var(--ink-soft); line-height: 1.7; font-size: 0.7rem; }
.margin-note--specimens { margin-top: 2.5rem; font-size: 1.4rem; }

/* ============================================================
   PROJECTS
   ============================================================ */
.project + .project { border-top: 1.5px dashed var(--rule-dash); }
.project-title {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 700; line-height: 1.1; margin: 0.3rem 0 0.9rem;
  font-variation-settings: "opsz" 100;
}
.project-body p { max-width: 52ch; margin-bottom: 0.9rem; }
.materials { color: var(--brown); font-size: 0.72rem; line-height: 1.8; }
.materials b { color: var(--green); }
.project-links { margin: 1.1rem 0 0.4rem; display: flex; flex-wrap: wrap; gap: 1.2rem; }
.project-body .margin-note { margin-top: 0.8rem; }

/* index of smaller experiments */
.further {
  margin-top: clamp(2rem, 4vw, 3.5rem);
  border-top: 1.5px dashed var(--rule-dash);
  padding-top: 1.6rem;
}
.further-title { color: var(--green); margin-bottom: 0.9rem; }
.further ul { list-style: none; }
.further li {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr auto;
  gap: 0.4rem 1.4rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px dotted var(--rule-dot);
}
.f-name { font-weight: 600; font-size: 1.05rem; font-variation-settings: "opsz" 40; }
.f-note { color: var(--ink-soft); font-size: 0.68rem; }
.f-year { color: var(--rust); font-size: 0.72rem; }

/* ============================================================
   POLAROIDS & PICTURES
   ============================================================ */
.polaroid {
  background: var(--stock);
  border: 1px solid var(--rule-edge);
  padding: 0.7rem 0.7rem 0.5rem;
  box-shadow: var(--shadow-photo);
  width: clamp(180px, 22vw, 260px);
  position: relative;
}
.cover-polaroid {
  position: absolute;
  right: clamp(0.5rem, 4vw, 4rem);
  top: 16%;
  width: clamp(210px, 26vw, 320px);
}
.polaroid .tape {
  position: absolute; top: -12px; left: 50%;
  width: 84px; height: 26px;
  /* was backdrop-filter: blur(1px) - every instance forced its own
     backdrop root, for an effect a gradient renders identically */
  background: linear-gradient(158deg, var(--tape), var(--tape-strip) 60%, var(--tape));
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: var(--shadow-tape);
}
.polaroid-img {
  background: var(--paper-deep);
  border: 1px solid var(--rule-faint);
  aspect-ratio: 200 / 170;
  display: grid; place-items: center;
  overflow: hidden;
}
.polaroid-img > img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.polaroid-portrait {
  object-position: center -22px;
  transform: scale(1.7);
}
.polaroid--pipelines { object-position: center; }
.polaroid--vision { 
  object-position: center top; 
  transform: scale(1.2); 
}
.polaroid--rentswipe { 
  object-position: center -30px; 
  transform: scale(1.1);
}
.polaroid figcaption {
  text-align: center; font-size: 1.15rem;
  color: var(--ink-soft); padding-top: 0.35rem;
}
.polaroid--similarity { width: 100%; height: 100%; }
.polaroid--similarity path,
.polaroid--similarity rect,
.polaroid--similarity circle {
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.polaroid--similarity .d-ink { stroke: var(--ink); }
.polaroid--similarity .d-green { stroke: var(--green); }
.polaroid--similarity .d-brown { stroke: var(--brown); }

@media (max-width: 860px) {
  .cover-polaroid {
    position: relative;
    right: auto;
    top: auto;
    margin: 1.5rem auto 0;
  }
}

/* Short windows keep the author picture pinned clear of the cover copy. */
@media (max-height: 820px) and (min-width: 861px) {
  .cover-polaroid {
    top: 8%;
    width: clamp(180px, 23vw, 270px);
  }
}

/* ---------- draggables ---------- */
/* will-change is applied by modules/ephemera.js on pointerdown and
   dropped once the piece settles. Declaring it here would hold a
   compositor layer for all six pieces for the entire session. */
.drag { cursor: grab; touch-action: none; user-select: none; }
.drag { transform: rotate(var(--tilt, 0deg)); }
.drag.is-dragging { cursor: grabbing; box-shadow: var(--shadow-drag); }

/* ============================================================
   STAMPS
   ============================================================ */
.stamp {
  display: inline-grid; place-items: center; gap: 0.15rem;
  text-align: center;
  color: var(--stamp-red);
  border: 3px double var(--stamp-red);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-family: var(--font-mono); font-weight: 700;
  font-size: 0.9rem; letter-spacing: 0.12em; line-height: 1.25;
  opacity: 1;
  mix-blend-mode: var(--stamp-blend);
}
.stamp:not(.stamp-cover):not(.stamp-project) { position: relative; }
/* Roughness belongs to a decorative second impression, not the glyphs.
   Masking 85%-opaque day ink composited to only 4.41:1 before the
   mask's low-alpha flecks lowered it further; full ink is 5.90:1. */
.stamp::after {
  content: ""; position: absolute; inset: -3px;
  border: 3px double currentColor; border-radius: inherit;
  opacity: 0.42; pointer-events: none;
  -webkit-mask-image: var(--mask-rough);
          mask-image: var(--mask-rough);
}
.stamp small { font-weight: 400; font-size: 0.55rem; letter-spacing: 0.08em; }
.stamp-project {
  position: absolute; right: -4%; top: -6%;
  transform: rotate(8deg);
  color: var(--green); border-color: var(--green);
  font-size: 0.72rem;
}

/* ============================================================
   CORRESPONDENCE
   ============================================================ */
.postcard {
  display: grid; grid-template-columns: 1.2fr auto 1fr;
  gap: clamp(1.2rem, 3vw, 2.5rem);
  background: var(--stock);
  border: 2px solid var(--ink);
  border-radius: 14px 220px 12px 240px / 240px 12px 220px 14px;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--shadow-hard);
  transform: rotate(-0.6deg);
  max-width: 900px; margin: 0 auto;
}
.postcard-msg {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem); line-height: 1.3;
  color: var(--ink); margin-bottom: 1rem;
}
.postcard-msg--sign { color: var(--ink-soft); }
.postcard-sig {
  font-size: 2.6rem; color: var(--green);
  display: inline-block; transform: rotate(-4deg);
}
.postcard-divider {
  width: 1.5px; opacity: 0.5;
  background: repeating-linear-gradient(var(--ink-soft) 0 6px, transparent 6px 12px);
}
.postcard-right { display: flex; flex-direction: column; gap: 1.2rem; }
.postage { display: flex; justify-content: flex-end; align-items: flex-start; gap: 0.8rem; }
.postage-stamp {
  width: 62px;
  padding: 4px;
  background: radial-gradient(circle at 0 0, transparent 4px, var(--stock) 4px) 0 0 / 10px 10px;
  filter: drop-shadow(var(--drop-stamp));
  transform: rotate(3deg);
}
/* the stamp artwork was hard-coded hex; these follow the theme */
.postage-stamp .ps-field { fill: var(--green); }
.postage-stamp .ps-hill  { fill: var(--paper); }
.postage-stamp .ps-sun   { fill: var(--amber); }
.postage-stamp .ps-text  { fill: var(--paper); }
.postmark {
  border: 2px solid var(--postmark-ln); border-radius: 50%;
  width: 74px; height: 74px;
  display: grid; place-items: center; text-align: center;
  color: var(--postmark-fg);
  transform: rotate(-8deg);
  font-size: 0.5rem;
}
.postmark .mono { font-size: 0.5rem; line-height: 1.4; }
.address p {
  padding: 0.5rem 0; border-bottom: 1.5px solid var(--rule-strong);
  font-size: 0.78rem;
}
.address-label { color: var(--rust); margin-right: 0.4rem; }
.coffee-ring--contact { left: 10%; top: 10%; right: auto; width: 80px; height: 80px; }

/* ============================================================
   BACK-OF-BOOK INDEX
   ------------------------------------------------------------
   Set like a real index: multi-column, mono, dotted leaders
   running from each entry to the number of the entry it appears
   in. The leader is a repeating gradient on a flex spacer rather
   than the usual ::after full of dots, so it never wraps oddly
   or leaks into the link's hit area.
   ============================================================ */
.backindex { background: var(--paper-warm); }

.bx-cols {
  columns: 3 220px;
  column-gap: clamp(1.5rem, 4vw, 3rem);
  column-rule: 1px dotted var(--rule-dot);
}
.bx-group {
  break-inside: avoid;
  margin-bottom: 1.4rem;
}
.bx-letter {
  color: var(--rust); font-weight: 700;
  border-bottom: 1.5px solid var(--rule-dash);
  padding-bottom: 0.25rem; margin-bottom: 0.45rem;
}
.bx-group ul { list-style: none; }
.bx-group li {
  display: flex; align-items: baseline; gap: 0.4rem;
  padding: 0.22rem 0;
  font-size: 0.92rem;
}
/* the dotted leader */
.bx-group li::after {
  content: ""; flex: 1 1 auto; min-width: 1.2rem;
  align-self: end; margin-bottom: 0.28em; height: 1px;
  background: repeating-linear-gradient(to right,
    var(--rule-dot) 0 1.5px, transparent 1.5px 5px);
  order: 1;
}
.bx-group li a {
  text-decoration: none; color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.bx-group li a:hover { color: var(--green); border-bottom-color: var(--amber); }
.bx-ref { color: var(--rust); order: 2; }

/* ============================================================
   COLOPHON
   ------------------------------------------------------------
   The one surface that does NOT invert. Under lamplight an
   inverting colophon would put amber links on pale green at
   roughly 1.1:1, so it stays a dark printed panel in both themes.
   ============================================================ */
.colophon {
  background: var(--colophon-bg); color: var(--colophon-fg);
  padding: 2.5rem clamp(1.2rem, 4vw, 3rem);
}
.colophon-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: 1rem;
}
.colophon-note { font-size: 1.4rem; color: var(--colophon-fg); transform: rotate(-1deg); }
.colophon .mono { color: var(--colophon-mute); }
.colophon .ink-link { color: var(--colophon-link); border-color: var(--colophon-rule); }
.colophon .ink-link:hover { color: var(--colophon-fg); border-color: var(--colophon-fg); }

/* Component-owned narrow layouts must stay in this layer. Placing them in
   the earlier layout layer leaves them unable to override component rules,
   regardless of source order or selector specificity. */
@media (max-width: 860px) {
  .stamp-cover {
    position: relative; left: auto; bottom: auto;
    align-self: flex-start; margin-top: 1rem;
  }
  .sticker { top: 10%; left: 4%; }
  .postcard { grid-template-columns: 1fr; }
  .postcard-divider { width: auto; height: 1.5px; }
  .postage { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .further li { grid-template-columns: 1fr auto; }
}

@media (max-width: 520px) {
  .cover-frame {
    border-radius: 40px 8px 36px 10px / 10px 36px 8px 40px;
    padding-top: 4rem; /* clear the fixed pocket instruments */
  }
  .coffee-ring { display: none; }
  /* The project stamp is absolutely positioned past its own edge; once
     the polaroid centres there is nothing holding it in. */
  .stamp-project { right: 0; top: -4%; }
}

}
