/* ===== Tokens ===== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #eef1f5;
  --text: #0f172a;
  --muted: #566070;
  --border: #dde2ea;
  --accent: #0b8f6a;
  --accent-strong: #087556;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 143, 106, 0.1);
  --warn: #9a6300;
  --warn-soft: rgba(201, 138, 20, 0.12);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --header-bg: rgba(246, 247, 249, 0.82);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --wrap: 1120px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151b23;
    --surface-alt: #10151c;
    --text: #e6edf3;
    --muted: #8d98a7;
    --border: #252e39;
    --accent: #3ddc97;
    --accent-strong: #6be8b1;
    --accent-ink: #062418;
    --accent-soft: rgba(61, 220, 151, 0.12);
    --warn: #f0b94a;
    --warn-soft: rgba(240, 185, 74, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --header-bg: rgba(13, 17, 23, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-alt: #10151c;
  --text: #e6edf3;
  --muted: #8d98a7;
  --border: #252e39;
  --accent: #3ddc97;
  --accent-strong: #6be8b1;
  --accent-ink: #062418;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --warn: #f0b94a;
  --warn-soft: rgba(240, 185, 74, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --header-bg: rgba(13, 17, 23, 0.8);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; text-wrap: balance; }
a, button { touch-action: manipulation; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 640px) { :root { --gutter: 24px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--text); color: var(--bg); font: 700 13px/1 var(--mono);
}

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; }
.nav a:hover, .nav a.is-current { color: var(--text); background: var(--surface-alt); }

.header-tools { display: flex; align-items: center; gap: 8px; }

.lang { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lang-btn {
  display: flex; align-items: baseline; gap: 4px; padding: 4px 8px; border-radius: 7px;
  font: 600 12px/1.4 var(--mono); color: var(--muted); text-decoration: none;
}
.lang-btn.is-active { background: var(--text); color: var(--bg); }
.lang-btn.is-active:hover { color: var(--bg); }
.lang-btn.is-soon { opacity: 0.55; cursor: not-allowed; }
.lang-btn small { font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 18px;
}
.icon-btn:hover { border-color: var(--muted); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .header-tools { margin-left: auto; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px; font-size: 1rem; }
}
.brand { white-space: nowrap; }
@media (max-width: 480px) {
  .lang-btn small { display: none; }
  .header-inner { gap: 8px; }
  .brand { gap: 8px; font-size: 0.9rem; }
  .header-tools { gap: 6px; }
}
@media (max-width: 374px) {
  .brand > span:last-child { display: none; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 11px;
  font: 600 0.98rem/1 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-center { justify-content: center; }

/* ===== Hero ===== */
.hero { padding: 72px 0 80px; }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) {
  .hero { padding: 104px 0 112px; }
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; gap: 56px; }
}

.eyebrow, .kicker {
  font: 600 0.8rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 16px;
}
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.7rem); letter-spacing: -0.025em; margin-bottom: 20px; }
.accent { color: var(--accent); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 38em; margin-bottom: 28px; }

