/* ============================================================
   Robert Reynik — portfolio styles
   Refined-minimal. Generous whitespace, serif display name,
   clean sans body. Edit the variables below to retheme.
============================================================ */

:root {
  --ink:        #1d1d1f;   /* near-black text */
  --ink-soft:   #4a4a4f;   /* secondary text */
  --ink-faint:  #86868b;   /* hints, captions */
  --line:       #e4e4e2;   /* hairline borders */
  --bg:         #ffffff;
  --bg-alt:     #f5f5f3;   /* alt section background */
  --panel:      #aec3da;   /* the hero blue panel */
  --panel-ink:  #1f2d3d;   /* dark text used on the blue panel */
  --accent:     #1f4e87;   /* button / link accent */

  --maxw: 1120px;
  --pad:  clamp(20px, 5vw, 48px);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body:    "Hanken Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: 300;            /* thin, airy body text */
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; font-weight: 500; }

a { color: inherit; text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-size: 15px;
  font-weight: 100;
  padding: 12px 26px;
  border-radius: 0px;
  width: 200px;
  text-align: center;
  transition: transform .15s ease, background .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn--solid { background: var(--accent); color: #fff; }
.btn--solid:hover { opacity: .9; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 16px var(--pad);
  display: flex; align-items: center; gap: clamp(24px, 5vw, 72px);
}
.nav__brand { display: flex; align-items: center; flex: 0 0 auto; }
.nav__logo { display: block; width: 40px; height: 40px; }
/* links take the remaining width and spread out evenly across it */
.nav__links {
  flex: 1;
  display: flex;
  justify-content: space-between;
  font-size: 16px; color: var(--ink-soft);
}
.nav__links a { transition: color .2s ease; }
.nav__links a:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  max-width: var(--maxw);
  margin: clamp(24px, 5vw, 56px) auto 0;
  padding: 0 var(--pad);
  min-height: clamp(440px, 60vh, 620px);
  display: flex;
  align-items: center;
}

/* image area sits to the right, behind/around the panel — and is a link */
.hero__bg {
  position: absolute;
  top: 0; bottom: 0;
  right: var(--pad);
  left: clamp(0px, 18vw, 220px);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-alt);
  cursor: pointer;
  display: block;
}
.hero__layer {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s ease-in-out, transform .6s ease;
}
.hero__layer.is-visible { opacity: 1; }
/* gentle cue that the image is clickable */
.hero__bg:hover .hero__layer.is-visible { transform: scale(1.02); }

/* the blue panel — FIXED landscape size, never changes with the screen,
   so the text is always fully visible */
.hero__panel {
  position: relative;
  z-index: 2;
  background: var(--panel);
  color: var(--panel-ink);
  padding: 38px 48px;
  width: 540px;          /* fixed width                       */
  min-height: 340px;     /* width is always > height (landscape) */
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 4px;
}
.hero__name { font-family: var(--font-display); font-size: 56px; font-weight: 500; line-height: 1.05; }
.hero__role { font-size: 16px; color: var(--panel-ink); opacity: .75; margin-top: 4px; }
.hero__lead { font-size: 17px; margin: 22px 0 28px; max-width: 45ch; }

/* ---------- Credibility strip ---------- */
.strip {
  max-width: var(--maxw); margin: 0 auto;
  padding: 26px var(--pad);
  border-bottom: 1px solid var(--line);
  margin-top: clamp(10px, 6vw, 30px);
}
.strip p { color: var(--ink-soft); font-size: 15px; }

/* ---------- Generic section ---------- */
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--pad);
}
.section--alt { max-width: none; background: var(--bg-alt); }
.section--alt .section__head,
.section--alt .cards { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section__head { margin-bottom: 36px; }
.section__head h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 42px); }
.section__sub { color: var(--ink-faint); font-size: 16px; margin-top: 6px; }

