@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ==========================================================================
   STUDIO — a dark, app-like layout built around a fixed left sidebar nav.
   Self-contained: reset, layout, components, responsive. Does NOT style
   .theme-switch / .theme-switch-label (owned by switcher.css).
   ========================================================================== */

:root {
  --bg: #14161d;
  --panel: #1b1e27;
  --panel-2: #20232e;
  --sidebar: #171922;
  --text: #e7e9f0;
  --muted: #9aa3b2;
  --accent: #35d0c0;
  --accent-ink: #0c1512;
  --accent-soft: rgba(53, 208, 192, 0.14);
  --accent-soft-strong: rgba(53, 208, 192, 0.22);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --maxw: 860px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0.3em 0; }

/* ---- generic links ---- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}
a:hover { color: #5fe0d2; text-decoration: underline; }
a:visited { color: var(--accent); }

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

/* ==========================================================================
   LAYOUT — fixed left sidebar + offset content
   ========================================================================== */

.main-content {
  padding-left: var(--sidebar-w);
  min-height: 100vh;
}

.container {
  max-width: var(--maxw);
  margin-left: 0;
  margin-right: auto;
  padding: 44px 40px 72px;
}

/* ---- sidebar (was .site-header) ---- */
.site-header {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 28px 18px;
  gap: 28px;
  overflow-y: auto;
  z-index: 50;
}

.site-brand { flex: 0 0 auto; }

.site-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.site-brand-link:hover { text-decoration: none; background: rgba(255, 255, 255, 0.03); }

