/* ---------- tokens ---------- */
:root {
  --bg:        #F6F7F7;
  --surface:   #FFFFFF;
  --ink:       #14181A;
  --ink-soft:  #394245;
  --muted:     #5D686C;
  --line:      #E0E5E5;
  --line-soft: #EDF0F0;
  --accent:    #0E6E62;
  --accent-ink:#0B564C;
  --shadow:    0 1px 2px rgba(20,24,26,.05), 0 8px 24px rgba(20,24,26,.06);

  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --body: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: 22px;
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0E1214;
    --surface:   #161B1D;
    --ink:       #E7ECEC;
    --ink-soft:  #C6CFCF;
    --muted:     #93A0A3;
    --line:      #242B2E;
    --line-soft: #1C2224;
    --accent:    #4EC3B2;
    --accent-ink:#7BD8CA;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

:root[data-theme="dark"] {
  --bg:        #0E1214;
  --surface:   #161B1D;
  --ink:       #E7ECEC;
  --ink-soft:  #C6CFCF;
  --muted:     #93A0A3;
  --line:      #242B2E;
  --line-soft: #1C2224;
  --accent:    #4EC3B2;
  --accent-ink:#7BD8CA;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

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

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

/* ---------- masthead ---------- */
.masthead { padding-block: 56px 30px; }

.masthead h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(42px, 8vw, 68px);
  line-height: 1.02;
  letter-spacing: -.012em;
  margin: 0;
  text-wrap: balance;
}

.tagline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 17px;
  max-width: 44ch;
  text-wrap: pretty;
}

.masthead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 20px;
}

.masthead-links a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}
.masthead-links a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- nav ---------- */
.navbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
}

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 15px 10px 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.tab .count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: 5px;
  vertical-align: 1px;
}

.theme-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  width: 34px; height: 34px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  cursor: pointer;
}
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- sections ---------- */
main { padding-block: 38px 90px; min-height: 60vh; }
.section[hidden] { display: none !important; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.section-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -.01em;
  margin: 0;
}

.section-note { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0 6px; }

.chip {
  appearance: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  transition: all .15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip[aria-pressed="true"] {
  color: var(--surface);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- project rows ---------- */
.projects { margin-top: 20px; }

.project {
  display: grid;
  grid-template-columns: 92px minmax(0,1fr) 128px;
  gap: 26px;
  align-items: start;
  padding-block: 28px;
  border-top: 1px solid var(--line);
}
.project:last-child { border-bottom: 1px solid var(--line); }

.project-meta { display: flex; flex-direction: column; gap: 7px; padding-top: 5px; }
.project-year { color: var(--muted); }

.status {
  align-self: start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.status[data-s="active"], .status[data-s="ongoing"], .status[data-s="in progress"] {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.status[data-s="planned"] { border-style: dashed; }

.project h3 a { color: inherit; text-decoration: none; }
.project h3 a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); }

.project h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.008em;
  line-height: 1.3;
  text-wrap: balance;
}

.project p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  max-width: 62ch;
  text-wrap: pretty;
}

.project-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; }

.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.tag::before { content: "#"; opacity: .5; }

.project-links { display: flex; gap: 14px; flex-wrap: wrap; }
.project-links a {
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent-ink);
}
.project-links a::after { content: " \2192"; }
.project-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

.project-thumb {
  width: 128px;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- photos ---------- */
.photo-grid {
  margin-top: 24px;
  columns: 3;
  column-gap: 14px;
}
.photo-grid > * { break-inside: avoid; margin-bottom: 14px; }

.photo {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  text-align: left;
}
.photo img { width: 100%; height: auto; }
.photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}
.photo figcaption .date { font-family: var(--mono); font-size: 11px; flex: 0 0 auto; }
.photo:hover { border-color: var(--muted); }