/* ---------- Carousel (Selected work) ---------- */
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 14px;        /* room for scrollbar */
  scrollbar-width: thin;
}
.work-card { scroll-snap-align: start; display: block; }
.work-card__img {
  position: relative;
  width: 100%; aspect-ratio: 4 / 3;
  background-size: cover; background-position: center;
  background-color: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
}
/* solid layer that fades the photo out to the background colour on hover */
.work-card__img::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--bg-alt);
  opacity: 0;
  transition: opacity .4s ease;
}
.work-card:hover .work-card__img::after,
.work-card:focus-visible .work-card__img::after { opacity: 1; }

/* the text that appears over the faded image */
.work-card__overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease;
}
.work-card:hover .work-card__overlay,
.work-card:focus-visible .work-card__overlay {
  opacity: 1; transform: none;
}
.work-card__type {
  align-self: flex-start;
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 20px;
  margin-bottom: auto;
}
.work-card__title { font-weight: 500; font-size: 20px; color: var(--ink); margin-top: 12px; }
.work-card__desc  { color: var(--ink-soft); font-size: 15px; margin-top: 4px; }

/* On wide screens, show them as a tidy 3-up grid instead of scrolling */
@media (min-width: 880px) {
  .carousel {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    overflow: visible;
  }
}

/* "Load More" button, centered below the Recent projects grid */
.section__more {
  display: flex;
  justify-content: center;
  margin-top: clamp(36px, 5vw, 56px);
}

/* ---------- Writing cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card-article {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-article:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.card-article h3 { font-size: 18px; margin: 14px 0 6px; }
.card-article p  { color: var(--ink-faint); font-size: 15px; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.tag--research { background: #e7eefb; color: #1f4e87; }
.tag--tutorial { background: #e6f4ea; color: #1e6b3a; }
.tag--studio   { background: #fbf0dd; color: #8a5a12; }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--bg-alt); border-top: 1px solid var(--line); }
.newsletter__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(48px, 7vw, 80px) var(--pad);
}
.newsletter h2 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); }
.newsletter p  { color: var(--ink-soft); margin: 8px 0 22px; }
.newsletter__form { display: flex; gap: 12px; max-width: 460px; flex-wrap: wrap; }
.newsletter__form input {
  flex: 1; min-width: 220px;
  padding: 12px 16px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.newsletter__form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 28px var(--pad);
  display: flex; justify-content: space-between;
  color: var(--ink-faint); font-size: 14px;
}

/* ---------- Responsive: stack hero on small screens ---------- */
@media (max-width: 720px) {
  .hero { flex-direction: column; min-height: 0; }
  .hero__bg { position: relative; left: 0; right: 0; height: 280px; order: 2; margin-top: 18px; }
  /* keep the panel's fixed size, but never let it overflow a phone */
  .hero__panel { width: min(540px, 100%); order: 1; }
  .cards { grid-template-columns: 1fr; }
  .nav__inner { gap: 20px; }
  .nav__links { gap: 14px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
}

/* ---------- Respect reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero__layer { transition: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   SHARED PAGE PIECES (About, Portfolio, Writing, Contact)
============================================================ */

/* active nav link */
.nav__links a.is-active { color: var(--accent); }

/* footer social links */
.footer__social { display: flex; gap: 22px; }
.footer__social a { transition: color .2s ease; }
.footer__social a:hover { color: var(--ink); }

/* generic page wrapper + big serif title */
.page {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--pad) clamp(40px, 6vw, 72px);
}
.page--center { text-align: center; padding-bottom: 0; }
.page__title { font-family: var(--font-display); font-size: clamp(40px, 6vw, 64px); font-weight: 500; }
.page__sub { color: var(--ink-faint); font-size: 17px; margin-top: 8px; }

/* prose block */
.prose { max-width: 760px; margin-top: 28px; }
.prose p { font-size: 17px; color: var(--ink-soft); margin-bottom: 22px; }

.btn-row { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }

/* ---------- Education ---------- */
.edu { background: var(--bg-alt); border-top: 1px solid var(--line); }
.edu__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--pad);
}
.edu__inner .page__title { margin-bottom: 44px; }
.edu__row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.edu__row:first-of-type { border-top: none; }
.edu__label {
  font-size: 15px; color: var(--ink-soft);
}
.edu__label .edu__period {
  display: inline-block; padding-bottom: 4px; margin-bottom: 8px;
  border-bottom: 1px solid var(--ink-faint);
  font-weight: 500; color: var(--ink);
}
.edu__detail p { font-size: 16px; color: var(--ink-soft); margin-bottom: 12px; }
.edu__detail ul { list-style: none; }
.edu__detail li { font-size: 16px; color: var(--ink-soft); padding: 4px 0; }