.logo-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.brand-text { min-width: 0; }
.brand-text .name {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.contact { margin-top: 2px; }
.contact-email {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}
.contact-email:hover { color: var(--accent); }

/* ---- vertical nav stack ---- */
.site-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.nav-link:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}
.nav-link:focus-visible { outline-offset: 0; }
.nav-link[aria-current] {
  color: var(--text);
  background: var(--accent-soft-strong);
  border-color: var(--border);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* ---- footer (OUTSIDE .main-content — offset to match) ---- */
.site-footer {
  margin-left: var(--sidebar-w);
  padding: 22px 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  background: var(--bg);
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.card-spaced { margin-bottom: 20px; }
.card h1:first-child, .card h2:first-child { margin-top: 0; }

/* ---- hero ---- */
.hero {
  margin-bottom: 24px;
}
.hero-copy { max-width: 680px; }

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.hero h1 { margin: 0 0 16px; }

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 24px;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover { background: #5fe0d2; color: var(--accent-ink); }
.btn-primary:visited { color: var(--accent-ink); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--accent); color: var(--text); }
.btn-ghost:visited { color: var(--text); }

/* ---- text link ---- */
.text-link {
  color: var(--accent);
  font-weight: 500;
}
.text-link:hover { color: #5fe0d2; }

/* ---- section grid (home) ---- */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-header h2 { margin: 0; }

.richtext h2 { margin-top: 1.2em; }
.richtext h2:first-child { margin-top: 0; }
.richtext ul { color: var(--text); }
.richtext li { color: var(--text); }

.section { margin: 0; }

/* ---- latest-writing note list ---- */
.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.note-list li {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.note-list li:first-child { border-top: none; padding-top: 0; }

.note-list a {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.note-list a:hover { color: var(--accent); text-decoration: none; }

.note-meta {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.note-summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- blogs list (bulleted) ---- */
.bulleted {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.bulleted li {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.bulleted li:first-child { border-top: none; padding-top: 4px; }
.bulleted li > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.bulleted li > div:first-child strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}
.bulleted li > div:first-child a { color: var(--text); }
.bulleted li > div:first-child a:hover { color: var(--accent); text-decoration: none; }
.bulleted li > div:first-child span {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bulleted li > div:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   BLOG DETAIL — body + code
   ========================================================================== */

.note-body { color: var(--text); }
.note-body h2 { margin-top: 1.5em; }
.note-body h3 { margin-top: 1.3em; }
.note-body ul, .note-body ol { color: var(--text); }
.note-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.note-body a:hover { color: #5fe0d2; }
.note-body strong { color: var(--text); font-weight: 700; }

.note-body blockquote {
  margin: 1.2em 0;
  padding: 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.note-body code {
  font-family: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--panel-2);
  color: #d7f6f1;
  padding: 0.15em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.note-body pre {
  margin: 1.2em 0;
  padding: 18px 20px;
  background: #0f1118;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.55;
}
.note-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.86rem;
  color: #d8dbe6;
}

.note-body .codehilite {
  margin: 1.2em 0;
  background: #0f1118;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.note-body .codehilite pre {
  margin: 0;
  border: none;
  background: none;
  border-radius: 0;
}

/* Pygments tokens — tuned for the graphite/teal palette (all >= 4.5:1 on #0f1118) */
.codehilite .c, .codehilite .c1, .codehilite .cm, .codehilite .cs { color: #7d879c; font-style: italic; } /* comments */
.codehilite .k, .codehilite .kn, .codehilite .kd, .codehilite .kc, .codehilite .kr, .codehilite .kt { color: #c58af0; } /* keyword */
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sb, .codehilite .sc, .codehilite .sd, .codehilite .se, .codehilite .sh, .codehilite .si, .codehilite .sx, .codehilite .sr, .codehilite .ss { color: #8fe3a6; } /* string */
.codehilite .n { color: #d8dbe6; } /* name */
.codehilite .nf, .codehilite .fm { color: #58c8 f0; color: #5cc8f0; } /* function name */
.codehilite .nc, .codehilite .nn { color: #f0c674; } /* class / namespace */
.codehilite .nb, .codehilite .bp { color: #5cc8f0; } /* builtin */
.codehilite .nv, .codehilite .vc, .codehilite .vg, .codehilite .vi { color: #e7e9f0; } /* variable */
.codehilite .o, .codehilite .ow { color: #35d0c0; } /* operator */
.codehilite .p { color: #9aa3b2; } /* punctuation */
.codehilite .mi, .codehilite .mf, .codehilite .mh, .codehilite .mo, .codehilite .m, .codehilite .il { color: #f5a97f; } /* numbers */
.codehilite .nt { color: #c58af0; } /* html tag */
.codehilite .na { color: #f0c674; } /* attribute */
.codehilite .err { color: #ff8b8b; }
.codehilite .gd { color: #ff8b8b; }
.codehilite .gi { color: #8fe3a6; }

/* ==========================================================================
   404
   ========================================================================== */

.error-404 {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
}
.error-404 h1 { margin-top: 0; }
.error-404 .muted { color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); }

/* ==========================================================================
   REVEAL ANIMATION
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.section-grid .reveal:nth-child(2) { animation-delay: 0.08s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }
  * { scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

/* ==========================================================================
   RESPONSIVE — sidebar collapses to a static top bar <= 880px
   ========================================================================== */

@media (max-width: 880px) {
  .main-content { padding-left: 0; }
  .site-footer { margin-left: 0; }

  .site-header {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border-strong);
    overflow-y: visible;
  }

  .site-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .nav-link {
    width: auto;
    padding: 8px 14px;
  }
  .nav-link[aria-current] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .container { padding: 32px 24px 60px; }

  .section-grid { grid-template-columns: 1fr; }

  .site-footer { padding: 20px 24px; }
}

@media (max-width: 560px) {
  .container { padding: 24px 18px 52px; }
  .card { padding: 20px; }
  .cta-group .btn { flex: 1 1 auto; }
  .lead { font-size: 1rem; }
}

@media (max-width: 400px) {
  body { font-size: 15px; }
  .site-header { padding: 14px 16px; }
  .container { padding: 20px 16px 48px; }
}


/* ==========================================================================
   Studio HOME — bento dashboard (index_studio.html)
   ========================================================================== */
.theme-studio .st-home { padding-top: 8px; }
.theme-studio .bento {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; grid-auto-rows: minmax(10px, auto); margin-top: 8px;
}
.theme-studio .bento-tile {
  background: #1b1e27; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; padding: 24px;
}
.theme-studio .bento-intro  { grid-column: span 4; }
.theme-studio .bento-writing { grid-column: span 2; grid-row: span 2; }
.theme-studio .bento-now     { grid-column: span 2; }
.theme-studio .bento-stack   { grid-column: span 2; }
.theme-studio .bento-profile { grid-column: span 4; }
.theme-studio .bento-label { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: #9aa3b2; margin: 0 0 14px; font-weight: 600; }
.theme-studio .bento-intro h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 6px 0 12px; }
.theme-studio .bento-lead { color: #c4cad6; font-size: 1.05rem; margin: 0 0 20px; max-width: 640px; }
.theme-studio .bento-now-line { display: flex; align-items: center; gap: 10px; font-weight: 600; color: #e7e9f0; margin: 0 0 8px; }
.theme-studio .bento-dot { width: 9px; height: 9px; border-radius: 50%; background: #35d0c0; box-shadow: 0 0 0 0 rgba(53,208,192,0.5); animation: stPulse 2.2s infinite; }
@keyframes stPulse { 0% { box-shadow: 0 0 0 0 rgba(53,208,192,0.45); } 70% { box-shadow: 0 0 0 9px rgba(53,208,192,0); } 100% { box-shadow: 0 0 0 0 rgba(53,208,192,0); } }
@media (prefers-reduced-motion: reduce) { .theme-studio .bento-dot { animation: none; } }
.theme-studio .bento-sub { color: #9aa3b2; font-size: 0.92rem; margin: 0; }
.theme-studio .bento-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.theme-studio .bento-chips li { font-size: 0.8rem; color: #c4cad6; padding: 6px 12px; border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; background: rgba(255,255,255,0.03); }
.theme-studio .bento-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.theme-studio .bento-feed li { padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.theme-studio .bento-feed li:last-child { border-bottom: none; padding-bottom: 0; }
.theme-studio .bento-feed-title { display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.05rem; color: #e7e9f0; background: none; }
.theme-studio .bento-feed-title:hover { color: #35d0c0; }
.theme-studio .bento-feed-date { display: block; font-size: 0.78rem; color: #9aa3b2; margin: 4px 0; }
.theme-studio .bento-feed-sum { font-size: 0.92rem; color: #aab2c0; margin: 0; }
.theme-studio .bento-all { display: inline-block; margin-top: 16px; color: #35d0c0; font-weight: 600; font-size: 0.85rem; }
.theme-studio .bento-profile-body h2 { font-size: 1.15rem; margin: 1.1em 0 0.4em; }
.theme-studio .bento-profile-body h2:first-child { margin-top: 0; }
.theme-studio .bento-profile-body p, .theme-studio .bento-profile-body li { color: #c4cad6; }
@media (max-width: 1040px) {
  .theme-studio .bento-intro, .theme-studio .bento-writing, .theme-studio .bento-now,
  .theme-studio .bento-stack, .theme-studio .bento-profile { grid-column: span 4; grid-row: auto; }
}
