/* ==========================================================================
   Home: field notebook layout
   Sticky profile column on the left, a scrolling research log on the right.
   ========================================================================== */

.shell {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

/* ---------- Profile column ---------- */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 28px 24px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
}
.side__card { display: flex; flex-direction: column; gap: 18px; }
.side__top { display: flex; justify-content: space-between; align-items: center; }
.side__handle { color: var(--ink); font-size: 13px; font-weight: 500; }

.tag { display: flex; align-items: center; gap: 16px; }
.tag__photo {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--soft);
}
.tag__photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 8%;
  transform: scale(1);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.tag:hover .tag__photo img { transform: scale(1.06) rotate(-3deg); }
.tag__ring {
  position: absolute;
  inset: -14px;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
  font-family: var(--font-mono);
  font-size: 9.6px;
  letter-spacing: .08em;
  fill: var(--accent);
  animation: spin 22s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tag__id { min-width: 0; padding-left: 8px; }
.tag__name { font-weight: 600; font-size: 16px; line-height: 1.3; }

.side__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 1.3rem + 1vw, 2.125rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
}
.side__title em { color: var(--accent); }
.side__lead { color: var(--muted); font-size: 15px; }

.tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 12px 0;
}
.tally div { display: flex; flex-direction: column-reverse; }
.tally dd { margin: 0; font-family: var(--font-serif); font-size: 36px; line-height: 1; }
.tally dt { font-size: 12px; color: var(--muted); }

.side__actions { display: flex; flex-direction: column; gap: 10px; }
.copy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.copy-btn:hover { opacity: .9; }
.copy-btn.is-copied .copy-btn__text::after { content: "  copied ✓"; color: var(--accent-on-ink); }
.side__links { display: flex; align-items: center; gap: 16px; }
.side__link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }

