:root {
  --bg: #f7f6f2; --surface: #ffffff; --text: #1c2321; --muted: #58635e;
  --accent: #2c6a4d; --accent-soft: #e3efe8; --border: #dfddd6; --max: 1040px;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #131715; --surface: #1b211e; --text: #e7ebe9; --muted: #a0aba6;
    --accent: #7cc39e; --accent-soft: #1f3a2d; --border: #2c3430; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 720px) { .wrap { padding-left: 32px; padding-right: 32px; } }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.brand small { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a:focus-visible, .nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }

main.wrap { padding-top: 48px; padding-bottom: 64px; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; line-height: 1.25; margin: 56px 0 16px; }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 8px; }
p { margin: 0 0 14px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--accent); margin: 0 0 8px; }
.todo { background: #fff3c4; color: #5c4500; padding: 0 4px; border-radius: 3px; }
@media (prefers-color-scheme: dark) { .todo { background: #4a3c08; color: #ffe59a; } }

/* Home */
.hero { padding-bottom: 8px; }
.featured { display: grid; gap: 24px; }
.feature { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.feature img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.feature .body { padding: 20px 22px 22px; }
.feature .result { border-left: 3px solid var(--accent); padding-left: 12px; margin-top: 12px; }
@media (min-width: 820px) {
  .feature { grid-template-columns: 1.1fr 1fr; }
  .feature .body { padding: 28px; align-self: center; }
  .feature:nth-child(even) img { order: 2; }
}
.card-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.card .body { padding: 16px 18px 18px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card:hover, .feature:hover { border-color: var(--accent); }
.card p { font-size: .95rem; color: var(--muted); margin: 0; }
.note { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; }

/* Tags */
.tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }

/* Case study */
.back { display: inline-block; margin-bottom: 20px; font-size: .95rem; }
.case-study > section, .case-study > .lede, .case-study > p { max-width: 70ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 28px 0 8px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.facts div { min-width: 0; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-size: .95rem; }
figure { margin: 24px 0; }
figure img { border: 1px solid var(--border); border-radius: 6px; background: #fff; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: 8px; }
.fig-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.fig-grid figure { margin: 0; }
img.zoomable { cursor: zoom-in; }
img.zoomable:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.table-wrap { overflow-x: auto; margin: 16px 0 24px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); }

/* About */
.about-grid { display: grid; gap: 32px; }
@media (min-width: 820px) { .about-grid { grid-template-columns: 2fr 1fr; } }
.side h2 { margin-top: 0; font-size: 1.1rem; }
.side ul { padding-left: 1.1em; margin: 0 0 24px; }
.contact-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-top: 40px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 20px 0; }
.site-footer p { margin: 0; }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(0, 0, 0, .86); }
.lightbox img { max-height: 86vh; max-width: 96vw; width: auto; margin: 0 auto; border-radius: 4px; }
.lightbox-caption { color: #eee; text-align: center; margin: 10px 0 0; }
.lightbox-close { position: fixed; top: 10px; right: 14px; font-size: 2.2rem; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; padding: 4px 10px; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; overflow-x: auto; font-size: .85rem; line-height: 1.5; margin: 16px 0 20px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
figure video { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.contact-box h2 { margin-top: 0; }
