/* Self-hosted brand font (Century Gothic). */
@font-face {
  font-family: "Century Gothic";
  src: url("gothic.woff") format("woff");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Century Gothic";
  src: url("gothicbold.woff") format("woff");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #081C26;
  --red: #A91436;
  --paper: #E5E1E6;
  --paper-2: #efedf0;
  --white: #fbfafb;
  --line: rgba(8, 28, 38, 0.12);
  --sidebar-w: 264px;
  --brand: "Century Gothic", "Jost", CenturyGothic, "URW Gothic", "Futura", "Trebuchet MS", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px rgba(8,28,38,.06), 0 12px 32px rgba(8,28,38,.08);
}

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

html { -webkit-text-size-adjust: 100%; background: var(--ink); overscroll-behavior-y: none; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior-y: none;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--brand); font-weight: 500; line-height: 1.1; margin: 0; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100dvh;
  width: var(--sidebar-w);
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.75rem;
  z-index: 50;
}

.brand { display: inline-flex; color: var(--paper); }
.avatar {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(229,225,230,.35);
  background: #0d2733;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.brand:hover .avatar, .brand:focus-visible .avatar { border-color: var(--red); transform: scale(1.03); }
.brand:focus-visible { outline: none; }
.avatar > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.nav { display: flex; flex-direction: column; gap: .15rem; margin-top: 3.5rem; }
.nav a {
  position: relative;
  font-size: .82rem; letter-spacing: .16em; text-transform: uppercase;
  padding: .7rem 0 .7rem .9rem;
  color: rgba(229,225,230,.65);
  transition: color .25s var(--ease);
}
.nav a::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 60%; background: var(--red); transition: transform .25s var(--ease);
}
.nav a:hover { color: var(--paper); }
.nav a.is-active { color: var(--paper); }
.nav a.is-active::before { transform: translateY(-50%) scaleY(1); }

.sidebar__foot { margin-top: auto; font-size: .7rem; letter-spacing: .05em; color: rgba(229,225,230,.4); }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: clamp(2rem, 5vw, 5rem);
  outline: none;
  min-width: 0;
}

/* Snappy view transition */
.view { animation: fade .28s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.page-head { margin-bottom: 2.5rem; }
.page-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: .04em; text-transform: uppercase;
}
.page-head .eyebrow { color: var(--red); font-size: .78rem; letter-spacing: .25em; text-transform: uppercase; margin-bottom: .6rem; }
.page-head p.lead { max-width: 52ch; color: rgba(8,28,38,.72); margin-top: 1rem; }

/* ---------- Projects grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  cursor: pointer;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow); outline: none; }
.card__img { aspect-ratio: 4/3; position: relative; overflow: hidden; }
.card__img svg, .card__img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card:hover .card__img svg, .card:hover .card__img img { transform: scale(1.04); }
.card__img svg, .card__img img { transition: transform .5s var(--ease); }
.card__body { padding: 1.1rem 1.2rem 1.4rem; }
.card__body h3 { font-size: 1.25rem; margin-bottom: .3rem; }
.card__meta { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.card__year { color: rgba(8,28,38,.5); }

/* ---------- Project detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: clamp(2rem, 4vw, 4rem); align-items: start; }
.detail__info .meta-row { display: flex; gap: 2rem; flex-wrap: wrap; margin: 1.5rem 0; padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail__info .meta-row div span { display: block; }
.detail__info .meta-row .k { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--red); margin-bottom: .2rem; }
.detail__info .meta-row .v { font-family: var(--brand); font-size: 1.05rem; }
.detail__info p { color: rgba(8,28,38,.78); }
.topics { list-style: none; margin: 1rem 0 0; padding: 0; }
.topics li { display: flex; align-items: baseline; gap: .6rem; padding: .3rem 0; font-family: var(--brand); font-size: 1.02rem; color: var(--ink); }
.topics li::before { content: ""; flex: 0 0 auto; width: 6px; height: 6px; background: var(--red); border-radius: 50%; transform: translateY(-2px); }
.detail__desc { margin: 1.25rem 0 1.75rem; }
.detail__desc p { color: rgba(8,28,38,.78); margin-bottom: .9rem; }
.detail__desc p:last-child { margin-bottom: 0; }
.detail__count { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin: .6rem 0 1.5rem; }
.sheet-list { list-style: none; margin: 0; padding: 1.25rem 0 0; border-top: 1px solid var(--line); counter-reset: sheet; }
.sheet-list li { counter-increment: sheet; display: flex; align-items: baseline; gap: .8rem; padding: .55rem 0; cursor: pointer; color: rgba(8,28,38,.62); border-bottom: 1px solid var(--line); transition: color .2s var(--ease); }
.sheet-list li::before { content: counter(sheet, decimal-leading-zero); font-family: var(--brand); font-size: .8rem; color: rgba(8,28,38,.4); min-width: 1.6em; }
.sheet-list li:hover { color: var(--ink); }
.sheet-list li.is-active { color: var(--red); }
.sheet-list li.is-active::before { color: var(--red); }
.detail__media .hero-img { border: 1px solid var(--line); background: var(--white); margin: 0; }
.detail__media .hero-img svg, .detail__media .hero-img img { width: 100%; height: auto; display: block; }
.detail__media .hero-img img { cursor: zoom-in; }
.detail__media .hero-img figcaption { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(8,28,38,.6); padding: .7rem .9rem; border-top: 1px solid var(--line); }
.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin-top: .8rem; }
.thumbs button { border: 1px solid var(--line); background: var(--white); padding: 0; cursor: pointer; aspect-ratio: 1; overflow: hidden; transition: border-color .2s var(--ease); }
.thumbs button.is-active { border-color: var(--red); }
.thumbs svg, .thumbs img { width: 100%; height: 100%; display: block; object-fit: cover; }

.back-link { display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 1.5rem; }
.back-link:hover { gap: .8rem; } .back-link { transition: gap .2s var(--ease); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.9fr); gap: clamp(2rem,4vw,4rem); align-items: start; }
.about__text p { color: rgba(8,28,38,.78); max-width: 54ch; }
.timeline { margin-top: 2.5rem; }
.timeline h2 { font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--red); font-family: "Inter", sans-serif; font-weight: 600; margin-bottom: 1rem; }
.timeline ul { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.timeline .yr { font-family: var(--brand); font-size: 1.1rem; color: var(--ink); }
.timeline .role { font-weight: 600; }
.timeline .org { color: rgba(8,28,38,.6); font-size: .92rem; }
.about__photo { position: sticky; top: 2rem; }
.about__photo .frame { background: var(--ink); border: 1px solid var(--line); overflow: hidden; }
.about__photo svg { width: 100%; height: auto; display: block; }

/* ---------- Contact ---------- */
.contact__grid { display: flex; flex-direction: column; gap: 1rem; margin: 2rem 0 3rem; }
.contact__item { display: inline-flex; align-items: center; gap: .9rem; font-size: 1.15rem; font-family: var(--brand); color: var(--ink); width: fit-content; }
.contact__item svg { width: 22px; height: 22px; color: var(--red); flex: 0 0 auto; }
.contact__item:hover { color: var(--red); }
.thanks { font-family: var(--brand); font-size: clamp(2.5rem, 7vw, 5rem); color: var(--red); letter-spacing: .02em; margin: 1rem 0 2rem; }
.signature { max-width: 340px; color: var(--ink); }
.signature svg { width: 100%; height: auto; }