/* ============================================================
   ABOUT PAGE — collapsible sections (accordion) built from
   data/about.js. All closed by default; each toggles on its own.
============================================================ */
.about-sections {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(8px, 3vw, 24px) var(--pad) 0;
}

.acc { border-bottom: 1px solid var(--line); }
.acc:first-child { border-top: 1px solid var(--line); }

/* the clickable header — title left, chevron right */
.acc__head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 26px 2px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; text-align: left;
  color: var(--ink);
}
.acc__title {
  position: relative;
  font-size: clamp(17px, 2.2vw, 21px);
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding-bottom: 7px;
}
/* the short underline accent under the title text (like the picture) */
.acc__title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; background: var(--ink);
}
.acc__icon { color: var(--ink-faint); flex: 0 0 auto; transition: transform .35s ease; }
.acc.is-open .acc__icon { transform: rotate(180deg); color: var(--ink); }
.acc__head:hover .acc__icon { color: var(--ink); }

/* smooth open/close via animatable grid rows (no JS height measuring) */
.acc__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s ease;
}
.acc.is-open .acc__panel { grid-template-rows: 1fr; }
.acc__inner { overflow: hidden; min-height: 0; }
.acc__content { padding: 2px 2px 30px; }

/* ---------- one entry inside a section ---------- */
.entry { padding: 20px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: none; padding-top: 6px; }
.entry__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
}
.entry__title { font-weight: 500; font-size: 17px; color: var(--ink); }
.entry__subtitle { color: var(--ink-soft); font-size: 15px; margin-top: 2px; }
.entry__meta { color: var(--ink-faint); font-size: 14px; white-space: nowrap; flex: 0 0 auto; }
.entry__body { margin-top: 12px; }
.entry__body p { color: var(--ink-soft); font-size: 15px; max-width: 70ch; }
.entry__body ul { list-style: none; margin-top: 2px; }
.entry__body li {
  position: relative; padding: 4px 0 4px 18px;
  color: var(--ink-soft); font-size: 15px; max-width: 70ch;
}
.entry__body li::before {
  content: ""; position: absolute; left: 2px; top: 12px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint);
}
.entry__links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 16px; }
.entry__links a {
  color: var(--accent); font-size: 14px; font-weight: 500;
  border-bottom: 1px solid transparent; transition: border-color .2s ease;
}
.entry__links a:hover { border-color: var(--accent); }

/* ---------- Skills: flat pills (like the picture) ---------- */
.skills { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 2px 30px; }
.skill {
  border: 1px solid var(--line); border-radius: 24px;
  padding: 10px 18px; background: #fff;
  font-size: 14px; font-weight: 500; color: var(--ink);
  transition: border-color .2s ease, transform .2s ease;
}
.skill:hover { border-color: var(--ink-faint); transform: translateY(-1px); }

/* ---------- Closing notes ---------- */
.about-notes {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(28px, 5vw, 48px) var(--pad) 0;
}
.about-note { color: var(--ink-soft); font-size: 15px; }
.about-note + .about-note { margin-top: 6px; }

/* ---------- About responsive + reduced motion ---------- */
@media (max-width: 560px) {
  .entry__head { flex-direction: column; gap: 4px; }
  .entry__meta { order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  .acc__panel, .acc__icon { transition: none; }
}

/* ---------- Portfolio grid ---------- */
.portfolio {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) var(--pad) clamp(64px, 9vw, 110px);
}
.portfolio__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.portfolio__item { display: block; overflow: hidden; border-radius: 4px; }
.portfolio__img {
  width: 100%; aspect-ratio: 1 / 1;
  background-size: cover; background-position: center;
  background-color: var(--bg-alt);
  transition: transform .5s ease, filter .4s ease;
}
.portfolio__item:hover .portfolio__img { transform: scale(1.03); }
.portfolio__cap {
  margin-top: 12px;
}
.portfolio__cap .t { font-weight: 600; font-size: 16px; }
.portfolio__cap .d { color: var(--ink-faint); font-size: 14px; }

