/* =========================================================
   DevTak — homepage styles
   Brand: Cobalt #3D6FE0 · Tangerine #E5672A · Ink #0A0A14
   ========================================================= */

/* ---------- Fonts (self-hosted Lexend, variable 300–700) ---------- */
@font-face {
  font-family: "Lexend"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/fonts/lexend-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lexend"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/fonts/lexend-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --cobalt: #3D6FE0;
  --tangerine: #E5672A;

  --bg: #FFFFFF;
  --bg-alt: #F6F8FC;
  --surface: #FFFFFF;
  --surface-2: #F1F4FA;
  --text: #0A0A14;
  --text-soft: #3A4058;
  --muted: #5B6178;
  --border: #E2E6EF;
  --border-strong: #CCD3E2;
  --primary: #3D6FE0;
  --primary-hover: #2F5DCB;
  --accent: #E5672A;
  --accent-text: #A84A12;
  --primary-text: #2F5FC4;
  --error: #B42318;
  --success: #15803D;
  --ring: rgba(61, 111, 224, .35);
  --shadow: 0 1px 2px rgba(10, 10, 20, .04), 0 12px 32px -12px rgba(10, 10, 20, .12);
  --shadow-lg: 0 2px 6px rgba(10, 10, 20, .05), 0 30px 60px -20px rgba(30, 50, 110, .25);
  --header-bg: rgba(255, 255, 255, .78);

  /* editor */
  --ed-bg: #FBFCFE;
  --ed-top: #F1F4FA;
  --ed-border: #DFE4EE;
  --ed-text: #1E2235;
  --ed-gutter: #A3AABF;
  --t-kw: #2A55C8;
  --t-type: #13806F;
  --t-fn: #8A5A00;
  --t-str: #B4481A;
  --t-num: #098658;
  --t-com: #7D849B;
  --t-punc: #4A5068;

  --radius: 16px;
  --radius-sm: 10px;
  --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0A0A14;
  --bg-alt: #0E0F1C;
  --surface: #11121F;
  --surface-2: #171930;
  --text: #ECEEF7;
  --text-soft: #C3C7DA;
  --muted: #9298B2;
  --border: #22253B;
  --border-strong: #2F3350;
  --primary: #3D6FE0;
  --primary-hover: #5683EB;
  --ring: rgba(86, 131, 235, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 30px 70px -20px rgba(0, 0, 0, .75);
  --header-bg: rgba(10, 10, 20, .72);

  --ed-bg: #0D0E1A;
  --ed-top: #131528;
  --ed-border: #24273F;
  --ed-text: #D8DCEB;
  --ed-gutter: #4A4F6B;
  --t-kw: #7EA2FF;
  --t-type: #4EC9B0;
  --t-fn: #E8D28A;
  --t-str: #F2A273;
  --t-num: #B5CEA8;
  --t-com: #646B88;
  --t-punc: #9AA0BC;
  color-scheme: dark;
  --accent-text: #F28C4C;
  --primary-text: #8FB0F5;
  --error: #FF8A7A;
  --success: #4ADE80;
}

/* No-JS fallback: follow the OS */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0A0A14; --bg-alt: #0E0F1C; --surface: #11121F; --surface-2: #171930;
    --text: #ECEEF7; --text-soft: #C3C7DA; --muted: #9298B2; --accent-text: #F28C4C; --primary-text: #8FB0F5; --error: #FF8A7A; --success: #4ADE80; --border: #22253B; --border-strong: #2F3350;
    --header-bg: rgba(10, 10, 20, .72);
    --ed-bg: #0D0E1A; --ed-top: #131528; --ed-border: #24273F; --ed-text: #D8DCEB; --ed-gutter: #4A4F6B;
    --t-kw: #7EA2FF; --t-type: #4EC9B0; --t-fn: #E8D28A; --t-str: #F2A273; --t-num: #B5CEA8; --t-com: #646B88; --t-punc: #9AA0BC;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.12; letter-spacing: -.02em; }
p { margin: 0; }
strong { font-weight: 500; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(61, 111, 224, .25); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.mono { font-family: var(--mono); }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .85em 1.4em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: .98rem; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 24px -10px rgba(61, 111, 224, .8); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 12px 30px -10px rgba(61, 111, 224, .9); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .65em 1.1em; font-size: .9rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--primary); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand svg { display: block; height: 36px; width: auto; }
.nav { display: flex; gap: 6px; margin-left: auto; }
.nav a {
  padding: 8px 14px; border-radius: 999px; font-weight: 400; font-size: .95rem; color: var(--text-soft);
  transition: color .2s, background-color .2s;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface-2); }