/* Section nav: two columns of trail markers */
.trail-nav ol {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.trail-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 2px 0;
  font-size: 14px;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s;
}
.trail-nav a .mono { font-size: 11px; transition: color .2s; }
.trail-nav a:hover, .trail-nav a[aria-current="true"] { color: var(--ink); opacity: 1; }
.trail-nav a[aria-current="true"] .mono { color: var(--accent); }
.trail-nav a[aria-current="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Feed ---------- */
.feed {
  min-width: 0;
  max-width: 880px;
  padding: 40px 64px 0;
}
.feed:focus { outline: none; }

.chapter { padding-top: 96px; display: flex; flex-direction: column; gap: 28px; scroll-margin-top: 16px; }
.chapter__head { display: flex; flex-direction: column; gap: 6px; }
.chapter__intro { color: var(--muted); max-width: 600px; margin-top: 4px; }

/* Field log */
.log {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 28px;
  scroll-margin-top: 16px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(18, 23, 38, .35);
}
.log::before {
  /* binder clip */
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 56px;
  height: 14px;
  margin-left: -28px;
  border-radius: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.log__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.log__title { font-family: var(--font-serif); font-weight: 500; font-size: 24px; display: flex; align-items: center; gap: 10px; }
.pulse { position: relative; width: 10px; height: 10px; border-radius: 50%; background: #22A06B; }
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #22A06B;
  animation: ping 1.8s ease-out infinite;
}
.log__rows { margin: 0; }
.log__rows div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 16px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.log__rows dt { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding-top: 3px; }
.log__rows dd { margin: 0; }

/* ---------- Study trail ---------- */
.trail { list-style: none; padding: 0; margin: 0; }
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 64px;
}
.entry::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 48px;
  bottom: 4px;
  border-left: 2px dashed var(--line);
}
.entry:last-child { padding-bottom: 0; }
.entry:last-child::before { display: none; }
.entry__node {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  transition: background-color .3s, color .3s, transform .3s;
}
.entry:hover .entry__node { background: var(--accent); color: var(--on-accent); transform: rotate(-12deg) scale(1.06); }
.entry__body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.entry__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
  line-height: 1.18;
}
.entry__title a { text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size .35s; }
.entry__title a:hover { opacity: 1; background-size: 100% 2px; }
.entry__q, .entry__insight { display: grid; grid-template-columns: 56px 1fr; gap: 12px; }
.entry__q .mono, .entry__insight .mono { padding-top: 4px; }
.entry__insight { font-family: var(--font-serif); font-size: 20px; line-height: 1.4; }
.entry__more { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

/* Specimen: the "try it" box in each entry */
.specimen {
  margin: 4px 0 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.specimen__bar { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.specimen__bar > .mono:first-child::before { content: "✦ "; color: var(--accent); }
.specimen__cap { padding: 12px 16px; border-radius: 12px; background: var(--soft); font-size: 15px; }
.specimen__readout { color: var(--ink); font-size: 13px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--soft); }
.seg button {
  min-height: 36px;
  min-width: 52px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(18, 23, 38, .18); color: var(--ink); }
@media (pointer: coarse) { .seg button { min-height: 44px; } }

/* Sun dial */
.sun-dial { width: 100%; height: auto; border-radius: 12px; background: linear-gradient(var(--soft), var(--surface)); }
.sun-dial__arc { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 3 5; }
.sun-dial__blanket { fill: var(--soft); stroke: var(--line); }
.sun-dial__trace { stroke: var(--hour, var(--accent)); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 5; opacity: .9; }
.sun-dial__shadow { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; opacity: .55; transition: all .6s cubic-bezier(.2, .8, .2, 1); }
.sun-dial__object { fill: var(--ink); }
.sun-dial__sun { fill: #F5B638; filter: drop-shadow(0 0 8px rgba(245, 182, 56, .7)); transition: cx .6s cubic-bezier(.2, .8, .2, 1), cy .6s cubic-bezier(.2, .8, .2, 1); }
.specimen__cap[data-hour] { border-left: 3px solid var(--hour); }

/* Match slider */
.match-track {
  --p: 1;
  height: 120px;
  border-radius: 12px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
}
.match-track__path {
  height: 0;
  width: calc(4px + var(--p) * (100% - 140px));
  border-top: 2px dashed var(--muted);
  opacity: .5;
  transition: width .25s;
}
.match-track.is-ping .band::after { animation: ping 1.4s ease-out infinite; }
.match-track.is-joined { gap: 0; }
.match-track.is-joined .match-track__path { width: 0; border: 0; }
.match-track.is-joined .band { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); }
.match-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.match-controls__label { font-size: 14px; color: var(--muted); }
.range { flex: 1 1 200px; min-height: 44px; accent-color: var(--accent); cursor: grab; }
.match-controls__tap { min-height: 44px; }
.match-controls__tap:disabled { opacity: .35; cursor: not-allowed; }

/* Human barometer */
.baro__q { font-family: var(--font-serif); font-size: 22px; line-height: 1.35; }
.baro {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  position: relative;
}
.baro button {
  min-height: 56px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  transition: transform .2s, border-color .2s;
}
.baro button:hover { border-color: var(--accent); transform: translateY(-2px); }
.baro button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.baro__reveal { display: flex; flex-direction: column; gap: 10px; animation: rise .5s cubic-bezier(.2, .8, .2, 1); }
.baro__shift { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.baro__shift li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.baro__shift .before, .baro__shift .after { padding: 12px 14px; border-radius: 12px; font-family: var(--font-serif); font-size: 16px; line-height: 1.4; }
.baro__shift .before { border: 1px dashed var(--line); color: var(--muted); }
.baro__shift .after { background: var(--soft); }
.baro__shift .arrow { color: var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .baro { grid-template-columns: 1fr 1fr; }
  .baro button:last-child { grid-column: 1 / -1; }
  .baro__shift li { grid-template-columns: 1fr; }
  .baro__shift .arrow { transform: rotate(90deg); justify-self: center; }
}

/* ---------- Process path ---------- */
.path {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  counter-reset: step;
}
.path li {
  position: relative;
  padding-top: 34px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-increment: step;
}
.path li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.path li::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 28px;
  right: -16px;
  border-top: 2px dashed var(--line);
}
.path li:last-child::after { display: none; }
.path__verb { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.path__title { font-weight: 600; font-size: 17px; line-height: 1.3; }
.path__text { font-size: 14px; color: var(--muted); }
@media (max-width: 760px) {
  .path { grid-template-columns: 1fr; gap: 24px; }
  .path li { padding: 0 0 0 40px; }
  .path li::after { top: 28px; left: 11px; right: auto; bottom: -24px; border-top: 0; border-left: 2px dashed var(--line); }
}

/* ---------- Photos (shared) ---------- */
.photo { position: relative; display: block; background: var(--soft); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.is-missing img { visibility: hidden; }
.photo.is-missing::after {
  content: "[add photo: " attr(data-file) "]";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.tag__photo.is-missing::after { content: "[photo]"; border-radius: 50%; }

/* ---------- On stage: shuffle deck ---------- */
.deck-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 12px 0; }
.deck {
  list-style: none;
  padding: 0;
  position: relative;
  width: min(380px, 100%);
  aspect-ratio: 4 / 5;
}
.deck__card {
  position: absolute;
  inset: 0;
  transform: rotate(var(--r)) translateY(calc(var(--i, 0) * 6px));
  z-index: calc(10 - var(--i, 0));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .3s;
}
.deck__card figure {
  height: 100%;
  margin: 0;
  padding: 12px 12px 0;
  border-radius: 6px;
  background: #FFFFFF;
  box-shadow: 0 2px 4px rgba(18, 23, 38, .12), 0 24px 40px -24px rgba(18, 23, 38, .55);
  display: flex;
  flex-direction: column;
}
.deck__card figure img { flex: 1; min-height: 0; border-radius: 2px; }
.deck__card figcaption {
  padding: 12px 4px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #121726;
  text-align: center;
}
.deck__card.is-tossing { transform: translateX(110%) rotate(18deg); opacity: 0; }
.deck__card:not(:first-child) figcaption { visibility: hidden; }
.deck__controls { display: flex; align-items: center; gap: 16px; }

/* ---------- About ---------- */
.about__feature { border-radius: 20px; aspect-ratio: 1280 / 1008; }
.about__feature figcaption {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(11, 17, 32, .78);
  color: #FFFFFF;
  font-size: 13px;
  backdrop-filter: blur(6px);
}
.about__feature figcaption .mono { color: #B9CBFF; }
.about__text { font-size: 18px; }
.hats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 10px; }
.hat {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform .25s, box-shadow .25s;
}
.hat:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 16px 30px -22px rgba(18, 23, 38, .5); }
.hat__role { font-weight: 600; margin-top: 4px; }
.hat__where { font-size: 14px; color: var(--muted); }
.about__off { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline; color: var(--muted); font-size: 15px; }

/* ---------- Beyond the lab: pinboard ---------- */
.pinboard {
  list-style: none;
  padding: 8px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 28px 24px;
  align-items: start;
}
.pinboard li { transform: rotate(var(--r)); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.pinboard li:nth-child(2) { margin-top: 28px; }
.pinboard li:hover, .pinboard li:focus-within { transform: rotate(0) scale(1.03); z-index: 1; }
.polaroid {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10px 10px 0;
  border: 0;
  border-radius: 4px;
  background: #FFFFFF;
  box-shadow: 0 2px 4px rgba(18, 23, 38, .12), 0 20px 34px -22px rgba(18, 23, 38, .55);
  cursor: zoom-in;
  text-align: center;
}
.polaroid::before {
  /* tape */
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 22px;
  margin-left: -35px;
  background: color-mix(in srgb, var(--accent-on-ink) 70%, transparent);
  transform: rotate(-4deg);
  z-index: 1;
}
.polaroid .photo { aspect-ratio: 4 / 3.4; }
.polaroid__cap { padding: 10px 4px 12px; font-family: var(--font-mono); font-size: 11px; line-height: 1.45; color: #121726; }

.lightbox {
  max-width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}
.lightbox::backdrop { background: rgba(11, 17, 32, .75); backdrop-filter: blur(4px); }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto; border-radius: 8px; }
.lightbox p { margin-top: 10px; text-align: center; }
.lightbox form { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- Voices / contact / footer inside the feed ---------- */
.voices__count { margin-left: 8px; vertical-align: middle; }
.voices__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.voices .quote { font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.375rem); }
.home .contact { margin: 96px 0 0; padding: 48px; }
.feed__foot {
  margin-top: 40px;
  padding: 12px 0 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.feed__foot a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Narrow screens: profile on top, sticky section bar ---------- */
@media (max-width: 1023px) {
  .shell { display: block; }
  .side { display: contents; }
  .side__card { padding: 16px 24px 28px; max-width: 720px; }
  .trail-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .trail-nav ol { display: flex; gap: 18px; padding: 0 24px; width: max-content; }
  .trail-nav a { min-height: 48px; white-space: nowrap; }
  .trail-nav a[aria-current="true"]::after { display: none; }
  .trail-nav a[aria-current="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .feed { padding: 32px 24px 0; max-width: 760px; margin: 0 auto; }
  .chapter, .log { scroll-margin-top: 64px; }
}
@media (max-width: 560px) {
  .chapter { padding-top: 72px; }
  .entry { grid-template-columns: 1fr; gap: 12px; }
  .entry::before { display: none; }
  .entry__q, .entry__insight { grid-template-columns: 1fr; gap: 2px; }
  .log { padding: 22px 20px; }
  .log__rows div { grid-template-columns: 1fr; }
  .voices__card { padding: 22px; }
  .home .contact { padding: 36px 24px; }
  .about__off { grid-template-columns: 1fr; gap: 2px; }
}

.stat-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chips li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-family: var(--font-mono); font-size: 12px; }
.tag__photo img { object-position: 50% 30%; }
.pinboard .photo img { object-position: 50% 35%; }
/* Per-photo focal point so faces stay in frame when a photo is cropped */
.deck__card .photo img, .pinboard .photo img { object-position: var(--pos, 50% 30%); }
