/* ---------- design tokens ---------- */
:root {
  --bg: #0e1013;
  --bg-elevated: #171a1f;
  --bg-elevated-2: #1d2127;
  --border: #2a2e36;
  --border-soft: #22262d;

  --text: #ece8e0;
  --text-muted: #9a9da6;
  --text-faint: #6b6e76;

  --accent: #e0a458;
  --accent-soft: rgba(224, 164, 88, 0.14);
  --accent-line: rgba(224, 164, 88, 0.35);
  --response: #6fb3c9;

  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --sidebar-w: 272px;
  --radius: 10px;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-serif); font-weight: 500; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #0e1013;
  padding: 10px 16px;
  z-index: 200;
}
.skip-link:focus { left: 16px; top: 16px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.tags span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
}

.text-link {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.text-link:hover { border-bottom-color: var(--accent-line); transform: translateX(3px); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 11px 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn-primary {
  position: relative;
  background: var(--accent);
  color: #17120a;
  overflow: hidden;
  z-index: 0;
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #f0c07f;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s ease-out;
  z-index: -1;
}
.btn-primary:hover::before { transform: scaleX(1); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }
.btn-block { width: 100%; }

/* ---------- stat chips ---------- */
.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0;
}
.stat-chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.stat-chip:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  border-color: var(--accent-line);
}
.stat-chip strong { display: block; color: var(--text); font-family: var(--font-serif); font-weight: 500; font-size: 16px; margin-bottom: 2px; }

/* ---------- media slot (placeholder for photos/video) ---------- */
.media-slot {
  position: relative;
  width: 100%;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-faint);
  text-align: center;
  padding: 20px;
  overflow: hidden;
}
.media-slot svg { width: 30px; height: 30px; opacity: 0.6; }
.media-slot span {
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 22ch;
  line-height: 1.5;
}
.media-slot.ratio-16x9 { aspect-ratio: 16 / 9; }
.media-slot.ratio-4x3 { aspect-ratio: 4 / 3; }
.media-slot.ratio-1x1 { aspect-ratio: 1 / 1; }
.media-slot.round { border-radius: 50%; }
.media-slot img, .media-slot video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- media frame (real photos/video, not a placeholder) ---------- */
.media-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.media-frame.ratio-16x9 { aspect-ratio: 16 / 9; }
.media-frame.ratio-4x3 { aspect-ratio: 4 / 3; }
.media-frame.ratio-1x1 { aspect-ratio: 1 / 1; }
.media-frame.round { border-radius: 50%; }
.media-frame img, .media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.terminal-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a0c0f;
  display: flex;
  flex-direction: column;
}
.terminal-frame.ratio-4x3 { aspect-ratio: 4 / 3; }
.terminal-titlebar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-elevated-2);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.terminal-titlebar span { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.terminal-body {
  flex: 1;
  margin: 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.t-prompt { color: var(--accent); }
.t-ok { color: #6fbf7f; }

.media-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.media-caption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 8px 0 0;
}

/* ---------- shell layout (sidebar + main) ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-soft);
  padding: 36px 26px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-identity { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; transition: opacity 0.2s ease; }
.sidebar-identity:hover { opacity: 0.8; }
.mobile-identity { transition: opacity 0.2s ease; }
.mobile-identity:hover { opacity: 0.8; }
.sidebar-avatar { width: 84px; height: 84px; }
.sidebar-avatar svg { width: 24px; height: 24px; }

.sidebar-name { font-size: 21px; }
.sidebar-name .logo-dot { color: var(--accent); }
.sidebar-tagline {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.sidebar-nav {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav a {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  padding: 9px 10px;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.sidebar-nav a:hover { color: var(--text); }
.sidebar-nav a.active { color: var(--accent); background: var(--accent-soft); }

.sidebar-cta {
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #6fbf7f;
}

.sidebar-contact { display: flex; flex-direction: column; gap: 8px; font-family: var(--font-mono); font-size: 12.5px; }
.sidebar-contact a { color: var(--text-faint); }
.sidebar-contact a:hover { color: var(--accent); }

.sidebar-social { display: flex; gap: 10px; margin-top: 4px; }
.sidebar-social a {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
}
.sidebar-social a:hover { color: var(--accent); border-color: var(--accent-line); }
.sidebar-social svg { width: 15px; height: 15px; }

/* mobile top bar + dropdown panel (hidden on desktop) */
.mobile-topbar { display: none; }
.mobile-panel { display: none; }

/* ---------- main content ---------- */
.main { flex: 1; min-width: 0; }
.page { max-width: 860px; margin: 0 auto; padding: 72px 44px 100px; }
.page-block { padding-bottom: 88px; }
.page-block:last-child { padding-bottom: 0; }
.page-header { margin-bottom: 44px; }
.page-header h1 { font-size: clamp(30px, 4vw, 40px); }
.page-lede { color: var(--text-muted); font-size: 16px; margin-top: 10px; max-width: 56ch; }

/* ---------- home hero ---------- */
.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  padding-bottom: 64px;
}
.home-hero > div { position: relative; z-index: 1; }

.home-hero h1 {
  font-size: clamp(38px, 5.5vw, 56px);
  line-height: 1.05;
  margin: 6px 0 14px;
}
.home-hero-sub { color: var(--text-muted); font-size: 16.5px; max-width: 46ch; }
.home-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.home-photo-slot { max-width: 320px; margin-left: auto; }
.teaser-card {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 28px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 22px;
  align-items: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.teaser-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  border-color: var(--accent-line);
}
.teaser-media { border-radius: 8px; }
.teaser-body h3 { font-size: 18px; margin-bottom: 8px; }
.teaser-body p { color: var(--text-muted); font-size: 14px; margin: 0 0 12px; }

/* ---------- flagship project (projects page) ---------- */
.flagship-media-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 28px;
}
.flagship-lines { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.flagship-lines li {
  font-size: 14.5px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}
.flagship-lines li::before {
  content: "";
  position: absolute; left: 0; top: 9px;
  width: 6px; height: 1.5px; background: var(--accent);
}

.widget-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.widget-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.widget-title { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }
.widget-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 9px;
}
#control-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 320;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
}
.widget-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.widget-controls input[type="range"] { flex: 1; accent-color: var(--accent); }
.widget-legend { display: flex; gap: 16px; margin-top: 10px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.widget-legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.swatch-setpoint { background: var(--response); }
.swatch-response { background: var(--accent); }

/* ---------- project cards (media-led) ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project-media-card {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.project-media-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  border-color: var(--accent-line);
}
.project-media-card .media-slot { border: none; border-radius: 0; border-bottom: 1px solid var(--border-soft); }
.project-media-body { padding: 18px; }
.project-media-body h3 { font-size: 16.5px; margin-bottom: 6px; }
.project-media-body p { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.project-media-body .tags { margin-top: 12px; }

.earlier-builds { margin-top: 48px; }
.earlier-title {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 16px;
}
.earlier-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 28px; }
.earlier-list li { font-size: 13.5px; color: var(--text-muted); padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.earlier-list strong { color: var(--text); font-weight: 500; }

/* ---------- about page ---------- */
.about-row { display: grid; grid-template-columns: 1fr 0.7fr; gap: 40px; align-items: start; }
.about-copy p { color: var(--text-muted); margin: 0 0 14px; font-size: 15px; }

.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 40px; }
.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 12px;
}

