/* Shared styles for every page: the "design file" look — paper, ink and one
   process-magenta accent. Colours are tokens on :root. The home page and the
   case studies add css/portfolio.css on top. */

:root {
  color-scheme: light;
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-2: #ECE9E2;
  --line: #DAD6CC;
  --line-strong: #BDB8AC;
  --text: #2B2A27;
  --strong: #141414;
  --muted: #5C5A55;
  --accent: #D6006F;
  --accent-hover: #A80057;
  --accent-soft: #FBE6F0;
  --on-accent: #FFFFFF;
  --select: #1F6FEB;
  --ok: #16A34A;
  --error: #DC2626;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 10px 26px -14px rgba(20, 20, 20, .16);
  --shadow-hover: 0 1px 2px rgba(20, 20, 20, .05), 0 18px 36px -16px rgba(20, 20, 20, .26);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Syne', 'Inter', system-ui, sans-serif;
  --radius: 14px;
  --wrap: 1200px;
}

/* ----- Base ----- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--strong); font-family: var(--display); line-height: 1.05; letter-spacing: -.03em; }
h1 { font-size: clamp(2.2rem, 6.5vw, 4.6rem); font-weight: 800; letter-spacing: -.045em; }
h1, h2 { overflow-wrap: break-word; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
strong { font-weight: 600; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
code, kbd, pre { font-family: var(--mono); }
ul { margin: 0; padding: 0; }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--on-accent); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* ----- Header ----- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { margin-right: auto; display: inline-flex; align-items: center; gap: 10px; color: var(--strong); font: 700 1.2rem var(--display); letter-spacing: -.02em; }
.brand:hover { color: var(--strong); }
.brand img { width: 30px; height: 30px; }
.nav-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--strong); color: var(--bg); font-weight: 600; font-size: .95rem; }
.nav-cta:hover { color: var(--bg); background: var(--accent); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: .95rem; font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--strong); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--strong); background: var(--surface-2); }

/* A ruler along the top of every page, like a design app */
.ruler {
  height: 22px; padding-left: 4px; display: flex; overflow: hidden;
  border-bottom: 1px solid var(--line); background:
    repeating-linear-gradient(90deg, #BDB8AC 0 1px, transparent 1px 10px) bottom / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, #8F8A7E 0 1px, transparent 1px 100px) bottom / 100% 12px no-repeat;
  font: 500 10px var(--mono); color: #6B675E;
}
.ruler span { flex: none; width: 100px; }

/* ----- Main & sections ----- */
main { flex: 1; }
.section { padding: 72px 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.section-head p { color: var(--muted); }
.eyebrow {
  display: block; margin-bottom: 14px;
  color: var(--accent); font: 500 .8rem var(--mono); letter-spacing: .04em; text-transform: uppercase;
}
.page-head { padding: 72px 0 40px; max-width: 720px; }
.page-head h1 { margin-bottom: 16px; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 640px; }
.muted { color: var(--muted); }
.more { font-weight: 500; white-space: nowrap; }
.more::after { content: ' →'; }

/* ----- Buttons ----- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; font: 600 .95rem var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn-primary { background: var(--strong); color: var(--bg); }
.btn-primary:hover { color: var(--bg); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { color: var(--on-accent); background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { border: 1.5px solid var(--strong); color: var(--strong); }
.btn-outline:hover { color: var(--strong); background: var(--surface); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--strong); }
.btn-ghost:hover { color: var(--strong); border-color: var(--line-strong); }

/* ----- Cards ----- */
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
a.card { transition: transform .2s, box-shadow .2s, border-color .2s; }
a.card:hover { color: var(--text); transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
a.card:hover .more { color: var(--accent-hover); }
.card .more { margin-top: auto; padding-top: 6px; color: var(--accent); }
.card p { color: var(--muted); font-size: .97rem; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: .8rem; font-weight: 500; line-height: 1.6;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label { color: var(--muted); font-size: .8rem; font-weight: 500; }

/* ----- Call to action band ----- */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 48px; border-radius: 24px; background: var(--strong); color: var(--bg);
}
.cta h2 { color: var(--bg); }
.cta p { color: color-mix(in srgb, var(--bg) 70%, var(--strong)); margin-top: 8px; }
.cta .btn { background: var(--bg); color: var(--strong); }
.cta .btn:hover { color: var(--strong); transform: translateY(-1px); }

/* ----- About ----- */
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.prose p + p { margin-top: 16px; }
.prose p { font-size: 1.05rem; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
.compare > div { padding: 24px; }
.compare > div + div { border-left: 1px solid var(--line); background: var(--accent-soft); }
.compare h3 { margin-bottom: 12px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.compare ul { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: .95rem; }
.compare > div + div h3 { color: var(--accent); }
.compare > div + div li { color: var(--strong); }

.timeline { list-style: none; position: relative; display: flex; flex-direction: column; }
.timeline li { position: relative; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; padding: 0 0 28px; }
.timeline li::before {
  content: ''; position: absolute; left: 131px; top: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline li::after { content: ''; position: absolute; left: 135px; top: 22px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { color: var(--muted); font-size: .9rem; font-weight: 500; padding-top: 1px; }
.timeline div { padding-left: 24px; }
.timeline p { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.timeline strong { color: var(--strong); font-weight: 600; }

.skill h3 { margin-bottom: 6px; }

/* ----- Career ----- */
.job { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 32px 0; border-top: 1px solid var(--line); }
.job:last-child { border-bottom: 1px solid var(--line); }
.job-meta { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .92rem; }
.job-meta strong { color: var(--strong); font-weight: 600; }
.job h2 { font-size: 1.35rem; margin-bottom: 4px; }
.job .org { color: var(--muted); margin-bottom: 16px; }
.job p { margin-bottom: 16px; }
.checklist { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font-size: .97rem; }
.checklist li { position: relative; padding-left: 22px; }
.checklist li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }

/* ----- Projects ----- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 500 .9rem var(--sans); cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.filter:hover { border-color: var(--line-strong); }
.filter[aria-pressed="true"] { background: var(--strong); border-color: var(--strong); color: var(--bg); }
.filter-status { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.filter-status:empty { display: none; }
.project h3 { font-size: 1.2rem; }
.project.featured { grid-column: span 2; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 60%); }
.project .tags { margin-top: 4px; }

/* ----- Case study ----- */
.back { display: inline-block; margin-top: 40px; color: var(--muted); font-weight: 500; }
.back:hover { color: var(--strong); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0 0 48px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { padding: 20px 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 4px 0 0; color: var(--strong); font-weight: 600; }
.features { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.features li { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.features strong { display: block; color: var(--strong); font-weight: 600; margin-bottom: 2px; }
.features span { color: var(--muted); font-size: .95rem; }
.note { padding: 20px 24px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }

/* ----- Tools ----- */
.preview {
  margin: 4px 0 6px; padding: 16px; border-radius: 10px;
  background: #111317; color: #D7DDE3; font-size: .8rem; line-height: 1.6;
  overflow-x: auto; white-space: pre;
}
.preview .p { color: #4ADE80; }
.preview .w { color: #7DB7FF; }
.preview .n { color: #7DB7FF; }
.preview .h { color: #FBBF24; }

/* ----- Learning ----- */
.thm-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.thm-head h2 { font-size: 1.5rem; }
.badge-top { padding: 6px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.mini-stats { display: flex; gap: 40px; margin: 12px 0 8px; }
.mini-stats dt { color: var(--muted); font-size: .85rem; }
.mini-stats dd { margin: 0; color: var(--strong); font-size: 2rem; font-weight: 700; letter-spacing: -.03em; }
.tag-rare { background: color-mix(in srgb, #A855F7 14%, transparent); color: #7E22CE; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ----- Contact ----- */
.channel { gap: 4px; }
.channel .label { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; }
.channel strong { color: var(--strong); font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.copy-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 24px; }

/* ----- 404 ----- */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 120px 0; }
.notfound .code { font-family: var(--display); font-size: clamp(5rem, 18vw, 9rem); font-weight: 800; letter-spacing: -.06em; line-height: 1; color: var(--strong); }

/* ----- Footer ----- */
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 28px 24px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--strong); }

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .nav-cta { display: none; }
  .nav { flex-wrap: wrap; gap: 8px 16px; padding: 12px 0 0; }
  .nav-links { order: 3; width: calc(100% + 48px); margin: 0 -24px; padding: 0 20px 10px; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { white-space: nowrap; }
  .split, .job { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .nav-links { width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px 10px; }
  .section { padding: 48px 0; }
  .page-head { padding: 48px 0 28px; }
  .grid-2, .grid-3, .grid-4, .checklist, .features, .compare { grid-template-columns: minmax(0, 1fr); }
  .compare > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .project.featured { grid-column: auto; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts div + div { padding-top: 0; }
  .section-head { flex-direction: column; align-items: start; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 0; padding-left: 28px; }
  .timeline li::before { left: 0; }
  .timeline li::after { left: 4px; }
  .timeline div { padding-left: 0; }
  .cta { padding: 32px 24px; }
  .footer-inner { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ----- Spacing helpers (no inline styles: the CSP forbids them) ----- */
.mb { margin-bottom: 24px; }
.mt { margin-top: 24px; }

/* Tool pages */
.tool-main .back-link { display: inline-block; margin-top: 40px; color: var(--muted); font-weight: 500; }
.tool-main .back-link:hover { color: var(--strong); }
.tool-main .eyebrow { margin-top: 24px; font-family: var(--sans); font-weight: 600; letter-spacing: .08em; }
.tool-main h1 { color: var(--strong); letter-spacing: -.035em; }
.tool-main h2 { color: var(--strong); }
@media (max-width: 640px) { .tool-main { padding-left: 16px; padding-right: 16px; } }
.tool-main .card { display: block; box-shadow: none; }

/* Design projects on the projects page lead with their artwork */
.project-design img { width: 100%; height: 220px; object-fit: contain; margin-bottom: 6px; border-radius: 10px; background: var(--surface-2); }