@media (max-width: 860px) { .portfolio__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .portfolio__grid { grid-template-columns: 1fr; } }

/* ---------- Writing list ---------- */
.writing-list { margin-top: 36px; max-width: 820px; }
.writing-item {
  display: block;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  transition: opacity .2s ease;
}
.writing-item:hover { opacity: .65; }
.writing-item__meta { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.writing-item__date { font-size: 13px; color: var(--ink-faint); }
.writing-item__title { font-family: var(--font-display); font-size: clamp(24px, 3vw, 30px); font-weight: 500; }
.writing-item__excerpt { color: var(--ink-soft); font-size: 16px; margin-top: 8px; max-width: 64ch; }

/* ============================================================
   CONTACT PAGE
============================================================ */
.contact-hero { background: var(--bg-alt); padding: clamp(36px, 6vw, 72px) var(--pad) 0; }
.contact-hero__inner {
  max-width: var(--maxw); margin: 0 auto;
  background: #fff; border-radius: 4px;
  display: grid; grid-template-columns: 360px 1fr;
  overflow: hidden;
}
.contact-hero__logo {
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
}
.contact-hero__text { padding: clamp(36px, 5vw, 64px); align-self: center; }
.hello {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(44px, 6vw, 68px);
  letter-spacing: .14em;
  color: var(--panel-ink);
  margin-bottom: 20px;
  transition: opacity .4s ease;
  min-height: 1.1em;
}
.hello.is-fading { opacity: 0; }
.contact-hero__text p { color: var(--ink-soft); font-size: 16px; max-width: 52ch; }

.contact-main { background: var(--bg-alt); padding: 24px var(--pad) clamp(36px, 6vw, 72px); }
.contact-main__inner {
  max-width: var(--maxw); margin: 0 auto;
  background: #fff; border-radius: 4px;
  display: grid; grid-template-columns: 1fr 1.2fr;
  gap: clamp(32px, 6vw, 80px);
  padding: clamp(40px, 6vw, 72px);
}
.contact-name { font-family: var(--font-display); font-size: 30px; font-weight: 500; }
.contact-rule { border: none; border-top: 1px solid var(--ink); width: 48px; margin: 18px 0 26px; }
.contact-field { margin-bottom: 18px; font-size: 20px; font-family: var(--font-display); }
.contact-field span { display: block; font-family: var(--font-body); font-size: 13px; color: var(--ink-faint); letter-spacing: .04em; margin-bottom: 2px; }
.contact-field a { border-bottom: 1px solid transparent; transition: border-color .2s; }
.contact-field a:hover { border-color: var(--ink); }

.contact-form { display: flex; flex-direction: column; gap: 18px; }
.contact-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form label { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-soft); gap: 6px; }
.contact-form input, .contact-form textarea {
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 11px 13px; border: 1px solid #c9c9c6; border-radius: 4px; background: #fff;
  width: 100%; resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.btn--block { width: 100%; text-align: center; border: none; cursor: pointer; font-family: inherit; }

.contact-social { background: var(--bg-alt); padding: 0 var(--pad) clamp(36px, 6vw, 64px); }
.contact-social__inner {
  max-width: var(--maxw); margin: 0 auto;
  background: #fff; border-radius: 4px;
  display: flex; justify-content: space-around; flex-wrap: wrap; gap: 18px;
  padding: 34px var(--pad);
  font-family: var(--font-display); font-size: 22px;
}
.contact-social__inner a { transition: color .2s ease; }
.contact-social__inner a:hover { color: var(--accent); }

/* contact responsive */
@media (max-width: 820px) {
  .contact-hero__inner { grid-template-columns: 1fr; }
  .contact-hero__logo { min-height: 200px; }
  .contact-main__inner { grid-template-columns: 1fr; }
  .contact-form__row { grid-template-columns: 1fr; }
}

/* ============================================================
   CASE STUDY  (projects/<slug>.html — generated from works.js)
   Refined-minimal, generous whitespace, quiet section labels.
============================================================ */

.case {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) var(--pad) clamp(72px, 9vw, 120px);
}