.nav-cta-mobile { display: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-moon { display: block; }
.theme-toggle svg { transition: transform .5s var(--ease); }
.theme-toggle:hover svg { transform: rotate(25deg); }

.menu-toggle { display: none; position: relative; }
.menu-toggle span {
  position: absolute; left: 12px; right: 12px; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.menu-toggle span:first-child { top: 16px; }
.menu-toggle span:last-child { top: 24px; }
.menu-toggle[aria-expanded="true"] span:first-child { top: 20px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { top: 20px; transform: rotate(-45deg); }

/* ---------- Animated logo (from devtak-logo-animated kit) ---------- */
/* Offsets are in SVG user units (viewBox is 938 tall, ~9.8 units per rendered px at 40px) */
/* DevTak animated logo: join on load, breathe on hover, still for reduce-motion */
.dt-d,.dt-t{transition:transform .2s ease-out}

.dt-d{animation:dt-in-left .6s cubic-bezier(.2,.8,.2,1) both}

.dt-t{animation:dt-in-right .6s cubic-bezier(.2,.8,.2,1) both}

.dt-word{animation:dt-fade .45s ease-out .35s both}

@keyframes dt-in-left{from{transform:translateX(-156px);opacity:0}
to{transform:none;opacity:1}
}

@keyframes dt-in-right{from{transform:translateX(156px);opacity:0}
to{transform:none;opacity:1}
}

@keyframes dt-fade{from{opacity:0;transform:translateX(-59px)}
to{opacity:1;transform:none}
}

.devtak-logo:hover .dt-d,.devtak-logo:focus-visible .dt-d{transform:translateX(-29px)}

.devtak-logo:hover .dt-t,.devtak-logo:focus-visible .dt-t{transform:translateX(29px)}

@media (prefers-reduced-motion:reduce){.dt-d,.dt-t,.dt-word{animation:none;transition:none}

.devtak-logo:hover .dt-d,.devtak-logo:hover .dt-t,.devtak-logo:focus-visible .dt-d,.devtak-logo:focus-visible .dt-t{transform:none}
}

.devtak-logo{display:inline-flex}
.devtak-logo { border-radius: 8px; outline-offset: 4px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(48px, 8vw, 104px) 0 clamp(56px, 8vw, 96px); }
.hero-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 20%, transparent 75%);
  opacity: .6;
}
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; }
.blob-a { width: 520px; height: 520px; background: var(--cobalt); top: -180px; right: -120px; animation: drift 18s ease-in-out infinite alternate; }
.blob-b { width: 380px; height: 380px; background: var(--tangerine); bottom: -160px; left: -100px; opacity: .22; animation: drift 22s ease-in-out infinite alternate-reverse; }
[data-theme="dark"] .blob-a { opacity: .28; }
[data-theme="dark"] .blob-b { opacity: .16; }
@keyframes drift { to { transform: translate3d(-60px, 50px, 0) scale(1.1); } }

.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(32px, 5vw, 64px); align-items: center;
}

