/* ==========================================================================
   Portfolio — shared stylesheet
   One file, no build step. Tokens at the top; everything else uses them.
   ========================================================================== */

:root {
  --bg:            #0f1113;
  --bg-raised:     #15181b;
  --border:        #22262b;
  --border-strong: #333940;

  --text:          #e4e7ea;
  --text-muted:    #949ca5;
  --text-faint:    #666d76;

  --accent:        #e8a34a;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;

  --measure:  70ch;    /* reading width for prose */
  --page:     980px;   /* max width of the content column */
  --sidebar:  228px;
  --header:   56px;
}

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

html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, video { max-width: 100%; display: block; }

/* --- layout primitives ---------------------------------------------------- */

.wrap  { max-width: var(--page); margin: 0 auto; padding: 0 1.75rem; }
.prose { max-width: var(--measure); }

section { padding: 3rem 0; }
section + section { border-top: 1px solid var(--border); }

/* --- typography ----------------------------------------------------------- */

h1, h2, h3 { line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.9rem, 3.6vw, 2.5rem); letter-spacing: -0.025em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; color: var(--text); }

p, ul, ol { margin: 0 0 1.15em; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }
li { margin-bottom: 0.35em; }

code {
  font-family: var(--font-mono); font-size: 0.86em;
  color: var(--text); background: var(--bg-raised);
  padding: 0.1em 0.35em; border-radius: 3px;
}

.lead    { font-size: 1.1rem; color: var(--text-muted); }
.eyebrow { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em;
           text-transform: uppercase; color: var(--text-faint); margin: 0 0 0.8rem; }
.muted   { color: var(--text-muted); }

/* --- site header ---------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between;
                     height: var(--header); gap: 2rem; max-width: none; }
.brand { font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: 1.3rem; font-size: 0.9rem; }
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* --- sidebar -------------------------------------------------------------- */

.sidebar {
  position: fixed; top: var(--header); left: 0; bottom: 0; width: var(--sidebar);
  padding: 2rem 1rem 2rem 1.75rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sitenav { font-size: 0.88rem; line-height: 1.5; }
.sitenav a { display: block; padding: 0.28rem 0; color: var(--text-muted); }
.sitenav a:hover { color: var(--text); text-decoration: none; }
.sitenav a[aria-current="page"] { color: var(--accent); }

.sitenav-root {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-faint) !important;
  padding-bottom: 0.9rem !important; margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.sitenav-root:hover { color: var(--text-muted) !important; }

.sitenav-category {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 1.4rem 0 0.4rem;
}
.sitenav-category:first-of-type { margin-top: 1rem; }

.sitenav-list, .sitenav-systems { list-style: none; margin: 0; padding: 0; }
.sitenav-project > a { color: var(--text); font-weight: 500; }
.sitenav-systems { margin: 0.15rem 0 1rem; padding-left: 0.9rem;
                   border-left: 1px solid var(--border); }
.sitenav-systems li { margin: 0; }

/* Content clears the fixed sidebar. */
@media (min-width: 1080px) {
  body { padding-left: var(--sidebar); }
}
@media (max-width: 1079px) {
  /* Breadcrumbs carry navigation on narrow screens. */
  .sidebar { display: none; }
}

/* --- meta strip ----------------------------------------------------------- */

.meta {
  display: flex; flex-wrap: wrap; gap: 0.9rem 2.25rem;
  margin: 1.6rem 0 0; padding: 1rem 0 0; list-style: none;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.meta dt { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
           text-transform: uppercase; color: var(--text-faint); margin-bottom: 0.1rem; }
.meta dd { margin: 0; color: var(--text-muted); }

/* --- breadcrumb ----------------------------------------------------------- */

.breadcrumb {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 0 0 0.9rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }

/* --- tags ----------------------------------------------------------------- */

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.tag {
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--text-faint); border: 1px solid var(--border);
  border-radius: 3px; padding: 0.15rem 0.45rem; margin: 0;
}

/* --- hero ----------------------------------------------------------------- */

.hero { padding: 3.5rem 0 2.5rem; }
.hero h1 { margin-bottom: 0.5rem; }

/* --- cards ---------------------------------------------------------------- */

.card-grid { display: grid; gap: 1px; background: var(--border);
             border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
             grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }

.card { display: flex; flex-direction: column; background: var(--bg);
        transition: background 0.15s ease; }
.card:hover { background: var(--bg-raised); text-decoration: none; }
.card-body { padding: 1.15rem 1.25rem 1.3rem; display: flex; flex-direction: column;
             gap: 0.55rem; flex: 1; }
.card-body h3 { margin: 0; }
.card-body p  { margin: 0; font-size: 0.9rem; color: var(--text-muted); flex: 1; }

/* Wide variant: project cards on the landing page, which keep a hero image. */
.card-grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr)); }
.card-grid--wide .card-body { padding: 1.35rem 1.5rem 1.5rem; }
.card-grid--wide .card-body h3 { font-size: 1.2rem; }
.card-thumb { aspect-ratio: 16 / 9; background: var(--bg-raised);
              border-bottom: 1px solid var(--border);
              display: grid; place-items: center;
              color: var(--text-faint); font-family: var(--font-mono); font-size: 0.7rem; }

