/* ==========================================================
   CodeVanta - styles.css
   Tokens -> base -> layout -> components -> sections -> utilities
   ========================================================== */

:root {
  --navy-950: #070d1f;
  --navy-900: #0a1226;
  --navy-800: #0f1a38;
  --navy-700: #16264f;
  --line: #243a72;
  --blue: #1d6bff;
  --blue-bright: #3b8bff;
  --ice: #9fd0ff;
  --white: #ffffff;
  --text: #e8efff;
  --muted: #a9b8dc;
  --ink: #0a1226;
  --ink-muted: #44527a;
  --danger: #ff8a8a;
  --danger-ink: #b3261e;
  --ok: #4ade80;

  --font-sans: "Segoe UI Variable Text", "Segoe UI", "Avenir Next", "Helvetica Neue", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 32px rgba(3, 8, 24, 0.45);
  --header-h: 68px;
  --container: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--navy-900);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
a { color: var(--ice); }
a:hover { color: var(--white); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .6em; letter-spacing: -0.02em; color: var(--white); }
h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 750; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 720; }
h3 { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 68ch; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--white); color: var(--ink); padding: .7rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Icons ---------- */
.icon, .card-icon, .icon-lg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon { width: 1.15em; height: 1.15em; flex: none; }
.card-icon { width: 46px; height: 46px; padding: 11px; border-radius: 12px; background: var(--navy-700); color: var(--ice); margin-bottom: 1.1rem; }
.icon-lg { width: 30px; height: 30px; color: var(--blue-bright); margin-bottom: .9rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: 999px; border: 1.5px solid transparent;
  font: 600 1rem/1.2 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn-primary { background: var(--blue); color: var(--white); box-shadow: 0 6px 20px rgba(29, 107, 255, .35); }
.btn-primary:hover { background: #3b82ff; color: var(--white); transform: translateY(-1px); }
.btn-ghost { border-color: var(--line); color: var(--white); background: transparent; }
.btn-ghost:hover { border-color: var(--blue-bright); background: rgba(59, 139, 255, .1); color: var(--white); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }

.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; text-decoration: none; margin-top: auto; }
.link-arrow .icon { transition: transform .2s; }
.link-arrow:hover .icon { transform: translateX(4px); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(10, 18, 38, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(36, 58, 114, .6);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--white); }
.brand-mark { border-radius: 10px; }
.brand-text { font: 750 1.4rem/1 var(--font-display); letter-spacing: -0.03em; color: var(--white); }
.brand-text span { color: var(--blue-bright); }

.site-nav { display: flex; align-items: center; gap: 1.6rem; }
.site-nav ul { display: flex; gap: .4rem; }
.site-nav ul a {
  display: block; padding: .5rem .85rem; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 550; font-size: .98rem; transition: color .2s, background-color .2s;
}
.site-nav ul a:hover, .site-nav ul a.is-active { color: var(--white); background: rgba(59, 139, 255, .14); }
.nav-cta { padding: .65rem 1.2rem; }

.nav-toggle {
  display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--white); cursor: pointer;
}
.nav-toggle .icon { width: 24px; height: 24px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .js .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 1rem; padding: 1rem 1.25rem 1.5rem;
    background: var(--navy-900); border-bottom: 1px solid var(--line);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .js .site-nav.is-open { visibility: visible; opacity: 1; transform: none; }
  .site-nav ul { flex-direction: column; }
  .site-nav ul a { padding: .8rem 1rem; font-size: 1.05rem; }
  .nav-cta { width: 100%; }
  .no-js .site-header { height: auto; position: static; }
  .no-js .nav-wrap { flex-wrap: wrap; padding-block: .8rem; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(4rem, 8vw, 6.5rem) 0; }
.section-alt { background: var(--navy-800); }
.section-head { margin-bottom: 2.8rem; }
.section-head p { color: var(--muted); font-size: 1.1rem; }

.grid { display: grid; gap: 1.4rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column;
  background: var(--navy-800); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.7rem; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.section-alt .card { background: var(--navy-900); }
.card p { color: var(--muted); }
.card:hover { border-color: var(--blue-bright); transform: translateY(-3px); box-shadow: var(--shadow); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(4.5rem, 9vw, 7.5rem);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(29, 107, 255, .28), transparent 70%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900));
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(59, 139, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(59, 139, 255, .07) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(600px 360px at 70% 40%, #000, transparent 80%);
  mask-image: radial-gradient(600px 360px at 70% 40%, #000, transparent 80%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; }
.hero-tag { color: var(--ice); font-weight: 600; margin-bottom: 1.1rem; }
.lead { font-size: 1.2rem; color: var(--muted); }
@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-visual { position: relative; padding-bottom: 9rem; }
.mock {
  background: var(--navy-800); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.mock-bar { display: flex; align-items: center; gap: 6px; padding: .6rem .9rem; background: var(--navy-700); border-bottom: 1px solid var(--line); }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.mock-bar i:first-child { background: var(--blue-bright); }
.mock-bar span { margin-left: .6rem; font: .78rem var(--font-mono); color: var(--muted); }
.mock-code { width: 100%; }
.code { margin: 0; padding: 1.1rem 1.2rem 1.3rem; font: .88rem/1.7 var(--font-mono); color: var(--text); overflow-x: auto; }
.c-k { color: #7db4ff; } .c-s { color: #8fe3c0; } .c-f { color: #ffd479; } .c-o { color: var(--muted); }
.mock-dash { position: absolute; right: 0; bottom: 0; width: 62%; background: var(--navy-900); }
.dash-body { padding: 1rem 1.1rem 1.1rem; }
.dash-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.dash-row em { font-style: normal; font-size: .78rem; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.dot.d-done { background: var(--blue-bright); border-color: var(--blue-bright); }
.dot.d-now { border-color: var(--ice); }
.line { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--ice)); transform-origin: left; }
.l1 { width: 100%; } .l2 { width: 100%; } .l3 { width: 60%; } .l4 { width: 20%; opacity: .5; }
.dash-chart { display: block; width: 100%; height: 64px; margin-top: .5rem; }
.dash-note { margin: .4rem 0 0; font-size: .72rem; color: var(--muted); }

@media (max-width: 640px) {
  .mock-code { width: 100%; }
  .mock-dash { position: relative; width: 88%; margin: -1.5rem 0 0 auto; }
  .hero-visual { padding-bottom: 0; }
  .code { font-size: .8rem; }
}

/* One orchestrated moment: project bars fill in sequence on load */
.js .line { animation: fill 1s cubic-bezier(.2, .7, .2, 1) both; }
.js .l1 { animation-delay: .3s; } .js .l2 { animation-delay: .6s; } .js .l3 { animation-delay: .9s; } .js .l4 { animation-delay: 1.2s; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.8rem; }
.chip {
  padding: .5rem 1.05rem; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font: 600 .95rem var(--font-sans); cursor: pointer; transition: all .2s;
}
.chip:hover { color: var(--white); border-color: var(--blue-bright); }
.chip.is-active { background: var(--blue); border-color: var(--blue); color: var(--white); }

.project { padding: 0; overflow: hidden; }
.project-art { border-bottom: 1px solid var(--line); line-height: 0; }
.project-art svg { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 1.5rem 1.6rem 1.7rem; }
.project-sub { color: var(--ice) !important; font-weight: 600; font-size: .95rem; margin-bottom: .7rem; }
.badge { display: inline-block; align-self: flex-start; margin: 0 0 .8rem; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 650; }
.card .badge-live { background: rgba(74, 222, 128, .14); color: var(--ok); }
.card .badge-demo { background: rgba(255, 212, 121, .14); color: #ffd479; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin: .3rem 0 1.2rem; }
.tags li { padding: .2rem .65rem; border-radius: 6px; background: var(--navy-700); color: var(--text); font: .78rem var(--font-mono); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 3rem 1.5rem; border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty-state[hidden] { display: none; }
.empty-state .icon { width: 36px; height: 36px; color: var(--blue-bright); margin-bottom: .8rem; }
.empty-state p { color: var(--muted); }
.project[hidden] { display: none; }

/* ---------- About (light section) ---------- */
#about { background: var(--white); color: var(--ink); }
#about h2 { color: var(--ink); }
#about p { color: var(--ink-muted); }
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center; }
.note {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1.8rem;
  background: var(--ink); border-radius: var(--radius-lg); box-shadow: 0 18px 40px rgba(10, 18, 38, .22);
}
.note .icon { width: 30px; height: 30px; color: var(--ice); margin-top: .2rem; }
#about .note p { color: var(--text); margin: 0; font-size: 1.12rem; line-height: 1.55; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 2rem; } }

/* ---------- Why ---------- */
.why { padding: 1.6rem 0; border-top: 1px solid var(--line); }
.why p { color: var(--muted); margin: 0; }

/* ---------- Process ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; counter-reset: s; position: relative; }
.step { position: relative; padding-top: 4.2rem; }
.step-num {
  position: absolute; top: 0; left: 0; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue); color: var(--white);
  font: 700 1.1rem var(--font-display); z-index: 1;
}
.step::before {
  content: ""; position: absolute; top: 22px; left: 46px; right: -1.4rem; height: 2px;
  background: linear-gradient(90deg, var(--blue-bright), var(--line));
}
.step:last-child::before { display: none; }
.step p { color: var(--muted); margin: 0; }
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; gap: 0; }
  .step { padding: 0 0 2rem 4rem; min-height: 4.6rem; }
  .step::before { top: 46px; bottom: 0; left: 22px; right: auto; width: 2px; height: auto; background: var(--line); }
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 3.5rem; align-items: start; }
.contact-list { display: grid; gap: .9rem; margin-top: 1.6rem; }
.contact-list li { display: flex; gap: .7rem; align-items: center; }
.contact-list .icon { width: 22px; height: 22px; color: var(--blue-bright); }
.contact-list a { font-weight: 600; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; gap: 2.2rem; } }

.form { background: var(--white); color: var(--ink); border-radius: var(--radius-lg); padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: var(--shadow); }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 650; margin-bottom: .4rem; font-size: .98rem; }
.opt { font-weight: 400; color: var(--ink-muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: .8rem .95rem; border: 1.5px solid #c3cde6; border-radius: 10px;
  background: #f7f9ff; color: var(--ink); font: 1rem var(--font-sans); transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29, 107, 255, .25); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-ink); background: #fff6f5; }
.err { margin: .35rem 0 0; min-height: 0; color: var(--danger-ink); font-size: .9rem; font-weight: 550; }
.err:empty { display: none; }
.status { margin-top: 1rem; padding: .9rem 1rem; border-radius: 10px; font-size: .98rem; }
.status[hidden] { display: none; }
.status p { margin: 0 0 .5rem; max-width: none; }
.status p:last-child { margin: 0; }
.status.is-success { background: #e8f8ee; color: #14532d; border: 1px solid #9bd7b1; }
.status.is-error { background: #fdecea; color: #7a1710; border: 1px solid #f2b3ae; }
.status a { color: inherit; font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); border-top: 1px solid var(--line); padding-top: 3.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.3fr; gap: 2.5rem; }
.footer-about { color: var(--muted); margin-top: 1rem; font-size: .98rem; }
.footer-title { font: 650 1rem var(--font-display); color: var(--white); margin-bottom: .9rem; letter-spacing: 0; }
.site-footer li { margin-bottom: .55rem; }
.site-footer li a { color: var(--muted); text-decoration: none; font-size: .98rem; }
.site-footer li a:hover { color: var(--white); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding: 1.4rem 0 2rem; border-top: 1px solid var(--navy-700); color: var(--muted); font-size: .92rem; }
.footer-bottom p { margin: 0; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Simple pages (privacy, 404) ---------- */
.page { padding: clamp(3rem, 7vw, 5rem) 0; min-height: 70vh; }
.page .container { max-width: 760px; }
.page h2 { font-size: 1.4rem; margin-top: 2rem; }
.page p, .page li { color: var(--muted); }
.page ul { list-style: disc; padding-left: 1.3rem; }
.page-404 { text-align: center; }
.page-404 .container { display: flex; flex-direction: column; align-items: center; }

/* ---------- Scroll reveal (subtle) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .card.reveal.is-visible { transition: opacity .6s ease, transform .2s ease, border-color .2s, box-shadow .2s; }

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