/* Shared styles for every page */
/* Day (light) theme */
:root {
  --bg: #f6f3ec;
  --ink: #1f1d1a;
  --muted: #6f695f;
  --ground: #d9d2c3;
  --ground-fill: #ece6d6;
  --ground-edge: #cfc6ae;
  --accent: #4a86c8;
  --accent-ink: #2f5f94;
  --on-accent: #ffffff;
  --card: #ffffff;
  --soft: #eef4fb;
  --user-bubble: #fff4d6;
  --pixel: 'Press Start 2P', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
/* Night (dark) theme: chosen with the toggle, or following the system setting */
:root[data-theme="dark"] {
  --bg: #151a2b;
  --ink: #ebe5d5;
  --muted: #a3a8bd;
  --ground: #2d3550;
  --ground-fill: #1b2133;
  --ground-edge: #2d3550;
  --accent: #7fb0e8;
  --accent-ink: #a8c9f0;
  --on-accent: #10131f;
  --card: #1e2438;
  --soft: #22304d;
  --user-bubble: #3a3423;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151a2b; --ink: #ebe5d5; --muted: #a3a8bd; --ground: #2d3550;
    --ground-fill: #1b2133; --ground-edge: #2d3550; --accent: #7fb0e8; --accent-ink: #a8c9f0;
    --on-accent: #10131f; --card: #1e2438; --soft: #22304d; --user-bubble: #3a3423;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  transition: background-color .8s ease, color .8s ease;
}
a { color: var(--accent-ink); }

/* Day / night toggle */
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--pixel); font-size: 9px; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); padding: 6px 9px;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.theme-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.theme-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.theme-btn svg { width: 14px; height: 14px; display: block; }
@media (max-width: 600px) { .theme-btn .m { display: none; } }

/* ---------- Content pages ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 28px 16px 120px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-family: var(--pixel); font-size: 10px; margin-bottom: 48px; flex-wrap: wrap;
}
.topbar a { color: var(--ink); text-decoration: none; }
.topbar a:hover { color: var(--accent); }
.topbar nav { display: flex; gap: 18px; align-items: center; }
@media (max-width: 600px) { .topbar nav { gap: 10px; font-size: 8px; } }
.back::before { content: '← '; }

.eyebrow { font-family: var(--pixel); font-size: 10px; color: var(--accent); margin-bottom: 14px; }
h1 { font-family: var(--pixel); font-size: clamp(20px, 4.5vw, 32px); line-height: 1.4; margin-bottom: 16px; }
.tagline { font-size: 18px; color: var(--muted); line-height: 1.55; margin-bottom: 20px; }
h2 {
  font-family: var(--pixel); font-size: 12px; margin: 44px 0 14px;
  padding-bottom: 10px; border-bottom: 3px solid var(--ink);
}
p, li { font-size: 16px; line-height: 1.65; }
p + p { margin-top: 12px; }
ul { padding-left: 20px; }
li + li { margin-top: 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12px; font-weight: 500; padding: 4px 9px;
  border: 2px solid var(--ink); background: var(--card);
}

.stats { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 3px solid var(--ink); padding: 14px; }
.stat b { display: block; font-family: var(--pixel); font-size: 18px; margin-bottom: 8px; color: var(--accent-ink); }
.stat span { font-size: 13px; color: var(--muted); line-height: 1.4; }

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; padding-left: 40px; position: relative; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 2px;
  width: 26px; height: 26px; display: grid; place-items: center;
  font-family: var(--pixel); font-size: 10px; background: var(--ink); color: var(--bg);
}

.btn {
  display: inline-block; font-family: var(--pixel); font-size: 10px; text-decoration: none;
  padding: 11px 14px; border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 18px; }

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 3px solid var(--ink); padding: 18px;
  box-shadow: 5px 5px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.card h3 { font-family: var(--pixel); font-size: 12px; line-height: 1.5; }
.card p { font-size: 14px; color: var(--muted); line-height: 1.5; flex: 1; }
.card .more { font-family: var(--pixel); font-size: 9px; color: var(--accent); }

.note {
  background: var(--soft); border: 2px dashed var(--accent); padding: 12px 14px;
  font-size: 14px; color: var(--muted);
}

.footer-ground {
  position: fixed; left: 0; right: 0; bottom: 0; height: 28px;
  border-top: 4px solid var(--ground); background: var(--bg); z-index: -1;
}

/* Photos, videos and galleries */
.media { margin: 22px 0; }
.media img, .media video {
  display: block; width: 100%; height: auto; background: var(--soft);
  border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
}
.media video { aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.media figcaption { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 8px; }
.gallery .media { margin: 0; }
.gallery .media img { aspect-ratio: 1; object-fit: cover; }
.gallery .media a:hover img { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.gallery .media img { transition: transform .1s, box-shadow .1s; }
p + ul, p + ol { margin-top: 10px; } ul + p, ol + p { margin-top: 12px; }
/* Embedded YouTube player (16:9) */
.yt { position: relative; aspect-ratio: 16 / 9; background: #000; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
h3.sub { font-family: var(--pixel); font-size: 10px; line-height: 1.6; margin: 28px 0 10px; color: var(--accent-ink); }
/* About: photo next to the intro */
.bio { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.bio img { width: 100%; height: auto; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
@media (max-width: 600px) { .bio { grid-template-columns: 1fr; } .bio img { max-width: 260px; } }
/* Taller gallery tiles for portrait photos, and phone-shaped video */
.gallery.tall .media img { aspect-ratio: 3 / 4; object-fit: cover; }
.phone-video { max-width: 340px; }
.phone-video .media video { aspect-ratio: 9 / 16; }
