/* ===== Shared styles for every page ===== */
:root {
  --bg: #f6f5f1; --surface: #ffffff; --ink: #16181d; --muted: #5d6370; --line: #e2e0d8;
  --accent: #0e7c66; --accent-soft: #e2f3ee;
  --warn: #a15c07; --warn-soft: #fbefdc;
  --plan: #4a5bb8; --plan-soft: #e7eaf9;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114; --surface: #171a1f; --ink: #e8e9ec; --muted: #9aa1ad; --line: #262a31;
    --accent: #3ccfa9; --accent-soft: #12302a; --warn: #f0b062; --warn-soft: #33260f;
    --plan: #95a3f0; --plan-soft: #1d2140;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1114; --surface: #171a1f; --ink: #e8e9ec; --muted: #9aa1ad; --line: #262a31;
  --accent: #3ccfa9; --accent-soft: #12302a; --warn: #f0b062; --warn-soft: #33260f;
  --plan: #95a3f0; --plan-soft: #1d2140;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* ---- nav ---- */
header.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
header.nav .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav a { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 6px; }
nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface); }
nav a.active { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
#theme { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 4px 8px; margin-left: 6px; cursor: pointer; font-size: 13px; }
@media (max-width: 560px) { header.nav .wrap { padding-top: 8px; padding-bottom: 8px; } }

/* ---- page headers ---- */
.page-head { padding: 64px 0 32px; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: .04em; }
.page-head h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.15; margin: 10px 0 12px; letter-spacing: -.02em; }
.page-head p { font-size: 17px; color: var(--muted); max-width: 660px; margin: 0; }
.hero h1 { font-size: clamp(34px, 6vw, 54px); }

section { padding: 40px 0; border-top: 1px solid var(--line); }
h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 24px; }

.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 500; font-size: 15px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* ---- project cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; }
.card.featured { grid-column: 1 / -1; border-color: var(--accent); }
.card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card .ctx { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card p { margin: 12px 0 14px; color: var(--muted); font-size: 15px; }
.card ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.card ul li { margin-bottom: 4px; }
.card .links { margin: 0 0 14px; font-size: 14px; }
.card img { width: 100%; border-radius: 8px; margin-top: 12px; border: 1px solid var(--line); }
/* two-photo strip inside a card */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 14px; }
.shots a { display: block; }
.shots img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin: 0; display: block; background: #fff; }
.shots img.fit { object-fit: contain; }
.card.featured .shots img { aspect-ratio: 16 / 9; }
/* demo video button */
.demo { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); margin: 0 8px 14px 0; align-self: flex-start; }
.demo:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.demo::before { content: "▶"; font-size: 11px; color: var(--accent); }
/* semester labels on the school page */
.term { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 28px 0 12px; }
.term:first-of-type { margin-top: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.status { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; font-weight: 600; }
.s-active { background: var(--accent-soft); color: var(--accent); }
.s-build  { background: var(--warn-soft);   color: var(--warn); }
.s-plan   { background: var(--plan-soft);   color: var(--plan); }

/* ---- home tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .k { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.tile h3 { margin: 6px 0 6px; font-size: 18px; }
.tile p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---- timeline (experience / education) ---- */
.exp { display: grid; gap: 22px; }
.exp .item { display: grid; grid-template-columns: 180px 1fr; gap: 20px; }
.exp .when { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; }
.exp h3 { margin: 0 0 4px; font-size: 17px; }
.exp h3 small { font-weight: 400; color: var(--muted); font-size: 15px; }
.exp p { margin: 0; color: var(--muted); font-size: 15px; }
.exp ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14.5px; }
@media (max-width: 640px) { .exp .item { grid-template-columns: 1fr; gap: 2px; } }

/* ---- skills / about boxes ---- */
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.boxes div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.boxes h4 { margin: 0 0 8px; font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600; }
.boxes p { margin: 0; font-size: 14.5px; color: var(--muted); }
.prose p { color: var(--muted); font-size: 16px; max-width: 700px; }

footer { padding: 28px 0 40px; color: var(--muted); font-size: 13px; font-family: var(--mono); border-top: 1px solid var(--line); }