.terminal {
  background: #0a0e14; border: 1px solid #222b36; border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); overflow: hidden; min-width: 0;
}
.terminal-bar { display: flex; align-items: center; gap: 7px; padding: 12px 14px; border-bottom: 1px solid #1c242e; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #2b3542; }
.terminal-title { margin-left: 8px; font: 12px/1 var(--mono); color: #7d8896; }
.terminal-body {
  margin: 0; padding: 20px 18px 24px; min-height: 180px;
  font: 14px/1.75 var(--mono); color: #c9d4e0; white-space: pre-wrap; word-break: break-word;
}
.terminal-body .t-ok { color: #3ddc97; }
.terminal-body .t-cmd { color: #ffffff; }
.terminal-body .t-dim { color: #7d8896; }
.cursor { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: #3ddc97; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ===== Sections ===== */
.section { padding: 80px 0; }
.section-alt { background: var(--surface-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
@media (min-width: 900px) { .section { padding: 104px 0; } }

.about-grid { display: grid; gap: 24px; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 0.9fr 1.1fr; gap: 64px; } }
.about-text p { color: var(--muted); font-size: 1.05rem; }
.about-text p:first-child { color: var(--text); }
.facts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.facts li { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); }
.facts strong { color: var(--text); font-weight: 600; }
@media (max-width: 420px) { .facts li { grid-template-columns: 1fr; gap: 2px; } }

/* ===== Tags ===== */
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 4px 10px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border);
  font: 0.78rem/1.4 var(--mono); color: var(--muted);
}

/* ===== What I do ===== */
.work-list { display: grid; gap: 64px; margin-top: 48px; }
.work { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) {
  .work-list { gap: 96px; margin-top: 64px; }
  .work { grid-template-columns: 1fr 1fr; gap: 64px; }
  .work-flip .work-media { order: 2; }
}
.work-media {
  display: grid; place-items: center; min-height: 300px; padding: 32px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.work-media img { display: block; max-width: 100%; height: auto; }
@media (max-width: 520px) { .work-media { min-height: 240px; padding: 20px; } }
.work-num { font: 600 0.8rem/1 var(--mono); color: var(--accent); margin-bottom: 12px; }
.work-copy h3 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); margin-bottom: 12px; }
.work-copy p { color: var(--muted); font-size: 1.05rem; }
.work-copy .tags { margin-top: 20px; }
.work-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; font-weight: 600; text-decoration: none; }
.work-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.work-note { display: flex; align-items: center; gap: 10px; margin: 64px 0 0; color: var(--muted); font-size: 0.92rem; }
.work-note svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--warn); }

/* Visual 1: workflow diagram */
.flow { display: flex; flex-direction: column; align-items: center; width: 100%; }
.flow-node {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; white-space: nowrap;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px;
  font: 600 0.85rem/1.3 var(--mono); color: var(--text);
}
.flow-main { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); padding: 14px 20px; }
.flow-ico { color: var(--accent); }
.flow-line { position: relative; width: 2px; height: 40px; background: var(--border); overflow: hidden; }
.flow-line i { position: absolute; left: 0; top: -14px; width: 2px; height: 14px; background: var(--accent); animation: flow-pulse 1.8s linear infinite; }
.flow-line + .flow-main + .flow-line i { animation-delay: 0.9s; }
@keyframes flow-pulse { to { transform: translateY(54px); } }
.flow-outs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Visual 2: browser frame (the real site is light, so the frame stays light in both themes) */
.browser { width: 100%; max-width: 520px; overflow: hidden; background: #fff; border: 1px solid #d5dbe3; border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #eef1f5; border-bottom: 1px solid #d5dbe3; }
.browser-bar .dot { width: 9px; height: 9px; background: #cdd3db; }
.browser-url { flex: 1; min-width: 0; margin-left: 8px; padding: 3px 10px; border-radius: 6px; background: #fff; font: 0.72rem/1.4 var(--mono); color: #566070; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser img { width: 100%; }
.browser-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; }
.browser-grid i { position: relative; aspect-ratio: 4 / 3.6; border-radius: 3px; background: linear-gradient(180deg, #e7eaef 0 58%, #d3d9e1 58% 100%); }
.browser-grid i::before { content: ""; position: absolute; left: 8%; top: 62%; width: 22%; height: 7%; background: #e60000; border-radius: 2px; }

/* Visual 3: status board */
.status { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 400px; font: 0.9rem/1.4 var(--mono); }
.status li { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.status li:last-child { border-bottom: 0; }
.status .ok { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.status em { margin-left: auto; font-style: normal; font-size: 0.8rem; color: var(--accent); white-space: nowrap; }

/* ===== Contact ===== */
.contact { text-align: center; }
.contact-inner { max-width: 720px; }
.contact .lead { margin-left: auto; margin-right: auto; }

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

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 0.92rem; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 60;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

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