/* generated stand-in for a photo that isn't there yet */
.ph {
  width: 100%;
  aspect-ratio: var(--ratio, 4 / 3);
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- videos ---------- */
.video-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px 24px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.video-facade {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  position: relative;
  background: var(--surface);
}
.video-facade img { width: 100%; height: 100%; object-fit: cover; }

.play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(8,12,14,0) 45%, rgba(8,12,14,.45) 100%);
}
.play span {
  width: 58px; height: 40px;
  border-radius: 9px;
  background: rgba(16,20,22,.74);
  display: grid; place-items: center;
  transition: background .15s ease, transform .15s ease;
}
.play svg { width: 17px; height: 17px; fill: #fff; margin-left: 2px; }
.video-facade:hover .play span { background: #C32B22; transform: scale(1.05); }

.video h3 {
  margin: 13px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1.35;
  text-wrap: balance;
}
.video p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 54ch; text-wrap: pretty; }
.video .date { display: block; margin-top: 9px; color: var(--muted); }

/* ---------- about ---------- */
.about { margin-top: 26px; max-width: 62ch; }
.about p { margin: 0 0 18px; font-size: 17px; color: var(--ink-soft); text-wrap: pretty; }

/* ---------- empty state ---------- */
.empty {
  margin-top: 24px;
  padding: 34px 24px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.empty code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8,11,12,.93);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px));
}
.lightbox[hidden] { display: none !important; }
.lightbox-stage { display: grid; place-items: center; min-height: 0; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 3px; }
.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  color: #C9D2D3;
  font-size: 14px;
}
.lb-btn {
  appearance: none;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  color: #EAF0F0;
  border-radius: 999px;
  width: 36px; height: 36px;
  flex: 0 0 auto;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
  line-height: 1;
}
.lb-btn:hover { background: rgba(255,255,255,.16); }
.lb-nav { display: flex; gap: 8px; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding-block: 26px 40px;
  color: var(--muted);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .photo-grid { columns: 2; }
  .project { grid-template-columns: 78px minmax(0,1fr); gap: 20px; }
  .project-thumb { grid-column: 2; width: 100%; max-width: 260px; aspect-ratio: 16/9; margin-top: 16px; }
}

@media (max-width: 560px) {
  :root { --gutter: 18px; }
  .photo-grid { columns: 1; }
  .masthead { padding-block: 38px 22px; }
  .project { grid-template-columns: minmax(0,1fr); gap: 0; padding-block: 24px; }
  .project-meta { flex-direction: row; align-items: center; gap: 10px; padding-top: 0; margin-bottom: 10px; }
  .project-thumb { grid-column: 1; }
  .video-grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

[hidden] { display: none !important; }

/* ============================================================
   PROJECT PAGE
   ============================================================ */

.nav-right { display: flex; align-items: center; gap: 14px; }

.sitemark {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.sitemark:hover { color: var(--accent-ink); }

.backlink {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.backlink:hover { color: var(--accent-ink); }

.navbar .nav-inner { padding-block: 9px; }

/* ---------- header ---------- */
.project-head { padding-block: 46px 6px; max-width: 46rem; }

.project-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
  color: var(--muted);
}

.project-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 0;
  text-wrap: balance;
}

.project-lede {
  margin: 16px 0 0;
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 44ch;
  text-wrap: pretty;
}

.head-links { margin-top: 20px; }

/* ---------- facts ---------- */
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 34px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fact {
  padding: 16px 28px 16px 0;
  margin-right: 28px;
  border-right: 1px solid var(--line-soft);
}
.fact:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.facts dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 5px 0 0;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---------- blocks ---------- */
.block { margin-top: 52px; }

.block-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.prose { max-width: 62ch; }
.prose p { margin: 0 0 18px; font-size: 17px; color: var(--ink-soft); text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- demo ---------- */
.demo-frame {
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--ratio, 16 / 10);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.demo-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.demo-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- log ---------- */
.log { display: grid; }

.log-entry {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 28px;
  padding-block: 28px;
  border-bottom: 1px solid var(--line-soft);
}
.log-entry:first-child { padding-top: 6px; }
.log-entry:last-child { border-bottom: 0; }

.log-date { color: var(--muted); padding-top: 5px; white-space: nowrap; }

.log-body h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1.3;
}
.log-body p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  max-width: 60ch;
  text-wrap: pretty;
}

.log-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.log-photo {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
}
.log-photo:hover { border-color: var(--muted); }
.log-photo img, .log-photo .ph { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

/* ---------- prev / next ---------- */
.project-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.project-nav a {
  display: block;
  max-width: 46%;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.project-nav a:hover { color: var(--accent-ink); }
.project-nav a.to-next { text-align: right; }
.project-nav .mono {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

/* ---------- lightbox nav group ---------- */
.lb-nav-wrap { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.lb-nav-wrap[hidden] { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .project-head { padding-block: 32px 4px; }
  .log-entry { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .log-date { padding-top: 0; margin-bottom: 8px; }
  .fact { padding-right: 20px; margin-right: 20px; }
  .log-photos { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .project-nav a { max-width: 48%; font-size: 15px; }
}