/* ---- home hero with photo ---- */
.hero-split { display: grid; grid-template-columns: 1fr 260px; gap: 48px; align-items: center; }
.hero-photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); display: block; }
@media (max-width: 760px) {
  .hero-split { grid-template-columns: 1fr; gap: 24px; }
  .hero-photo { width: 160px; order: -1; border-radius: 50%; aspect-ratio: 1; object-position: 50% 30%; }
}

/* ---- contact grid (about page) ---- */
.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.contact { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; cursor: pointer; min-width: 0; }
.contact:hover { text-decoration: none; border-color: var(--accent); }
.contact .k { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.contact .v { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.contact .hint { font-size: 12px; color: var(--muted); }

/* ---- gallery ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters button { font-family: var(--mono); font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.gallery { columns: 3 280px; column-gap: 16px; }
.shot { break-inside: avoid; margin: 0 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.shot img { width: 100%; display: block; }
.shot figcaption { padding: 10px 14px; font-size: 13.5px; color: var(--muted); }
.shot[hidden] { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 8px; }
.lb-cap { color: #ddd; font-size: 14px; margin: 12px 0 0; text-align: center; }
.lb-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; color: #fff; font-size: 36px; line-height: 1; cursor: pointer; }

/* ---- mobile menu (three line button) ---- */
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 4px 10px; font-size: 18px; line-height: 1.2; cursor: pointer; }
@media (max-width: 700px) {
  header.nav .wrap { padding-top: 8px; padding-bottom: 8px; }
  .menu-btn { display: block; }
  header.nav nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 0 4px; }
  header.nav.open nav { display: flex; }
  header.nav nav a { padding: 10px 12px; font-size: 16px; }
  header.nav nav a.active { border: 0; }
  #theme { align-self: flex-start; margin: 6px 0 4px 12px; }
}

/* grids that stay at 2 cards per row (1 on phones) */
.grid.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .grid.two { grid-template-columns: 1fr; } }

/* ---- day/night theme switch ---- */
/* By Open Source Coding */
body { transition: background-color .5s ease, color .5s ease; }
#theme.dlswitch { position: relative; width: 60px; height: 28px; padding: 0; margin-left: 8px; border: 0; border-radius: 999px; overflow: hidden; cursor: pointer; flex-shrink: 0;
  background: linear-gradient(to bottom, #73bbff, #a2d1fd); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55); }
#theme.dlswitch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#theme.dlswitch span { position: absolute; pointer-events: none; }
.dl-night { inset: 0; border-radius: 999px; background: linear-gradient(to top, #2b3347, #181d27); box-shadow: inset 0 0 0 1.5px #6c7384; opacity: 0; transition: opacity .5s ease; }
.dl-stars { top: 6px; left: 8px; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 7px 9px 0 0 #fff, 14px 2px 0 -.5px #fff, 20px 13px 0 0 #fff, 4px 16px 0 -.5px #fff, 26px 5px 0 -.5px #fff;
  opacity: 0; transform: translateY(-14px); transition: all .5s ease; }
.dl-clouds { right: 9px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: #fff;
  box-shadow: -9px 4px 0 -1px #fff, 8px 3px 0 1px #fff, -17px 8px 0 -2px #fff, 1px 8px 0 2px #fff, 14px 9px 0 1px #f2f8ff;
  transition: all .6s ease; }
.dl-orb { top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; z-index: 2; overflow: hidden;
  background: #FFC187; box-shadow: 0 0 8px #FFC187, inset -2px -2px 4px #ffab5c; transition: all .5s ease; }
.dl-crater { top: 4px; left: 11px; width: 5px; height: 5px; border-radius: 50%; background: #b9c2d6;
  box-shadow: -6px 7px 0 1px #b9c2d6, 1px 11px 0 -1px #b9c2d6; opacity: 0; transition: opacity .5s ease; }
#theme.is-dark .dl-night { opacity: 1; }
#theme.is-dark .dl-stars { opacity: 1; transform: none; }
#theme.is-dark .dl-clouds { transform: translate(30px, 12px); opacity: 0; }
#theme.is-dark .dl-orb { left: calc(100% - 25px); background: #dee5f3; box-shadow: 0 0 10px rgba(222,229,243,.8), inset -2px -2px 4px #c3cbdc; }
#theme.is-dark .dl-crater { opacity: 1; }
