/* ---------- Colour tokens ---------- */
:root {
  --bg: #F4F6F7;
  --surface: #FFFFFF;
  --tint: #E9EFF0;
  --ink: #1E2B32;
  --muted: #56666F;
  --line: #D5DEE1;
  --accent: #2B6A6E;        /* deep teal */
  --accent-ink: #FFFFFF;
  --accent-soft: #D7E8E6;
  --ring: #9CC5C1;
  --shadow: 0 1px 2px rgba(30, 43, 50, .06), 0 8px 24px rgba(30, 43, 50, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141C21; --surface: #1B262C; --tint: #182228; --ink: #E3EAEC; --muted: #9AABB2;
    --line: #2B3A42; --accent: #8CC7C1; --accent-ink: #10201F; --accent-soft: #223A3B;
    --ring: #3E6A69; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141C21; --surface: #1B262C; --tint: #182228; --ink: #E3EAEC; --muted: #9AABB2;
  --line: #2B3A42; --accent: #8CC7C1; --accent-ink: #10201F; --accent-soft: #223A3B;
  --ring: #3E6A69; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-behavior: smooth; scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2 {
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
img, svg { max-width: 100%; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

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

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.nav-list { display: flex; gap: 1.75rem; list-style: none; margin: 0 0 0 auto; padding: 0; }
nav { margin-left: auto; }
.nav-list a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav-list a:hover { color: var(--ink); }
.icon-link {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--muted);
}
.icon-link svg { width: 17px; height: 17px; }
.icon-link:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 3rem; align-items: center; }
.hero-role { color: var(--accent); font-weight: 500; margin-bottom: 1.25rem; }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); max-width: 18ch; text-wrap: balance; }
.hero-lede { color: var(--muted); font-size: 1.15rem; max-width: 46ch; margin: 1.5rem 0 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.hero-figure { margin: 0; text-align: center; }
.rings { overflow: visible; }
.ring { fill: none; stroke: var(--ring); stroke-width: 1.5; }
.r1 { stroke-dasharray: 3 7; }
.r2 { opacity: .8; }
.core { fill: var(--accent); }
.nodes circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.nodes { transform-origin: 160px 160px; animation: orbit 60s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.portrait-wrap { position: relative; width: min(360px, 100%); aspect-ratio: 1; margin-inline: auto; }
.portrait-wrap .rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait {
  position: absolute; inset: 13%; width: 74%; height: 74%;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 12px 40px rgba(30, 43, 50, .18);
}
.about-side { display: flex; flex-direction: column; gap: 1.5rem; }
.about-photo { width: 100%; height: auto; border-radius: 14px; display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; padding: .8rem 1.3rem;
  border-radius: 10px; font-weight: 500; text-decoration: none; font-size: 1rem;
  border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.btn-quiet { color: var(--ink); border-color: var(--line); background: var(--surface); }
.btn-quiet:hover { border-color: var(--accent); }
.btn-large { padding: 1rem 1.6rem; font-size: 1.05rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-tint { background: var(--tint); border-block: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 3rem; margin-bottom: 2.5rem; }
.section-head p { color: var(--muted); margin: 0; max-width: 44ch; }

.about-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 2rem 4rem; }
.prose { max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Cards (flip) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.card { perspective: 1400px; }
.card-inner {
  display: grid; height: 100%;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.card.is-flipped .card-inner { transform: rotateY(180deg); }

/* Both faces share one grid cell, so the card is as tall as its longer side */
.card-face {
  grid-area: 1 / 1;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem;
  min-height: 200px;
}
.card-front {
  all: unset; grid-area: 1 / 1; box-sizing: border-box; cursor: pointer;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.4rem; min-height: 200px;
  display: flex; flex-direction: column; gap: .4rem;
  transition: border-color .2s;
}
.card-front:hover { border-color: var(--accent); }
.card-front:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-back {
  transform: rotateY(180deg);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}

.card-title { font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: 1.35rem; line-height: 1.25; }
.card-line { margin-top: .35rem; }
.card-line { color: var(--muted); font-size: .98rem; }
.card-sector { color: var(--accent); font-size: .9rem; font-weight: 500; }
.card-hint {
  margin-top: auto; padding-top: 1rem;
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--accent); font-size: .9rem; font-weight: 500;
}
.card-hint::before {
  content: ""; width: 16px; height: 16px; flex: none;
  border: 1.5px solid currentColor; border-radius: 50%;
  background: radial-gradient(circle, currentColor 2.5px, transparent 3px);
}

.card-back p { margin-bottom: 1rem; }
.card-return {
  margin-top: auto; align-self: flex-start;
  font: inherit; font-size: .9rem; font-weight: 500; color: var(--accent);
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .8rem; cursor: pointer; margin-top: 1rem;
}
.card-back > .card-return { margin-top: auto; }
.card-back > :nth-last-child(2) { margin-bottom: 1rem; }
.card-return:hover { border-color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.tags li { background: var(--accent-soft); color: var(--ink); font-size: .85rem; padding: .25rem .65rem; border-radius: 999px; }

.cards-work { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }


.case { margin: 0; display: grid; gap: .8rem; }
.case dt { font-weight: 600; font-size: .9rem; color: var(--accent); }
.case dd { margin: .15rem 0 0; }

/* ---------- Credentials ---------- */
.creds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem 2rem; }
.creds li { border-left: 3px solid var(--accent); padding-left: 1rem; display: grid; gap: .15rem; }
.creds span { color: var(--muted); font-size: .95rem; }
.creds a { font-size: .95rem; }

.creds-groups { display: grid; gap: 2.5rem; }
.creds-heading { font-size: 1rem; font-weight: 600; color: var(--muted); margin: 0 0 1rem; }
.creds-verify { margin: 0; font-weight: 500; }
.creds-progress li { border-left-style: dashed; border-left-color: var(--ring); }

/* ---------- CV download ---------- */
.cv-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem 3rem; }
.cv-text { max-width: 52ch; }
.cv-text h2 { margin-bottom: .75rem; }
.cv-text p { color: var(--muted); margin: 0; }
.btn-icon.cv-btn svg { color: var(--accent-ink); width: 20px; height: 20px; }
.contact { border-top: 1px solid var(--line); }

/* ---------- Contact ---------- */
.contact-inner { text-align: center; max-width: 640px; }
.contact h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 1rem; }
.contact p { color: var(--muted); margin-bottom: 2rem; }
.contact .btn { max-width: 100%; overflow-wrap: anywhere; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.btn-icon { gap: .6rem; }
.btn-icon svg { width: 18px; height: 18px; color: var(--accent); }
.header-inner { gap: 1rem; }
nav { margin-right: .5rem; }

/* ---------- Blog ---------- */
.nav-list a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.blog-head { padding: clamp(3rem, 7vw, 5rem) 0 clamp(3.5rem, 8vw, 6rem); }
.blog-head h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); }
.blog-intro { color: var(--muted); font-size: 1.15rem; max-width: 52ch; margin: .9rem 0 0; }
.post-list { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 2rem; }
.section-head + .post-list { margin-top: 0; }
.post { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 2rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; }
.post-thumb { display: block; border-radius: 12px; overflow: hidden; }
.post-thumb-art { display: block; width: 100%; height: auto; }
.post-text p { color: var(--muted); max-width: 60ch; }
.post-title { font-family: "Newsreader", Georgia, serif; font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin: .35rem 0 .6rem; }
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-link { font-weight: 500; }
.post-meta, .article-meta { display: flex; gap: 1.25rem; color: var(--muted); font-size: .92rem; margin: 0; }

/* Illustration (shared by article hero and thumbnails) */
.hero-bg { fill: var(--tint); }
.hero-ring { fill: none; stroke: var(--ring); stroke-width: 1.5; }
.hero-r1 { stroke-dasharray: 3 7; }
.hero-core { fill: var(--accent); }
.hero-person { fill: var(--accent-ink); }
.hero-apps rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.hero-links line { stroke: var(--ring); stroke-width: 1.5; stroke-dasharray: 4 5; }
.hero-nodes circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.hero-lock rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }

/* Article */
.article { max-width: 760px; margin-inline: auto; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(3rem, 8vw, 6rem); }
.article-kicker { margin: 0 0 1rem; font-weight: 500; }
.article-kicker a { text-decoration: none; }
.article h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); text-wrap: balance; }
.article-lede { font-size: 1.2rem; color: var(--muted); margin: 1.25rem 0 1rem; text-wrap: pretty; }
.article-hero { margin: 2.25rem 0 0; }
.article-hero-art { display: block; width: 100%; height: auto; }
.toc { margin: 2.25rem 0 1rem; padding: 1.4rem 1.6rem; background: var(--tint); border: 1px solid var(--line); border-radius: 14px; }
.toc-title { font-weight: 600; margin: 0 0 .6rem; }
.toc ol { margin: 0; padding-left: 1.4rem; display: grid; gap: .35rem; }
.article-body { max-width: none; counter-reset: faq; }
.faq-item { padding-top: 2.5rem; margin-top: 2.5rem; border-top: 1px solid var(--line); }
.faq-item h2 { display: flex; gap: .9rem; align-items: baseline; font-size: 1.7rem; margin: 0 0 1rem; text-wrap: balance; scroll-margin-top: 90px; }
.faq-item h2::before {
  counter-increment: faq; content: counter(faq);
  flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: .95rem; font-weight: 600; transform: translateY(-3px);
}
.faq-item p { line-height: 1.72; text-wrap: pretty; max-width: 68ch; }
.short-answer { background: var(--accent-soft); border-radius: 12px; padding: 1rem 1.2rem; font-size: 1.08rem; line-height: 1.55 !important; }
.short-answer span { display: block; font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: .25rem; }

