/* ===== Case study styles — shares tokens and layout with ../index.html ===== */
:root {
  --ink: #1f1f1f;
  --body: #333;
  --muted: #767676;
  --line: #ececec;
  --accent: #0b3d91;
  --accent-soft: #9cc0ff;
  --bg: #fff;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.65 ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ===== Layout ===== */
.page {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 80px;
  align-items: start;
  max-width: 1060px;
  margin: 0 auto;
  padding: 72px 32px 40px;
}
main { min-width: 0; max-width: 680px; }
section { margin-top: 48px; scroll-margin-top: 72px; }

/* ===== Sidebar ===== */
.side { position: sticky; top: 72px; }
.side .name { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.side .name a { color: inherit; text-decoration: none; }
.side .muted { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.back { display: inline-block; margin-top: 22px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
nav { display: flex; flex-direction: column; margin-top: 18px; font-size: 16px; line-height: 2; }
nav a, .contact a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a.active, .contact a:hover { color: var(--accent); }
nav a.active { font-weight: 500; }
.contact { list-style: none; margin: 28px 0 0; padding: 0; font-size: 14px; line-height: 1.9; }

/* ===== Header ===== */
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  border-radius: 4px;
  background: #e8e8ed;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.chip .ico { width: 13px; height: 13px; border-radius: 3px; object-fit: contain; background: #fff; }
.ico.mono {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 7.5px;
  font-weight: 700;
}
h1 { margin: 14px 0 0; font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.summary { margin: 16px 0 0; font-size: 19px; line-height: 1.6; color: var(--body); }

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 32px 0 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 500; line-height: 1.4; }

/* ===== Sections ===== */
h2 { margin: 0; padding-bottom: 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
section > p { margin: 8px 0 0; color: var(--body); }
section > p + p { margin-top: 12px; }

.rows { margin-top: 18px; border-top: 1px solid var(--line); }
.row {
  display: grid;
  grid-template-columns: 28px 170px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.row .n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row b { font-weight: 500; }
.row span:last-child { color: var(--body); font-size: 15px; line-height: 1.55; }


/* ===== Prev / next ===== */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; border-top: 1px solid var(--line); padding-top: 14px; }
.pager a { color: var(--ink); text-decoration: none; font-weight: 500; }
.pager a:hover { color: var(--accent); }
.pager small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.pager .next { text-align: right; }

/* ===== Footer watermark ===== */
footer {
  position: relative;
  overflow: hidden;
  max-width: 1060px;
  height: 200px;
  margin: 40px auto 0;
  padding: 0 32px 24px;
}
.watermark {
  position: absolute;
  left: 12px;
  bottom: -70px;
  font-size: min(150px, 13.5vw);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  opacity: 0.06;
  white-space: nowrap;
  user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, transparent 95%);
          mask-image: linear-gradient(to bottom, #000 20%, transparent 95%);
}

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .page { grid-template-columns: 1fr; gap: 0; padding: 40px 20px 24px; }
  /* Stacked view: sidebar items flow into the page so the contact links can sit at the bottom */
  .side { display: contents; }
  main { order: 1; margin-top: 32px; }
  .contact { order: 2; display: flex; flex-wrap: wrap; column-gap: 18px; margin: 48px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
  nav { flex-direction: row; flex-wrap: wrap; column-gap: 18px; }
  h1 { font-size: 32px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 28px 1fr; gap: 2px 10px; }
  .row span:last-child { grid-column: 2; }
  footer { height: 140px; padding: 0 20px 20px; }
  .watermark { bottom: -20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== All-projects list ===== */
.list b a { color: inherit; text-decoration: none; }
.list b a:hover { color: var(--accent); }
.list b small { display: block; font-weight: 400; font-size: 14px; line-height: 1.4; color: var(--muted); }