.exp-entry { display: grid; grid-template-columns: 170px 1fr; gap: 28px; }
.exp-meta { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.exp-body h3 { font-size: 19px; margin-bottom: 6px; }
.exp-org { color: var(--accent); font-family: var(--font-mono); font-size: 12.5px; margin: 0 0 16px; }
.exp-body ul { display: flex; flex-direction: column; gap: 9px; }
.exp-body li { color: var(--text-muted); font-size: 13.5px; padding-left: 16px; position: relative; }
.exp-body li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 1.5px; background: var(--accent); }

/* ---------- footer ---------- */
.page-footer {
  padding-top: 40px;
  margin-top: 40px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .shell { flex-direction: column; }
  .sidebar { display: none; }

  .mobile-nav-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(14, 16, 19, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 20px;
  }
  .mobile-identity { display: flex; align-items: center; gap: 10px; }
  .mobile-identity .sidebar-avatar { width: 32px; height: 32px; }
  .mobile-identity .sidebar-avatar svg { width: 14px; height: 14px; }
  .mobile-name { font-family: var(--font-serif); font-size: 16px; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  .nav-toggle span { display: block; height: 1.5px; width: 15px; margin: 0 auto; background: var(--text); }

  .mobile-panel {
    display: none;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 20px;
  }
  .mobile-panel.open { display: block; }
  .mobile-panel .sidebar-nav { margin-top: 0; }
  .mobile-panel .sidebar-cta { margin-top: 22px; padding-top: 20px; }

  .page { padding: 44px 24px 72px; }
  .home-hero, .flagship-media-row, .about-row, .media-row { grid-template-columns: 1fr; }
  .home-photo-slot { max-width: 220px; margin: 0 0 8px; }
  .teaser-card { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .earlier-list { grid-template-columns: 1fr; }
  .exp-entry { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 520px) {
  .page { padding: 36px 18px 64px; }
  .btn { padding: 10px 16px; }
  .home-hero-actions { flex-direction: column; align-items: stretch; }
  .stat-chips { gap: 10px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none !important;
  }
  .btn-primary::before,
  .project-media-card, .teaser-card, .stat-chip, .text-link {
    transition: none !important;
  }
}