/* Diagrams */
.diagram { margin: 1.75rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.dg { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: .9rem; color: var(--muted); font-size: .93rem; text-align: center; }
.dg text { font-family: "IBM Plex Sans", system-ui, sans-serif; }
.dg-label { fill: var(--ink); font-size: 15px; font-weight: 600; }
.dg-sub { fill: var(--muted); font-size: 12.5px; }
.dg-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.dg-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.dg-weak { fill: var(--tint); stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dg-line { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.dg-arrowhead { fill: var(--muted); }
.dg-dot { fill: var(--accent); }
.dg-ok { fill: var(--accent); }
.dg-no { fill: var(--muted); }
.dg-mark { stroke: var(--accent-ink); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dg-no + .dg-mark { stroke: var(--surface); }
.dg-grad-a { stop-color: var(--line); }
.dg-grad-b { stop-color: var(--accent); }

/* Comparison table */
.table-wrap { overflow-x: auto; margin: 1.75rem 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.compare { width: 100%; border-collapse: collapse; font-size: .98rem; }
.compare caption { text-align: left; padding: 1rem 1.2rem .4rem; color: var(--muted); font-size: .93rem; }
.compare th, .compare td { padding: .75rem 1.2rem; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
.compare thead th { border-top: 0; color: var(--accent); font-weight: 600; }
.compare tbody th { font-weight: 600; white-space: nowrap; }

.article-cta { margin-top: 3.5rem; padding: 1.8rem; border: 1px solid var(--accent); border-radius: 14px; background: var(--surface); }
.article-cta h2 { margin-top: 0; font-size: 1.6rem; }
.article-cta p { margin-bottom: 1.2rem; }

@media (max-width: 720px) {
  .post { grid-template-columns: 1fr; gap: 1.25rem; }
  .faq-item h2 { font-size: 1.45rem; }
  .diagram { padding: .75rem; overflow-x: auto; }
  .dg { min-width: 560px; }
  .diagram figcaption { text-align: left; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }
.footer-inner p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
  .portrait-wrap { width: 240px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 420px; }
}
@media (max-width: 640px) {
  .nav-list { display: none; }
  .cards, .cards-work { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nodes { animation: none; }
  .card-inner { transition: none; }
}