.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); margin: 0 0 20px; font-weight: 600; }
.grad {
  background: linear-gradient(100deg, var(--cobalt) 10%, #7C6CF0 55%, var(--tangerine) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: clamp(1.02rem, 1.4vw, 1.15rem); color: var(--text-soft); max-width: 38em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-facts { display: flex; gap: clamp(20px, 4vw, 44px); margin: 40px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts dt { font-size: 1.8rem; font-weight: 600; line-height: 1.1; color: var(--primary); }
.hero-facts div:nth-child(2) dt { color: var(--accent); }
.hero-facts dd { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }

/* ---------- Editor ---------- */
.editor {
  position: relative;
  background: var(--ed-bg); border: 1px solid var(--ed-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; min-width: 0;
  font-family: var(--mono);
}
.editor::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(140deg, rgba(61, 111, 224, .55), transparent 35%, transparent 65%, rgba(229, 103, 42, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.editor-top { display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--ed-top); border-bottom: 1px solid var(--ed-border); }
.traffic { display: flex; gap: 7px; flex: none; }
.traffic i { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
.traffic i:nth-child(2) { background: #FEBC2E; }
.traffic i:nth-child(3) { background: #28C840; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; padding: 12px 14px; background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: .78rem; color: var(--ed-gutter); transition: color .2s;
}
.tab:hover { color: var(--ed-text); }
.tab[aria-selected="true"] { color: var(--ed-text); background: var(--ed-bg); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--primary); }
.tab::before { content: attr(data-lang); margin-right: 6px; font-size: .68rem; font-weight: 700; color: #9B4F96; }
[data-theme="dark"] .tab::before { color: #C586C0; }
.tab[data-lang="Py"]::before { color: #3572A5; }
[data-theme="dark"] .tab[data-lang="Py"]::before { color: #FFD43B; }

.editor-body {
  display: flex; font-size: .82rem; line-height: 1.7;
  height: calc(22 * 1.7em + 32px);
  overflow: hidden;
}
.editor-body pre { margin: 0; padding: 16px 0; font-family: inherit; }
.gutter { flex: none; width: 3.4em; padding-right: 1em !important; text-align: right; color: var(--ed-gutter); user-select: none; }
.code { flex: 1; min-width: 0; padding-right: 16px !important; color: var(--ed-text); overflow-x: auto; scrollbar-width: thin; white-space: pre; }
.code code { font-family: inherit; }

.t-kw { color: var(--t-kw); }
.t-type { color: var(--t-type); }
.t-fn { color: var(--t-fn); }
.t-str { color: var(--t-str); }
.t-num { color: var(--t-num); }
.t-com { color: var(--t-com); font-style: italic; }
.t-punc { color: var(--t-punc); }

.caret {
  display: inline-block; width: 2px; height: 1.15em; margin-left: 1px; vertical-align: -0.2em;
  background: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.editor-terminal {
  padding: 10px 16px; border-top: 1px solid var(--ed-border); background: var(--ed-top);
  font-size: .78rem; color: var(--ed-gutter); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-terminal .prompt { color: var(--accent); }
.editor-terminal .ok { color: #28A745; }
[data-theme="dark"] .editor-terminal .ok { color: #4ADE80; }
#term-output { transition: opacity .3s; }
.editor-status {
  display: flex; justify-content: space-between; gap: 12px; padding: 5px 14px;
  background: var(--primary); color: #fff; font-size: .7rem; white-space: nowrap;
}
.status-left { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: .9; }

/* ---------- Marquee ---------- */
.marquee {
  border-block: 1px solid var(--border); background: var(--bg-alt); overflow: hidden; padding: 18px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 45s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee ul { display: flex; gap: 12px; margin: 0; padding: 0 6px; list-style: none; }
.marquee li {
  padding: 6px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: .9rem; font-weight: 400; color: var(--text-soft); white-space: nowrap;
}
.marquee li:nth-child(4n+1)::before { content: "◆"; margin-right: 8px; font-size: .6rem; color: var(--primary); vertical-align: 2px; }
.marquee li:nth-child(4n+3)::before { content: "◆"; margin-right: 8px; font-size: .6rem; color: var(--accent); vertical-align: 2px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 56px); }
.kicker { font-family: var(--mono); font-size: .85rem; color: var(--primary-text); margin-bottom: 14px; }
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.75rem); }
.section-lead { margin-top: 16px; font-size: 1.08rem; color: var(--text-soft); }

/* ---------- Service cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  --mx: 50%; --my: 0%;
  position: relative; display: flex; flex-direction: column;
  padding: 30px 28px 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .35s var(--ease), border-color .3s, box-shadow .35s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(61, 111, 224, .12), transparent 45%);
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.card:hover::before { opacity: 1; }
.card-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: rgba(61, 111, 224, .12); color: var(--primary); margin-bottom: 22px;
}
.card-icon.accent { background: rgba(229, 103, 42, .12); color: var(--accent); }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.card > p { color: var(--text-soft); font-size: .97rem; }
.ticks { list-style: none; margin: 20px 0 24px; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 26px; font-size: .93rem; color: var(--text-soft); }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .42em; width: 15px; height: 15px; border-radius: 50%;
  background: rgba(61, 111, 224, .14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%233D6FE0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
}
.card-code {
  margin-top: auto; display: block; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--ed-bg); border: 1px solid var(--ed-border);
  font-family: var(--mono); font-size: .78rem; color: var(--ed-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Animated SVG illustrations ---------- */
.card-art {
  height: 150px; margin: -6px -4px 22px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--bg-alt);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1.2px);
  background-size: 16px 16px;
}
.card-art svg { width: 100%; height: 100%; }

.svg-line { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.svg-flow { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 4 8; animation: dash 1.1s linear infinite; }
.svg-flow.accent { stroke: var(--accent); }
.svg-flow.d2 { animation-duration: 1.4s; }
.svg-flow.d3 { animation-duration: .9s; }
@keyframes dash { to { stroke-dashoffset: -24; } }

.svg-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.svg-box.hl { stroke: var(--primary); }
.svg-t { fill: var(--text); font-family: var(--font); font-weight: 500; font-size: 15px; }
.svg-t.sm { font-size: 12px; }
.svg-t.md { font-size: 13px; }
.svg-t.cs { fill: #9B4F96; font-family: var(--mono); font-weight: 700; }
.svg-t.py { fill: #3572A5; font-family: var(--mono); font-weight: 700; }
[data-theme="dark"] .svg-t.cs { fill: #C586C0; }
[data-theme="dark"] .svg-t.py { fill: #FFD43B; }
.svg-s { fill: var(--muted); font-family: var(--font); font-weight: 300; font-size: 12px; }
.svg-s.xs { font-size: 12px; }
.svg-s.ev { fill: var(--accent); font-family: var(--mono); font-size: 12px; }
.svg-k { fill: var(--primary); font-family: var(--mono); font-size: 13px; }

.pk-a { fill: var(--cobalt); filter: drop-shadow(0 0 4px rgba(61, 111, 224, .8)); }
.pk-b { fill: var(--tangerine); filter: drop-shadow(0 0 4px rgba(229, 103, 42, .8)); }

/* neural net */
.node { fill: var(--surface); stroke: var(--cobalt); stroke-width: 2; }
.node.out { stroke: var(--tangerine); }
.node.pulse { transform-box: fill-box; transform-origin: center; animation: nodePulse 2.4s ease-in-out infinite; }
.node.p2 { animation-delay: .3s; } .node.p3 { animation-delay: .6s; } .node.p4 { animation-delay: .9s; }
@keyframes nodePulse { 0%, 100% { fill: var(--surface); transform: scale(1); } 40% { fill: var(--cobalt); transform: scale(1.22); } }
.sparkle { fill: var(--tangerine); transform-box: fill-box; transform-origin: center; animation: sparkle 3s ease-in-out infinite; }
@keyframes sparkle { 0%, 100% { transform: scale(.7) rotate(0); opacity: .6; } 50% { transform: scale(1.15) rotate(90deg); opacity: 1; } }

/* clouds */
.cloud { fill: var(--surface); stroke-width: 2.4; }
.cloud.c-a { stroke: var(--cobalt); }
.cloud.c-b { stroke: var(--tangerine); }
.float { animation: floaty 4s ease-in-out infinite; }
.float.f2 { animation-delay: -2s; }
@keyframes floaty { 50% { transform: translateY(-4px); } }
.led { fill: #28C840; animation: led 1.6s steps(1) infinite; }
.led.l2 { animation-delay: .4s; } .led.l3 { animation-delay: .8s; }
@keyframes led { 50% { fill: var(--border-strong); } }

/* browser */
.dot-r { fill: #FF5F57; } .dot-y { fill: #FEBC2E; } .dot-g { fill: #28C840; }
.skel { fill: var(--surface-2); stroke: var(--border); transform-box: fill-box; transform-origin: left; animation: skel 2.8s ease-in-out infinite; }
.skel.s2 { animation-delay: .25s; } .skel.s3 { animation-delay: .5s; }
@keyframes skel { 0% { transform: scaleX(.15); } 45%, 100% { transform: scaleX(1); } }
.btn-shape { fill: var(--cobalt); }

/* architecture diagram */
.arch { margin: 0; }
.arch-scroll {
  overflow-x: auto; border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  background-image: radial-gradient(var(--border) 1px, transparent 1.2px); background-size: 20px 20px;
}
.arch-svg { width: 100%; height: auto; padding: 8px; }
.arch-v { display: none; max-width: 520px; margin-inline: auto; }
@media (max-width: 1040px) {
  .arch-h { display: none; }
  .arch-v { display: block; }
  .arch-scroll { overflow: visible; }
}
.arch-cloud { fill: rgba(61, 111, 224, .04); stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 6 8; animation: dash 2.2s linear infinite; }
.arch-node { transition: transform .3s var(--ease); transform-box: fill-box; transform-origin: center; }
.arch-node:hover { transform: translateY(-3px); }
.arch-node:hover .svg-box { stroke: var(--primary); }
.badge.cs { fill: rgba(155, 79, 150, .16); }
.badge.py { fill: rgba(53, 114, 165, .16); }
[data-theme="dark"] .badge.py { fill: rgba(255, 212, 59, .14); }
.badge-t { font-family: var(--mono); font-size: 12px; font-weight: 700; fill: #9B4F96; }
.badge.py + .badge-t { fill: #3572A5; }
[data-theme="dark"] .badge-t { fill: #C586C0; }
[data-theme="dark"] .badge.py + .badge-t { fill: #FFD43B; }
.pill { fill: var(--surface-2); stroke: var(--border-strong); }
.pill-t { fill: var(--text-soft); font-family: var(--font); font-size: 12px; font-weight: 400; }
/* Phones: let the vertical diagram use the full screen width so its labels stay >= 12px (Phase 3.6) */
@media (max-width: 480px) {
  .arch-scroll { margin-inline: calc(-1 * clamp(16px, 4vw, 32px)); border-radius: 0; border-inline: 0; }
  .arch-v .arch-svg, .arch-svg.arch-v { padding: 0; }
}
.ai-glow { stroke: var(--tangerine); animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 10px rgba(229, 103, 42, .55)); } }

.arch-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.arch-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.lg.cs { background: #9B4F96; } .lg.py { background: #3572A5; }
[data-theme="dark"] .lg.cs { background: #C586C0; } [data-theme="dark"] .lg.py { background: #FFD43B; }
.lg.req { background: var(--cobalt); box-shadow: 0 0 6px var(--cobalt); }
.lg.evt { background: var(--tangerine); box-shadow: 0 0 6px var(--tangerine); }

/* ---------- Stack ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.stack-col { padding: 26px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stack-col h3 { display: flex; align-items: baseline; gap: 10px; font-size: 1.15rem; margin-bottom: 18px; }
.stack-num { font-family: var(--mono); font-size: .78rem; font-weight: 400; color: var(--accent-text); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 5px 12px; border-radius: 8px; font-size: .84rem; font-weight: 400;
  background: var(--surface-2); color: var(--text-soft); border: 1px solid transparent;
  transition: border-color .2s, color .2s, transform .2s var(--ease);
}
.chips li:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }

/* ---------- Process ---------- */
.process { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.process-side { position: sticky; top: 110px; }
.process-code {
  margin: 0; padding: 22px 24px; border-radius: var(--radius);
  background: var(--ed-bg); border: 1px solid var(--ed-border); box-shadow: var(--shadow);
  font-family: var(--mono); font-size: clamp(.85rem, 1.4vw, 1rem); line-height: 1.9; color: var(--ed-text);
  overflow-x: auto;
}
.process-code .ln { display: inline-block; width: 100%; padding: 0 8px; margin: 0 -8px; border-radius: 6px; transition: background-color .3s, box-shadow .3s; }
.process-code .ln.active { background: rgba(61, 111, 224, .14); box-shadow: inset 3px 0 0 var(--accent); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.step {
  padding: 26px 26px 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  transition: border-color .3s, box-shadow .3s, transform .3s var(--ease);
}
.step.active { border-color: var(--primary); box-shadow: var(--shadow); }
.step-n { font-family: var(--mono); font-size: .85rem; color: var(--accent-text); }
.step h3 { font-size: 1.2rem; margin: 8px 0 8px; }
.step p { color: var(--text-soft); font-size: .96rem; }

/* ---------- Contact ---------- */
.contact-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px);
  padding: clamp(28px, 5vw, 56px); border-radius: calc(var(--radius) + 8px);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.contact-card::before {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; top: -260px; left: -160px;
  background: radial-gradient(circle, rgba(61, 111, 224, .18), transparent 65%); pointer-events: none;
}
.contact-card::after {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; bottom: -220px; right: -120px;
  background: radial-gradient(circle, rgba(229, 103, 42, .14), transparent 65%); pointer-events: none;
}
.contact-copy, .contact-form { position: relative; z-index: 1; }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.email-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 500; color: var(--primary);
  border-bottom: 2px solid transparent; transition: border-color .2s;
}
.email-link:hover { border-bottom-color: var(--primary); }
.email-link svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.contact-form { display: grid; gap: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > label { font-size: .85rem; font-weight: 400; color: var(--text-soft); }
.field .optional { color: var(--muted); }
.field-error { display: none; font-size: .8rem; color: var(--error); }
.field.invalid .field-error { display: block; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-strong);
  font-size: 1rem; font-weight: 300; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 110px; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%237D849B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.field.invalid input, .field.invalid textarea { border-color: var(--error); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile-slot:empty { display: none; }
.form-status { min-height: 1.4em; font-size: .92rem; text-align: center; }
.form-status.ok { color: var(--success); }
.form-status.err { color: var(--error); }
.form-status a { color: inherit; text-decoration: underline; }
.contact-form.sending button[type="submit"] { opacity: .7; cursor: progress; }
.contact-location { margin-top: 18px; font-size: .92rem; color: var(--muted); }
.footer-loc { margin-top: 6px; font-size: .85rem !important; }
.footer-bottom a { color: inherit; }
.form-note { font-size: .8rem; color: var(--muted); text-align: center; }
.form-note a { color: var(--primary); text-decoration: underline; }


/* ---------- Plain-English line under each service (Phase 4.5) ---------- */
.plain-line {
  margin: -6px 0 20px; padding: 10px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
  background: var(--surface-2); font-size: .9rem; color: var(--text-soft);
}
.plain-line strong { color: var(--text); font-weight: 500; }

/* ---------- How we decide (Phase 4.6) ---------- */
.decide { margin-top: clamp(40px, 6vw, 64px); }
.decide-title { font-size: 1.3rem; margin-bottom: 18px; }
.decide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.decide-note { padding: 22px 22px 20px; border-radius: var(--radius); border: 1px dashed var(--border-strong); background: var(--surface); }
.decide-note h4 { margin: 0 0 8px; font-size: 1.02rem; font-weight: 500; }
.decide-note h4 span { color: var(--accent-text); font-family: var(--mono); font-size: .85rem; margin: 0 4px; }
.decide-note p { font-size: .92rem; color: var(--text-soft); }

/* ---------- Selected work (Phase 4.2) ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.work-card {
  display: flex; flex-direction: column; gap: 14px; padding: 26px 24px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.work-kicker { font-family: var(--mono); font-size: .78rem; color: var(--accent-text); }
.work-card h3 { font-size: 1.2rem; }
.work-pao { display: grid; gap: 10px; margin: 0; }
.work-pao dt { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-text); }
.work-pao dd { margin: 2px 0 0; font-size: .93rem; color: var(--text-soft); }
.work-card .chips { margin-top: auto; }

/* ---------- About (Phase 4.1) — full-width band for visual rhythm (6.4) ---------- */
.about-band {
  background: linear-gradient(135deg, rgba(74, 123, 234, .10), rgba(217, 99, 31, .06)), var(--bg-alt);
  border-block: 1px solid var(--border);
}
.about { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: center; }
.about-photo .avatar, .about-photo img {
  width: 100%; max-width: 320px; aspect-ratio: 1; border-radius: 28px; object-fit: cover;
  display: grid; place-items: center; font-size: 4.5rem; font-weight: 600; letter-spacing: -.02em;
  color: #fff; background: linear-gradient(135deg, #4A7BEA 0 50%, #D9631F 50% 100%);
  box-shadow: var(--shadow-lg);
}
.founder { margin-top: 24px; }
.founder-name { font-size: 1.15rem; font-weight: 500; }
.founder-role { color: var(--muted); font-size: .95rem; }
.about-facts { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.about-facts li { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .9rem; color: var(--text-soft); }
.about-facts strong { color: var(--text); font-weight: 500; }

@media (max-width: 900px) {
  .decide-grid, .work-grid { grid-template-columns: minmax(0, 1fr); }
  .about { grid-template-columns: minmax(0, 1fr); }
  .about-photo .avatar, .about-photo img { max-width: 200px; font-size: 3rem; }
}

/* About: animated DevTak mark (draws itself, then the two halves breathe) */
.about-art { width: 100%; max-width: 320px; aspect-ratio: 1; border-radius: 28px; overflow: hidden; display: grid; place-items: center; box-shadow: var(--shadow-lg); background: radial-gradient(circle at 30% 25%, #17305A, #0B1B33 70%); }
.about-mark { width: 100%; height: auto; display: block; }
.about-mark path, .about-mark circle { stroke-dasharray: 1; stroke-dashoffset: 1; animation: am-draw 1.4s cubic-bezier(.65, 0, .35, 1) .2s forwards; }
.am-d path:nth-child(2) { animation-delay: .7s; }
.am-d circle { animation-delay: 1s; }
.am-t path:nth-child(1) { animation-delay: .45s; }
.am-t path:nth-child(2) { animation-delay: .95s; }
.am-t path:nth-child(3) { animation-delay: 1.2s; }
.am-d, .am-t { animation: am-left 4.5s ease-in-out 3s infinite; }
.am-t { animation-name: am-right; }
@keyframes am-draw { to { stroke-dashoffset: 0; } }
@keyframes am-left { 0%, 100% { transform: none; } 50% { transform: translateX(-30px); } }
@keyframes am-right { 0%, 100% { transform: none; } 50% { transform: translateX(30px); } }
@media (prefers-reduced-motion: reduce) { .about-mark path, .about-mark circle { animation: none; stroke-dashoffset: 0; } .am-d, .am-t { animation: none; } }
@media (max-width: 900px) { .about-art { max-width: 200px; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding-top: 48px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 28px; padding-bottom: 36px; }
.footer-logo { margin-bottom: 12px; }
.footer-logo svg { display: block; height: 32px; width: auto; }
.footer-brand p { color: var(--muted); font-size: .92rem; max-width: 26em; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-nav a { font-size: .93rem; color: var(--text-soft); transition: color .2s; }
.footer-nav a:hover { color: var(--primary); }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-block: 20px; border-top: 1px solid var(--border); font-size: .82rem; color: var(--muted);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: .9rem; font-weight: 400; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.cards .reveal:nth-child(2), .stack-grid .reveal:nth-child(2) { transition-delay: .08s; }
.cards .reveal:nth-child(3), .stack-grid .reveal:nth-child(3) { transition-delay: .16s; }
.stack-grid .reveal:nth-child(4) { transition-delay: .24s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { max-width: 720px; }
  .cards { grid-template-columns: minmax(0, 1fr); max-width: 680px; }
  .stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process { grid-template-columns: minmax(0, 1fr); }
  .process-side { position: static; }
}

@media (max-width: 820px) {
  .menu-toggle { display: inline-grid; }
  .header-cta { display: none; }
  .nav {
    position: absolute; top: 72px; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 4px; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .25s var(--ease), visibility .25s;
  }
  .nav.open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: 14px 16px; font-size: 1.05rem; border-radius: 12px; }
  .nav-cta-mobile { display: block; color: var(--primary) !important; font-weight: 500 !important; }
  .header-actions { margin-left: auto; }
  .contact-card { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .header-inner { height: 64px; gap: 12px; }
  .nav { top: 64px; }
  .brand svg { height: 34px; }
  /* phones: crop the animated logo to the mark (first 938 of 3905 viewBox units; mark is square) */
  .site-header .brand { width: 34px; overflow: hidden; border-radius: 6px; }
  .site-header .brand svg { flex: none; width: 142px; max-width: none; height: 34px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .hero-facts { justify-content: space-between; }
  .editor-body { font-size: .72rem; }
  .status-right { display: none; }
  .stack-grid { grid-template-columns: minmax(0, 1fr); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 24px 20px 22px; }
  .step { padding: 22px 20px; }
  .footer-bottom { flex-direction: column; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .caret { animation: none; }
}

/* ---------- 404 page ---------- */
.notfound { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.notfound-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; max-width: 760px; }
.notfound-inner .brand svg { height: 40px; }
.notfound-inner h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; }
.notfound-inner .hero-actions { margin-top: 6px; }
.notfound-code {
  margin: 12px 0 0; padding: 14px 18px; border-radius: var(--radius-sm); max-width: 100%; overflow-x: auto;
  background: var(--ed-bg); border: 1px solid var(--ed-border); color: var(--ed-text);
  font-family: var(--mono); font-size: .9rem;
}
