/* ==========================================================================
   candai.me — 2027
   No framework, no build step. Edit tokens below to retheme the whole site.
   ========================================================================== */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6370;
  --border: #e4e4e0;
  --accent: #2f6df6;
  --accent-soft: rgba(47, 109, 246, 0.1);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 14px;
  --max-w: 1080px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #16191e;
    --text: #e8e9ec;
    --muted: #9aa0ab;
    --border: #262a31;
    --accent: #6c9bff;
    --accent-soft: rgba(108, 155, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #16191e;
  --text: #e8e9ec;
  --muted: #9aa0ab;
  --border: #262a31;
  --accent: #6c9bff;
  --accent-soft: rgba(108, 155, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.fill { fill: currentColor; stroke: none; }

.container { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: 24px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 8px 14px; background: var(--accent); color: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; }

.brand { font-family: var(--font-mono); font-weight: 500; font-size: 16px; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--text); background: var(--accent-soft); }

.nav-links a.nav-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; }

.theme-toggle, .nav-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--text); background: var(--accent-soft); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav-toggle { display: grid; }
  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-links a.nav-icon, .theme-toggle { width: 100%; justify-items: start; padding-inline: 12px; }
}

/* ---------- Hero ---------- */

.hero { padding-block: clamp(72px, 14vh, 160px) clamp(56px, 10vh, 112px); }

.eyebrow { margin: 0 0 8px; font-family: var(--font-mono); font-size: 15px; color: var(--accent); }

.hero-title {
  margin: 0;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hero-roles {
  margin: 16px 0 0;
  min-height: 1.3em;
  font-size: clamp(22px, 3.6vw, 36px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.caret { display: inline-block; width: 3px; height: 0.9em; margin-left: 4px; vertical-align: -0.08em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-lead { max-width: 620px; margin: 28px 0 0; font-size: 19px; color: var(--muted); }
.hero-lead strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); }

/* ---------- Sections ---------- */

.section { padding-block: 56px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 32px;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.section-title span { font-family: var(--font-mono); font-size: 15px; font-weight: 400; color: var(--accent); }
.section-title::after { content: ""; flex: 1; max-width: 280px; height: 1px; background: var(--border); }

/* About */
.about { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
.about-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.about-body p { margin: 0 0 16px; color: var(--muted); }
.about-body strong { color: var(--text); font-weight: 600; }
.subhead { margin: 28px 0 12px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tags li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
}

@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 200px; }
}

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card h3 { margin: 16px 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 15.5px; color: var(--muted); }
.card strong { color: var(--text); font-weight: 600; }
.card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

/* Projects */
.group-title { margin: 0 0 16px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.projects + .group-title { margin-top: 48px; }

.featured {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  margin-bottom: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.featured-body { padding: 32px; }
.featured h3 { margin: 0 0 12px; font-size: clamp(22px, 3vw, 28px); line-height: 1.25; letter-spacing: -0.02em; }
.featured-lead { margin: 0 0 16px; color: var(--muted); }
.featured-lead strong { color: var(--text); font-weight: 600; }
.featured-points { margin: 0 0 20px; padding-left: 20px; color: var(--muted); font-size: 15.5px; }
.featured-points li { margin-bottom: 6px; }
.featured-points li::marker { color: var(--accent); }
.featured-cta { margin-top: 24px; }

.featured-visual {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 32px;
  background:
    radial-gradient(120% 80% at 100% 0%, var(--accent-soft), transparent 60%),
    color-mix(in srgb, var(--accent) 5%, var(--surface));
  border-left: 1px solid var(--border);
}
.wave { width: 96px; height: 60px; stroke: var(--accent); stroke-width: 3.2; }
.flow { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.flow li {
  position: relative;
  padding: 0 0 18px 28px;
  font-size: 14.5px;
  color: var(--muted);
  counter-increment: step;
}
.flow li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.flow li:last-child { padding-bottom: 0; }
.flow span { display: block; font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text); }

@media (max-width: 820px) {
  .featured { grid-template-columns: 1fr; }
  .featured-body { padding: 24px; }
  .featured-visual { order: -1; flex-direction: row; align-items: center; padding: 20px 24px; border-left: 0; border-bottom: 1px solid var(--border); }
  .flow { display: none; }
}

.more-link { margin: 32px 0 0; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.project-media {
  display: block;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: zoom-in;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.4s; }
.project:hover .project-media img { transform: scale(1.03); }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.project-meta { margin: 0 0 6px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.project h3 { margin: 0 0 16px; font-size: 17px; line-height: 1.4; letter-spacing: -0.01em; }
.link-arrow { margin-top: auto; font-weight: 600; font-size: 15px; text-decoration: none; }
.link-arrow::after { content: " →"; transition: margin 0.15s; }
.link-arrow:hover::after { margin-left: 4px; }

/* Contact */
.contact { max-width: 640px; }
.contact-lead { margin: 0 0 16px; color: var(--muted); font-size: 18px; }
.contact-email {
  display: inline-block;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-all;
}
.contact-details { list-style: none; margin: 24px 0 0; padding: 0; color: var(--muted); }
.contact-details li { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.contact-details a { color: inherit; text-decoration: none; }
.contact-details a:hover { color: var(--text); }

.socials { display: flex; gap: 10px; list-style: none; margin: 28px 0 0; padding: 0; }
.socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-block: 32px 40px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* Lightbox */
.lightbox {
  max-width: min(1100px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  overflow: auto;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); }
.lightbox img { display: block; width: 100%; height: auto; }
.lightbox-close {
  position: sticky;
  top: 8px;
  float: right;
  margin: 8px 8px -48px 0;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Scroll reveal (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

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