.card--ghost { pointer-events: none; }
.card--ghost .card-thumb { opacity: 0.4; }
.card--ghost h3 { color: var(--text-faint); }

/* --- about --------------------------------------------------------------- */

.about { display: grid; gap: 2rem; align-items: start;
         grid-template-columns: 200px minmax(0, var(--measure)); }
.about-portrait {
  aspect-ratio: 4 / 5; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 4px;
  display: grid; place-items: center; padding: 0.75rem;
  color: var(--text-faint); font-family: var(--font-mono);
  font-size: 0.7rem; text-align: center; word-break: break-all;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; }
  .about-portrait { max-width: 200px; }
}

/* --- project groups ------------------------------------------------------- */

.project-group { margin-top: 2rem; }
.project-group + .project-group { margin-top: 3rem; }
.group-label {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 400;
  margin: 0 0 0.9rem;
}

/* --- media figures -------------------------------------------------------- */

figure { margin: 2rem 0; }
figure img, figure video { border: 1px solid var(--border); border-radius: 4px; width: 100%; }
.media-frame {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 4px;
  aspect-ratio: 16 / 9; display: grid; place-items: center;
  color: var(--text-faint); font-family: var(--font-mono); font-size: 0.76rem;
  text-align: center; padding: 1rem;
}
figcaption { margin-top: 0.7rem; font-size: 0.86rem; color: var(--text-muted);
             max-width: var(--measure); }

/* --- callout -------------------------------------------------------------- */

.callout {
  border-left: 2px solid var(--accent); background: var(--bg-raised);
  padding: 1rem 1.25rem; margin: 1.6rem 0; border-radius: 0 3px 3px 0;
  font-size: 0.95rem;
}

/* --- goals list ----------------------------------------------------------- */

.goals { list-style: none; margin: 1.4rem 0 0; padding: 0; }
.goals li { padding: 0.8rem 0; border-top: 1px solid var(--border); margin: 0; }
.goals li:last-child { border-bottom: 1px solid var(--border); }
.goals strong { display: block; color: var(--text); font-weight: 600; }
.goals span { color: var(--text-muted); font-size: 0.92rem; }

/* --- pager ---------------------------------------------------------------- */

.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
         padding: 2.5rem 0; border-top: 1px solid var(--border); margin-top: 1rem; }
.pager a { font-size: 0.9rem; color: var(--text-muted); }
.pager a:hover { color: var(--accent); text-decoration: none; }

/* --- footer --------------------------------------------------------------- */

.site-footer { padding: 2.5rem 0 3.5rem; border-top: 1px solid var(--border);
               color: var(--text-faint); font-size: 0.83rem; }
.site-footer .wrap { max-width: var(--measure); margin-left: auto; margin-right: auto; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-nav { gap: 1rem; font-size: 0.85rem; }
  section { padding: 2.25rem 0; }
  .hero { padding: 2.5rem 0 2rem; }
}
