:root {
  --bg: #f2ece1;
  --bg-soft: #ece5d7;
  --bar: #e3d5bc;
  --panel: #f9f5ed;
  --line: rgba(43, 36, 26, 0.16);
  --line-soft: rgba(43, 36, 26, 0.09);
  --ink: #221f1a;
  --ink-dim: #5f584d;
  --ink-faint: #928a7b;
  --accent: #b4552a;
  --radius: 14px;
  --display: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(1.15rem, 4vw, 2.75rem);
}

/* ---------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  /* A deeper sand than the page, so the bar reads as its own surface
     instead of blending into the background as it scrolls. */
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  text-decoration: none;
  white-space: nowrap;
}
.brand b { color: var(--ink); font-weight: 500; }
.topnav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
  font-size: 0.85rem;
}
.topnav a {
  color: var(--ink-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 140ms ease;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--ink); }
@media (max-width: 660px) {
  .topnav .only-wide { display: none; }
}
@media (max-width: 520px) {
  /* Keep brand + three project links on one line without clipping. */
  .brand { font-size: 0.72rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topnav { gap: 0.7rem; font-size: 0.78rem; }
}

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

/* Block-direction only: the padding shorthand would reset .wrap's
   horizontal padding and push the hero flush to the screen edge. */
.hero {
  padding-top: clamp(2.75rem, 9vw, 8rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.5rem;
}
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.3rem, 7.2vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 1.5rem;
  /* min() so the ch-based measure can never exceed the column and
     overflow into the clipped edge on a narrow screen. */
  max-width: min(22ch, 100%);
}
h1 em {
  font-style: normal;
  color: var(--accent);
}
.lede {
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
  color: var(--ink-dim);
  max-width: 62ch;
  margin: 0 0 2.5rem;
}
.lede strong { color: var(--ink); font-weight: 500; }

/* --------------------------------------------------- table of contents */

.toc {
  margin: clamp(1.75rem, 4vw, 2.5rem) 0 0;
  max-width: 44rem;
  border-top: 1px solid var(--line);
}
.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.8rem 0.35rem;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
  transition: background 130ms ease, padding-left 130ms ease;
}
.toc a:hover, .toc a:focus-visible { background: var(--bg-soft); padding-left: 0.7rem; }
.toc .num {
  flex: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
}
.toc .name {
  flex: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.012em;
}
/* Kept off narrow screens so every row stays one line and the intro
   still fits a phone viewport. */
.toc .what {
  display: none;
  color: var(--ink-faint);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc .arrow { margin-left: auto; flex: none; color: var(--ink-faint); }
.toc a:hover .arrow { color: var(--accent); }
@media (min-width: 560px) {
  .toc .what { display: block; flex: 1 1 auto; }
}

/* -------------------------------------------------------- mock note */

.note {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 4px var(--radius) var(--radius) 4px;
  background: var(--bg-soft);
  font-size: 0.92rem;
  color: var(--ink-dim);
  max-width: 78ch;
}
.note p { margin: 0; }
.note strong { color: var(--ink); font-weight: 500; }

/* ---------------------------------------------------------- project */

.project {
  padding: clamp(3.5rem, 9vw, 7rem) 0;
  border-top: 1px solid var(--line-soft);
}
.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 20.5rem) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 4rem);
  align-items: start;
}
@media (max-width: 940px) {
  .project-grid { grid-template-columns: minmax(0, 1fr); }
}

.col-info { position: sticky; top: 92px; }
@media (max-width: 940px) {
  .col-info { position: static; }
}

.index {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1.1rem;
}
.index::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.index b { color: var(--accent); font-weight: 500; }

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.85rem, 4.2vw, 2.6rem);
  line-height: 1.06;
  letter-spacing: -0.022em;
  margin: 0 0 0.4rem;
}
.sector {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}
.col-info p.body { color: var(--ink-dim); font-size: 0.96rem; margin: 0 0 1rem; }
.col-info p.body strong { color: var(--ink); font-weight: 500; }

.links {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
}
.links li { border-bottom: 1px solid var(--line-soft); }
.links a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  transition: color 140ms ease;
}
.links a:hover, .links a:focus-visible { color: var(--accent); }
.links .role {
  color: var(--ink-faint);
  font-family: var(--text);
  font-size: 0.78rem;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
}

/* ---------------------------------------------------------- gallery */

.shots { display: grid; gap: clamp(0.9rem, 2vw, 1.35rem); }
.shots.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: clamp(0.9rem, 2vw, 1.35rem);
  /* Don't let a taller shot stretch its neighbour to match. */
  align-items: start;
}
@media (max-width: 620px) {
  .shots.two { grid-template-columns: minmax(0, 1fr); }
}

figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease;
}
figure:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.shot-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}
.shot-btn img {
  display: block;
  width: 100%;
  height: auto;
  background: #e6dece;
}
figure.tall .shot-btn img {
  max-height: 620px;
  width: auto;
  margin: 0 auto;
}

figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.7rem;
  padding: 0.75rem 0.95rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.85rem;
  color: var(--ink-dim);
  line-height: 1.45;
}
.tag {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid;
}
.tag.mock {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}
.tag.live {
  color: #2c6d49;
  border-color: rgba(44, 109, 73, 0.4);
  background: rgba(44, 109, 73, 0.09);
}

/* --------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2.5rem);
  background: rgba(233, 226, 213, 0.96);
  backdrop-filter: blur(6px);
}
.lightbox[open] { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 8.5rem);
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.lb-inner { text-align: center; max-width: 100%; }
.lb-cap {
  margin: 0.9rem auto 0;
  font-size: 0.9rem;
  color: var(--ink-dim);
  max-width: 70ch;
}
.lb-count { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); }
.lb-btn {
  position: absolute;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 140ms ease;
}
.lb-btn:hover { background: #fffdf8; border-color: var(--accent); }
.lb-close { top: clamp(0.75rem, 3vw, 1.6rem); right: clamp(0.75rem, 3vw, 1.6rem); }
.lb-prev { left: clamp(0.4rem, 2vw, 1.6rem); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(0.4rem, 2vw, 1.6rem); top: 50%; transform: translateY(-50%); }

/* ----------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line-soft);
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(3rem, 7vw, 5rem);
  color: var(--ink-faint);
  font-size: 0.88rem;
}
footer a { color: var(--ink-dim); text-decoration: none; }
footer a:hover { color: var(--accent); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------- phone screenshot gallery */

/* Portrait app screenshots: several across, capped height, so a 1080×2400
   frame doesn't dominate the page the way a landscape shot would. */
.shots.phones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(0.9rem, 2vw, 1.35rem);
  align-items: start;
}
.shots.phones figure { background: transparent; border-radius: 10px; }
.shots.phones .shot-btn img {
  max-height: 560px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 9px 9px 0 0;
}
.shots.phones figcaption {
  font-size: 0.8rem;
  padding: 0.6rem 0.7rem;
  gap: 0.4rem 0.5rem;
}

/* Tablet screenshots sit between the phone and desktop cases: portrait, but
   wide enough that the phone grid's narrow columns would shrink them too far. */
.shots.tablets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(0.9rem, 2vw, 1.35rem);
  align-items: start;
}
.shots.tablets figure { background: transparent; }
.shots.tablets .shot-btn img {
  max-height: 520px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
.shots.tablets figcaption { font-size: 0.8rem; padding: 0.6rem 0.7rem; }