/* ---------- Mobile components (hidden on desktop) ---------- */
.mobilebar, .tabbar, .menu-toggle { display: none; }

.avatar--sm { width: 40px; height: 40px; border-width: 1.5px; }

@media (max-width: 860px) {
  .detail, .about { grid-template-columns: 1fr; }
  .about__photo { position: static; order: -1; }

  /* Desktop sidebar off on mobile */
  .sidebar { display: none; }

  /* Top bar */
  .mobilebar {
    display: flex;
    align-items: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    padding: 0 1.1rem;
    padding-top: env(safe-area-inset-top);
    height: calc(60px + env(safe-area-inset-top));
    background: rgba(8, 28, 38, 0.9);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    z-index: 60;
  }
  .mobilebar__brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--paper); }
  .mobilebar__name {
    font-family: var(--brand); font-weight: 500; font-size: 1.05rem;
    letter-spacing: .06em; text-transform: uppercase; color: var(--paper);
  }

  /* Content sits between top bar and bottom tab bar */
  .main {
    margin-left: 0;
    padding: 1.75rem 1.25rem;
    padding-top: calc(60px + env(safe-area-inset-top) + 1.25rem);
    padding-bottom: calc(66px + env(safe-area-inset-bottom) + 1.25rem);
  }

  /* Bottom tab bar */
  .tabbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(8, 28, 38, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid rgba(229,225,230,.12);
    z-index: 60;
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    color: rgba(229,225,230,.6);
    font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
    transition: color .18s var(--ease);
    position: relative;
  }
  .tab svg { width: 24px; height: 24px; }
  .tab:active { color: var(--paper); }
  .tab.is-active { color: var(--paper); }
  .tab.is-active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red);
  }

  /* Snappier, lighter transition on mobile */
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page-head h1 { font-size: 2rem; }
  .thumbs { grid-template-columns: repeat(5, 1fr); gap: .4rem; }
  .detail__info .meta-row { gap: 1.25rem 2rem; }
}

/* ---------- Lightbox ---------- */
body.no-scroll { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(8, 28, 38, .92);
  opacity: 0; transition: opacity .2s var(--ease);
}
.lightbox.is-open { display: flex; opacity: 1; }
.lightbox__img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; cursor: zoom-out;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: lb-in .22s var(--ease);
}
@keyframes lb-in { from { transform: scale(.97); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.lightbox__close {
  position: absolute; top: clamp(.75rem, 2.5vw, 1.5rem); right: clamp(.75rem, 2.5vw, 1.5rem);
  width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(229,225,230,.12); color: var(--paper);
  border: 1px solid rgba(229,225,230,.25); border-radius: 50%;
  cursor: pointer; transition: background .18s var(--ease), transform .18s var(--ease);
}
.lightbox__close:hover, .lightbox__close:focus-visible { background: var(--red); border-color: var(--red); outline: none; transform: rotate(90deg); }
.lightbox__close svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox__img, .lightbox__close { transition: none; animation: none; }
}