/* small "back to portfolio" link above the title */
.case__back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; color: var(--ink-faint);
  margin-bottom: clamp(20px, 4vw, 36px);
  transition: color .2s ease;
}
.case__back:hover { color: var(--ink); }
.case__back svg { width: 14px; height: 14px; }

/* the small uppercase label that opens each section */
.case__eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 16px;
}

/* generous gap between the major blocks */
.case__section { margin-top: clamp(56px, 9vw, 104px); }
.case__section:first-of-type { margin-top: clamp(32px, 5vw, 56px); }

/* ---------- 1 · Cover ---------- */
.case__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 72px);
  font-weight: 500; letter-spacing: -.01em;
  max-width: 18ch;
}
.case__lead {
  font-size: clamp(18px, 2.4vw, 23px);
  color: var(--ink-soft);
  margin-top: 16px; max-width: 46ch; line-height: 1.45;
}
.case__meta {
  display: flex; flex-wrap: wrap; gap: 8px 40px;
  margin-top: 30px; padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 15px; color: var(--ink-soft);
}
.case__meta div { display: flex; flex-direction: column; gap: 2px; }
.case__meta dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.case__meta dd { font-weight: 500; color: var(--ink); }

.case__cover {
  margin-top: clamp(28px, 4vw, 44px);
  width: 100%; aspect-ratio: 16 / 9;
  background-size: cover; background-position: center;
  background-color: var(--bg-alt);
  border-radius: 6px;
}

/* ---------- 2 · The brief ---------- */
.case__brief p {
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--ink); line-height: 1.55;
  max-width: 62ch;
}

/* ---------- 3 · Process (signature 4-up) ---------- */
.case__process {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 1.6vw, 22px);
}
.case__step { display: block; }
.case__step-img {
  width: 100%; aspect-ratio: 4 / 5;
  background-size: cover; background-position: center;
  background-color: var(--bg-alt);
  border-radius: 5px;
}
.case__step-label {
  margin-top: 12px; font-size: 14px; font-weight: 500;
  color: var(--ink-soft); text-align: center;
}

/* ---------- 4 · Key decisions ---------- */
.case__decisions {
  display: flow-root; /* contains the floated image within the section */
}
.case__decisions p {
  font-size: 17px; color: var(--ink-soft); line-height: 1.65;
}
/* Image floats so the paragraph wraps around it (magazine style).
   height:auto means it keeps its own proportions — 16:9, 9:16, 4:3
   all integrate naturally without cropping. */
.case__decisions-img {
  float: right;
  width: clamp(240px, 40%, 460px);
  height: auto;
  margin: 6px 0 20px clamp(24px, 4vw, 48px);
  background-color: var(--bg-alt);
  border-radius: 6px;
}

/* ---------- 5 · Outcome ---------- */
.case__outcome-img {
  width: 100%; aspect-ratio: 16 / 9;
  background-size: cover; background-position: center;
  background-color: var(--bg-alt);
  border-radius: 6px;
}
.case__outcome p {
  font-size: clamp(17px, 2vw, 20px); color: var(--ink-soft);
  line-height: 1.6; max-width: 60ch; margin-top: 26px;
}
.case__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
  margin-top: clamp(24px, 3vw, 36px);
}
.case__metric {
  background: var(--bg-alt);
  border-radius: 8px;
  padding: clamp(18px, 2.4vw, 26px);
}
.case__metric dt {
  font-size: 13px; color: var(--ink-faint); margin-bottom: 8px;
}
.case__metric dd {
  font-size: clamp(26px, 3.4vw, 36px); font-weight: 600;
  letter-spacing: -.01em; color: var(--ink);
}

/* ---------- Gallery (optional extra images) ---------- */
/* Masonry-style columns: images keep their natural dimensions and the
   grid flows around them, so nothing is cropped regardless of shape. */
