/* ============================================================
   snapshot cro — shared styles
   Loaded by every page. Design direction is Shep's; this file
   holds the structural shell only.
   ============================================================ */

:root {
  --bg: #000;
  --fg: #fff;
  --accent: #85ff97;          /* the green from the wordmark's "n" */

  /* Card thumbnails. The image is deliberately clipped: it sits
     inset from the top-left and runs off the right and bottom, so
     the card shows a stylized corner rather than the whole shot.
     Tune these two to change how much shows. */
  --thumb-pad: 12%;           /* inset on the top and left only */
  --thumb-zoom: 150%;         /* image width relative to the frame */
  --thumb-radius: 12px;       /* the green frame's corners */
  --thumb-img-radius: 8px;    /* the screenshot's own corners */
  --muted: #8a8a8a;
  --muted-bright: #b4b4b4;    /* hero subtext — a step up from --muted */

  /* Header logo and header buttons share this, so they stay the same
     height at every breakpoint instead of drifting apart. */
  --control-height: 54px;

  /* The modal reads as paper against the dark page — long body copy is
     easier on a light ground. */
  --panel: #f5f5f5;
  --panel-text: #14171a;
  --panel-muted: #5c6166;
  --panel-line: #d9dcde;
  --line: #2a2a2a;
  --gutter: 20px;
  --maxw: 1280px;

  /* One family at every size. Swap these two to change the whole
     site's type; nothing else references a font name. */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-text: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
}

body.modal-open { overflow: hidden; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---- header ---- */

/* Sits in normal flow rather than fixed, so it never overlaps the
   grid on short screens. */
.site-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 22px var(--gutter);
}

/* Inset by the gutter rather than set as a border on the header, so
   the line ends exactly where the card grid does instead of running
   out to the padding edge. */
.site-header::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  border-bottom: 1px solid var(--line);
}

.site-header .buttons { margin-top: 0; }

.brand {
  display: block;
  line-height: 0;
  flex: none;
}

/* Derived from the button height rather than set independently, so
   the two stay in step at every breakpoint. Deliberately a little
   shorter than the buttons. */
.brand img {
  display: block;
  height: calc(var(--control-height) - 8px);
  width: auto;
}

/* ---- hero ---- */

/* Shares the container's max-width and gutter so the headline starts
   on the same line as the logo, the cards and the dividers. */
.hero {
  display: grid;
  justify-items: start;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 64px var(--gutter) 72px;
  text-align: left;
}

.hero-title {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5.2vw, 3.7rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
}

/* Same green as the card borders. */
.hero-title .accent { color: var(--accent); }

.logo {
  margin: 0;
  text-align: center;
}

.logo img {
  display: block;
  width: 92vw;
  max-width: 1200px;
  height: auto;
}

.hero-sub {
  max-width: 62ch;
  margin: 32px 0 0;
  color: var(--muted-bright);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.6;
}

.logo a {
  display: inline-block;
  line-height: 0;
}

/* ---- buttons ---- */

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.buttons a {
  display: inline-flex;
  align-items: center;
  height: var(--control-height);
  padding: 0 28px;
  border: 2px solid var(--fg);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(.95rem, 1.6vw, 1.15rem);
  letter-spacing: .02em;
  transition: background-color .15s ease, color .15s ease;
}

.buttons a:hover,
.buttons a:focus-visible {
  background: var(--fg);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---- questions ---- */

.questions-section { padding: 0 0 72px; }

.questions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.question {
  padding: 11px 20px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  font: inherit;
  font-size: .95rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.question:hover,
.question:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- card grid ---- */

.grid-section { padding: 0 0 100px; }

.group-title {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.group-divider {
  height: 0;
  margin: 64px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Padding is always present, not added on highlight, so switching the
   background on doesn't shift the card's contents. */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 14px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

/* Fixed ratio reserves the space before the image loads, so the
   grid doesn't jump as cards fill in. */
.card-image {
  display: block;
  aspect-ratio: 4 / 3;
  padding: var(--thumb-pad) 0 0 var(--thumb-pad);
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: var(--thumb-radius);
  overflow: hidden;
}

/* Anchored top-left at its own scale — whatever falls outside the
   frame on the right and bottom is clipped away. */
.card-image img {
  display: block;
  width: var(--thumb-zoom);
  max-width: none;
  height: auto;
  border-radius: var(--thumb-img-radius);
  transition: transform .25s ease;
  transform-origin: top left;
}

.card:hover .card-image img,
.card:focus-visible .card-image img {
  transform: scale(1.03);
}

/* Set when a question sends the reader to this card. Inverted rather
   than outlined, and it stays until they open the card or pick a
   different question. */
.card.is-highlighted {
  background: var(--accent);
  color: var(--bg);
}

.card.is-highlighted .card-subtitle { color: rgba(0, 0, 0, .68); }

/* The thumbnail frame keeps its black fill and green border when the
   card is highlighted, so the image still sits on black. */

.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.2;
}

.card-subtitle {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.3;
}

.grid-error {
  grid-column: 1 / -1;
  color: var(--muted);
}

/* ---- modal ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(0, 0, 0, .85);
  overflow-y: auto;
}

.modal[hidden] { display: none; }

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: calc(100vh - 2 * var(--gutter));
  overflow-y: auto;
  /* Top padding clears the close button rather than letting it sit
     over the image column. */
  padding: 60px 40px 32px;
  background: var(--panel);
  color: var(--panel-text);
  border: 2px solid var(--accent);
  border-radius: var(--thumb-radius);
}

/* ---- modal: head ---- */

.modal-head {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 36px;
  align-items: center;
}

/* Text takes the full width when an item has no image. */
.modal-head.is-textonly { grid-template-columns: 1fr; }

.modal-divider {
  height: 0;
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--panel-line);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--panel-line);
  border-radius: 50%;
  color: var(--panel-text);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.modal-close:hover {
  background: var(--panel-text);
  color: var(--panel);
}

/* Sticky so it stays reachable part-way down a long body, and lands in
   the corner when the reader gets to the end. */
.modal-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
  padding: 12px 0 4px;
  background: var(--panel);
}

.modal-top {
  padding: 10px 18px;
  background: none;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  color: var(--panel-muted);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.modal-top:hover,
.modal-top:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.modal-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--panel-line);
  border-radius: var(--thumb-img-radius);
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--panel-muted);
  font-size: 1rem;
}

/* Capped independently of the panel — at 1200px wide, full-width
   paragraphs would run past the point where the eye can find the
   next line. */
.modal-body {
  max-width: 70ch;
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.65;
}

.modal-body p { margin: 0 0 1em; }
.modal-body p:last-child { margin-bottom: 0; }

/* ---- responsive ---- */

@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  /* The wordmark is 8:1, so at phone widths it reads as a thin strip
     unless it runs nearly edge to edge. Uncapped here on purpose. */
  .logo img { width: 96vw; max-width: none; }

  /* Left, not centred — the hero below it is left-aligned, and a
     centred logo over a left-aligned headline reads as a mistake. */
  .site-header { justify-content: flex-start; padding-top: 18px; }
  :root { --control-height: 46px; }
  .hero { padding: 44px var(--gutter) 56px; }
}

@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .modal-panel { padding: 56px 20px 28px; }
  .modal-head { grid-template-columns: 1fr; gap: 24px; }
  .modal-divider { margin: 24px 0; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