.case__gallery {
  column-count: 3;
  column-gap: clamp(12px, 1.6vw, 22px);
}
.case__gallery-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 clamp(12px, 1.6vw, 22px);
  background-color: var(--bg-alt);
  border-radius: 6px;
  break-inside: avoid;
}

/* ---------- 6 · Call to action ---------- */
.case__cta {
  margin-top: clamp(64px, 10vw, 120px);
  padding: clamp(40px, 6vw, 72px) var(--pad);
  background: var(--bg-alt);
  border-radius: 10px;
  text-align: center;
}
.case__cta h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px); font-weight: 500;
  margin-bottom: 22px;
}

/* ---------- Case study responsive ---------- */
@media (max-width: 900px) {
  .case__gallery { column-count: 2; }
}
@media (max-width: 760px) {
  .case__process { grid-template-columns: repeat(2, 1fr); }
  .case__metrics { grid-template-columns: 1fr; }
  .case__gallery { column-count: 1; }
  /* Stack the Key-Decisions image instead of floating it on phones. */
  .case__decisions-img {
    float: none;
    width: 100%;
    margin: 0 0 24px;
  }
}

/* ---------- Image lightbox (click any case image to view full size) ---------- */
.case__cover,
.case__step-img,
.case__decisions-img,
.case__outcome-img,
.case__gallery-img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 64px);
  background: rgba(20, 20, 22, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility 0s linear .28s;
  cursor: zoom-out;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  transform: scale(.96);
  transition: transform .28s ease;
  cursor: default;
}
.lightbox.is-open .lightbox__img {
  transform: scale(1);
}

.lightbox__close {
  position: absolute;
  top: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background .2s ease;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox__close svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox.is-open,
  .lightbox__img,
  .lightbox.is-open .lightbox__img {
    transition: none;
  }
}

/* ============================================================
   TOOLS & GAMES  (hidden page — tools.html, built from
   data/tools.json by js/tools.js). Max 3 per row, 1 on phones.
============================================================ */
.tools {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) var(--pad) clamp(64px, 9vw, 110px);
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.tools-empty { color: var(--ink-faint); font-size: 16px; }

/* the card itself — quiet, bordered, lifts gently on hover (like writing cards) */
.tool-card {
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
a.tool-card { cursor: pointer; color: inherit; }
a.tool-card:hover,
a.tool-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  border-color: var(--ink-faint);
}
a.tool-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-card--soon { opacity: .92; }

/* image area */
.tool-card__media {
  position: relative;
  width: 100%; aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.tool-card__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s ease;
}
a.tool-card:hover .tool-card__img { transform: scale(1.03); }
/* fallback shown when no image is set / it fails to load */
.tool-card__placeholder {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 500; color: var(--ink-faint);
  padding: 0 18px; text-align: center;
}

/* body */
.tool-card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; }
.tool-card__meta { display: flex; align-items: center; gap: 10px; }
.tool-card__type {
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 20px;
}
.tool-card__soon {
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  color: var(--ink-faint);
  background: var(--bg-alt);
  padding: 4px 11px; border-radius: 20px;
}
.tool-card__title { font-size: 19px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.tool-card__desc { color: var(--ink-soft); font-size: 15px; }
.tool-card__sub { color: var(--ink-faint); font-size: 13px; margin-top: 2px; }

/* responsive: 3 per row → 1 on small screens */
@media (max-width: 760px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ARTICLES  (writing/<slug>.html, built from data/articles.js by
   build/generate-articles.js). A streamlined, magazine-style read:
   intro → TL;DR → cover → body → FAQ. Shares the .case chrome
   (back-link, CTA) and the global type tokens.
============================================================ */

/* The article column is narrower than a case study for comfortable
   line length on long-form text. */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) var(--pad) clamp(72px, 9vw, 120px);
}

/* ---------- Head: title + meta line ---------- */
.article__head { margin-bottom: clamp(28px, 4vw, 40px); }
.article__title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.5vw, 56px);
  font-weight: 500; letter-spacing: -.01em;
  line-height: 1.1;
}
.article__meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  font-size: 14px; color: var(--ink-faint);
}
.article__meta time { color: var(--ink-faint); }
.article__readtime {
  position: relative;
  padding-left: 14px;
}
.article__readtime::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--ink-faint); transform: translateY(-50%);
}

/* ---------- Intro (before the TL;DR) ---------- */
.article__intro p {
  font-size: clamp(18px, 2.2vw, 21px);
  color: var(--ink); line-height: 1.6;
  margin-bottom: 18px;
}
.article__intro p:last-child { margin-bottom: 0; }

/* ---------- TL;DR callout ---------- */
.article__tldr {
  margin: clamp(28px, 4vw, 40px) 0;
  padding: clamp(22px, 3vw, 30px) clamp(22px, 3.5vw, 34px);
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.article__tldr-label {
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.article__tldr p:not(.article__tldr-label) {
  font-size: 16px; color: var(--ink-soft); line-height: 1.6;
}

/* ---------- Cover image (right after the TL;DR) ---------- */
.article__cover-wrap { margin: clamp(28px, 4vw, 44px) 0; }
.article__cover {
  display: block; width: 100%; height: auto;
  border-radius: 8px; background: var(--bg-alt);
  cursor: zoom-in;
}

/* ---------- Body prose ---------- */
.article__body { font-size: 17px; }
.article__body > p {
  color: var(--ink); line-height: 1.7;
  margin-bottom: 22px; max-width: 68ch;
}
.article__h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 500; letter-spacing: -.01em;
  margin: clamp(40px, 6vw, 64px) 0 18px;
}
.article__h3 {
  font-size: clamp(18px, 2.2vw, 21px);
  font-weight: 600; color: var(--ink);
  margin: clamp(28px, 4vw, 38px) 0 12px;
}

/* lists */
.article__list {
  margin: 0 0 22px; padding-left: 1.3em;
  color: var(--ink); line-height: 1.7; max-width: 68ch;
}
.article__list li { margin-bottom: 10px; }

/* inline code + bold */
.article__body code,
.article__faq code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--bg-alt);
  padding: 2px 6px; border-radius: 4px;
  color: var(--panel-ink);
}
.article__body strong { font-weight: 600; color: var(--ink); }

/* body images + figures */
.article__img {
  display: block; width: 100%; height: auto;
  border-radius: 8px; background: var(--bg-alt);
  margin: clamp(28px, 4vw, 40px) 0;
  cursor: zoom-in;
}
.article__figure { margin: clamp(28px, 4vw, 40px) 0; }
.article__figure .article__img { margin: 0; }
.article__caption {
  margin-top: 10px; font-size: 14px;
  color: var(--ink-faint); text-align: center; line-height: 1.5;
}

/* placeholder shown until the real image file is dropped in writing/<slug>/ */
.article__img--placeholder {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 9; cursor: default;
  border: 1px dashed var(--line);
  color: var(--ink-faint); font-size: 14px; text-align: center; padding: 20px;
}

/* code blocks (optional — not every article has them) */
.article__code {
  position: relative;
  margin: clamp(24px, 3.5vw, 36px) 0;
  padding: clamp(18px, 2.4vw, 24px);
  background: #1d1d1f;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13.5px; line-height: 1.6;
}
.article__code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #e8e8ea; background: none; padding: 0; white-space: pre;
}
.article__code[data-lang]::before {
  content: attr(data-lang);
  position: absolute; top: 10px; right: 14px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: #86868b;
}

/* ---------- FAQ ---------- */
.article__faq { margin-top: clamp(48px, 7vw, 72px); }
.article__faq-item {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.article__faq-item:last-child { border-bottom: 1px solid var(--line); }
.article__faq-q {
  font-size: 18px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
.article__faq-a { font-size: 16px; color: var(--ink-soft); line-height: 1.65; }

/* ---------- References ---------- */
.article__refs {
  margin-top: clamp(40px, 6vw, 56px);
  padding-top: 24px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--ink-faint);
}
.article__refs a { color: var(--accent); }
.article__refs a:hover { text-decoration: underline; }

/* article CTA sits within the narrower column */
.article .case__cta { margin-top: clamp(56px, 8vw, 96px); }

@media (max-width: 760px) {
  .article__code { font-size: 12.5px; }
}
