/* ==========================================================================
   Gabriel Ralls — shared site stylesheet
   Extracted from the approved index.html reference implementation.
   Every page (Home, About, Projects, Board advisor, Contact) links this file
   so components stay in one place. See ../handoff-brief.md for the design
   system this codifies.
   ========================================================================== */

@font-face {
  font-family: 'Linux Libertine';
  src: url('../fonts/LinLibertine_R.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Linux Libertine';
  src: url('../fonts/LinLibertine_RB.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Linux Libertine';
  src: url('../fonts/LinLibertine_RI.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Linux Libertine';
  src: url('../fonts/LinLibertine_RBI.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root{
  --red: #6E0408;
  --black: #08080C;
  --white: #ffffff;
  --grid: 160px;
  --font-head: 'Baskervville', 'Baskerville', Georgia, serif;
  --font-body: 'Linux Libertine', 'EB Garamond', Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 400;
  margin: 0;
}

/* ---------- Hamburger ---------- */
.menu-toggle {
  position: fixed;
  top: 40px;
  right: var(--grid);
  z-index: 200;
  width: 40px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--white);
  transition: transform .3s ease, opacity .3s ease;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(12px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-12px) rotate(-45deg); }

/* Nav overlay — slides in from the right at 80% width, red at 85% opacity
   so the page underneath (hero / main bg) bleeds through the uncovered strip */
.nav-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80%;
  background: rgba(110, 4, 8, 0.85);
  backdrop-filter: blur(2px);
  z-index: 150;
  transform: translateX(100%);
  transition: transform .45s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.nav-overlay.open { transform: translateX(0); }
.nav-overlay ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.5vh, 28px);
}
.nav-overlay li { width: 100%; }
.nav-overlay a {
  display: block;
  width: 100%;
  font-family: var(--font-head);
  font-size: clamp(48px, 8.5vw, 118px);
  line-height: 1.05;
  color: var(--white);
  text-decoration: none;
  text-align: right;
  padding: 4px var(--grid) 4px 24px;
  transition: background .2s ease, color .2s ease;
}
.nav-overlay a:hover {
  background: var(--black);
  color: var(--white);
}
/* No "current page" treatment — every link behaves identically; state is
   conveyed by hover only. See handoff-brief.md. */

/* ---------- Hero / header ---------- */
header.hero {
  position: relative;
  height: 55vh;
  min-height: 420px;
  overflow: hidden;
  background: linear-gradient(160deg, #4a3f3f 0%, #5c4d4d 55%, #4a3f3f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Gradient is the fallback behind the hero video (shows while the video
   loads, or if JS is off). The video itself is added by js/site.js. */

/* Optional per-project hero override (project pages only) — add a
   `.hero-media` element (img or video) inside header.hero and it covers the
   gradient; omit it and the standard gradient shows through untouched. Sits
   below hero-inner in paint order via z-index. */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  will-change: transform;
}
.hero-media img,
.hero-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Dark tint over any hero image/video so the white title stays readable
   on bright footage. Raise/lower the last value (0–1) to taste. */
.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.45);
}
.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 40px;
  will-change: transform, opacity;
}
.hero-inner h1 {
  font-size: 84px;
  letter-spacing: .01em;
}
/* Soft shadow (not a hard outline) behind the hero text for extra
   contrast on the brightest parts of the video. */
.hero-inner h1,
.hero-inner p {
  text-shadow: 0 2px 18px rgba(0, 0, 0, .75), 0 1px 3px rgba(0, 0, 0, .6);
}
.hero-rule { box-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.hero-rule {
  width: 220px;
  height: 2px;
  background: var(--white);
  margin: 18px auto;
}
.hero-inner p {
  font-family: var(--font-body);
  font-size: 22px;
  margin: 0;
}

/* ---------- Sticky breadcrumb ---------- */
.breadcrumb {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--red);
  padding: 14px var(--grid);
}
.breadcrumb h2 { font-size: 22px; }
/* Trail style, e.g. "Home / Projects" or "Home / Projects / Project title" —
   every crumb but the last is a link; the last is the current page (plain text).
   Hover fills black, same interaction language as the nav overlay / filter tags. */
.breadcrumb a {
  color: inherit;
  text-decoration: none;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background .2s ease, color .2s ease;
}
.breadcrumb a:hover,
.breadcrumb a:focus-visible {
  background: var(--black);
  color: var(--white);
  outline: none;
}

/* ---------- Main content ---------- */
main {
  background: var(--black);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid);
  padding: var(--grid);
  align-items: start;
}

/* Modifier for pages with no photo panel (e.g. Contact) — single centered column.
   Not in the original index.html; added for pages that don't pair with an image. */
main.main--single {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin: 0 auto;
}

/* Modifier for pages where the text panel should dominate over the photo
   (Home, About) — 2:1 rather than an even 1:1 split. */
main.main--wide-text {
  grid-template-columns: 2fr 1fr;
}

/* Utility: anchor object-fit crop to the top of the source image instead of
   centering, so a portrait's face stays intact when its container gets
   wider/shorter than the source photo (crops from the bottom instead). */
/* Left-column stack of several .bio-panel blocks (About) — keeps them all
   in the text column beside the photo instead of auto-flowing into the
   photo's column. Same 32px rhythm as the project-page stacks. */
.bio-stack {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
/* The photo beside a .bio-stack keeps its normal 640px height at the top
   of the column, rather than stretching to the full stack height (which
   made a very tall, thin crop). */
.bio-stack + .photo-panel {
  align-self: start;
}

.object-top {
  object-position: center top;
}

.bio-panel {
  background: var(--red);
  padding: 64px;
}
.bio-panel h2 { font-size: 46px; margin-bottom: 28px; }
.bio-panel h3 { margin-bottom: 20px; }
.bio-panel p { margin: 0 0 20px; }
.bio-panel .lede { margin-bottom: 4px; }

a.linkbox {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
  padding: 0 2px;
  transition: background .2s ease, color .2s ease;
}
a.linkbox:hover,
a.linkbox:focus-visible {
  background: var(--white);
  color: var(--black);
  outline: none;
}

.photo-panel {
  position: relative;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 640px;
  align-self: stretch;
}
.photo-panel img,
.photo-panel video,
.photo-panel iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}

/* Modifier: show the image/video at its own natural aspect ratio instead of
   cropping to fill the box — e.g. a portrait photo, screenshot, or poster
   where cover-cropping would cut something important off. Add alongside
   .photo-panel: class="photo-panel photo-panel--natural". The box then just
   wraps the media's own proportions (within the column width) rather than
   forcing it into a fixed ratio. */
.photo-panel--natural {
  display: block;
  min-height: 0;
  aspect-ratio: auto;
}
.photo-panel--natural img,
.photo-panel--natural video,
.photo-panel--natural iframe {
  position: static;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.photo-placeholder {
  /* Bumped from .4 — at .4 this read as illegible ("black on black") against
     the panel's solid --black background before a real image is added. */
  color: rgba(255,255,255,.6);
  font-size: 14px;
  text-align: center;
  letter-spacing: .04em;
}

/* ---------- Projects page: intro + filter + card grid ----------
   New for the Projects page design. Reuses .bio-panel (red bg, 64px pad,
   46px h2) for the intro and filter panels rather than inventing a new
   panel style. main.projects-layout overrides the base 2-col `main` grid
   with a 3-column one: intro spans 2/3, filter spans 1/3, and each
   project-card (added after them in markup) auto-flows 3-per-row below —
   this is what gives the "grid is 160px apart" gap on all sides. */
main.projects-layout {
  grid-template-columns: repeat(3, 1fr);
}
/* Card grid — its own nested grid (rather than the page-level --grid
   gutter) so cards sit 20px apart. grid-auto-rows: 1fr makes every row
   as tall as the tallest card, so all cards are the same size as each
   other at any viewport width (titles wrapping to 1 vs 3 lines no longer
   make some rows shorter). Columns step 3 → 2 → 1 in the media queries. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 20px;
}
.bio-panel.span-2 { grid-column: span 2; }

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
}
/* Rest state matches the homepage linkbox exactly (black bg/white text) so
   it reads as "this is a link" at all times, not just on interaction.
   Hover AND the toggled/selected state both flip to white/black — same
   single "engaged" look linkbox uses for its own hover, so a selected
   filter and a hovered one never need to be told apart. */
.filter-tag {
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 2px 10px;
  margin: 0;
  font-family: var(--font-head);
  font-size: 20px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.filter-tag:hover,
.filter-tag.active {
  background: var(--white);
  color: var(--black);
}
.filter-tag:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.project-card {
  background: var(--red);
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  transition: background .2s ease;
}
.project-card:hover,
.project-card:focus-visible {
  background: #82090d;
  outline: none;
}
.project-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Placeholder swatch standing in for a real project thumbnail. */
  background: #cbb8b8;
}
.project-card__body {
  padding: 24px 28px 28px;
  flex: 1;
}
.project-card__body h3 {
  font-size: 30px;
  margin-bottom: 10px;
}
.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 15px;
  color: rgba(255,255,255,.85);
}

/* Shown when the selected filters match zero cards — filter results can be
   many, one, or none, so this can't just be left blank. */
.project-grid__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px var(--grid);
  color: rgba(255,255,255,.6);
  font-size: 18px;
}

/* ---------- Project detail page (one level under Projects) ----------
   main.project-layout is the base 2-col `main` grid (display/gap/padding
   inherited) with the column ratio changed to 2:1 — left column is a stack
   of content panels (.project-content), right is a stack of image/video
   panels (.project-media). Each stack uses its own tighter 32px rhythm,
   independent of the page-level --grid gutter between the two columns. */
main.project-layout {
  grid-template-columns: 2fr 1fr;
}
.project-content,
.project-media {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* First panel: Client/Agency/Role/Year — reuses .bio-panel but with tighter
   line spacing suited to a short label:value list rather than prose. */
.project-meta p { margin: 0 0 6px; }
.project-meta p:last-child { margin-bottom: 0; }

/* Body sections ("Header", "Header 2", ...) — plain .bio-panel reuse.
   Any project-block beyond the first is optional; delete the whole
   <section> to drop it, nothing else needs to change. */

/* Right column media stack — reuses .photo-panel (black bg, absolute
   inset img/video, "no image yet" placeholder text) rather than a new
   component, just swapped from "one tall panel" to "several shorter ones". */
.project-media .photo-panel {
  min-height: 0;
  aspect-ratio: 3 / 2;
  align-self: auto;
}
/* .photo-panel--natural overrides the fixed 3:2 ratio above when used on a
   project media item — see the modifier's own comment further up. */
.project-media .photo-panel--natural {
  aspect-ratio: auto;
}
/* Each media item is an image/video + its own optional caption, grouped so
   the 32px rhythm from .project-media separates one item from the next,
   while the image and its own caption sit close together (10px). Also the
   mobile reorder unit — order goes on .project-media__item here so a
   caption always travels with its image. */
.project-media__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Caption below each media item — regular paragraph-size body text, not the
   dim .photo-placeholder label above the swatch. */
.project-media__caption {
  margin: 0;
  font-size: 17px;
  color: rgba(255,255,255,.85);
}

/* ---------- About page: Clients panel ----------
   Full-width panel below the bio/photo pair, visually echoing the Projects
   page's Filter panel (grouped chip lists) but static — plain <span>s, no
   button/hover/click behaviour, since nothing here is interactive. */
.span-full { grid-column: 1 / -1; }

.clients-category + .clients-category { margin-top: 32px; }
.clients-category h3 { font-size: 24px; margin-bottom: 14px; }

.client-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
}
.client-tag {
  font-family: var(--font-head);
  font-size: 20px;
  color: var(--white);
  padding: 2px 10px;
}

/* ---------- Contact page: form ----------
   Inputs/textarea styled to sit inside a .bio-panel (dark, on red) rather
   than as default browser chrome. */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}
.contact-form label {
  display: block;
  font-family: var(--font-head);
  font-size: 18px;
  margin-bottom: 8px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  background: var(--black);
  color: var(--white);
  border: 1px solid rgba(255,255,255,.3);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--white);
}
.contact-form textarea {
  resize: vertical;
  min-height: 160px;
}
.contact-form button[type="submit"] {
  align-self: flex-start;
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 12px 28px;
  font-family: var(--font-head);
  font-size: 20px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.contact-form button[type="submit"]:hover,
.contact-form button[type="submit"]:focus-visible {
  background: var(--white);
  color: var(--black);
  outline: none;
}
.contact-form__note {
  font-size: 14px;
  color: rgba(255,255,255,.6);
  margin: 0;
}

/* ---------- Footer ---------- */
footer {
  background: var(--red);
  padding: 12px var(--grid);
  font-size: 14px;
}
footer p { margin: 0; line-height: 1.3; }

/* ---------- Responsive (initial pass — flag priorities before refining) ---------- */
@media (max-width: 1200px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --grid: 32px; }
  .hero-inner h1 { font-size: 48px; }
  .hero-inner p { font-size: 17px; }
  main { grid-template-columns: 1fr; }
  main.main--single { max-width: none; }
  main.main--wide-text { grid-template-columns: 1fr; }
  main.projects-layout { grid-template-columns: 1fr; }
  .bio-panel.span-2 { grid-column: span 1; }
  .bio-panel { padding: 40px 32px; }
  .photo-panel { min-height: 320px; }
  .project-grid__empty { padding: 32px; }

  /* Project detail page: single column, but re-sequenced (not just
     stacked column-then-column) — first image slots in between the meta
     panel and the first body section; the rest of the images cluster
     after it and before any further body sections. main.project-layout
     stays `display: grid` (inherited) — CSS Grid supports `order` the
     same as flex, so no display change is needed, just unwrapping the two
     column wrappers with `display: contents` so their children become
     direct, reorderable grid items. */
  main.project-layout { grid-template-columns: 1fr; }
  .project-content, .project-media { display: contents; }
  .project-media .photo-panel { aspect-ratio: 4 / 3; }
  .project-media .photo-panel--natural { aspect-ratio: auto; }
  .project-meta { order: 1; }
  .project-media__item { order: 4; }
  .project-block { order: 5; }
  .project-media__item--first { order: 2; }
  .project-block--first { order: 3; }
  .menu-toggle { top: 24px; }
  .nav-overlay { width: 92%; }
  .nav-overlay a { padding-right: 32px; font-size: clamp(34px, 10vw, 56px); }
}

@media (max-width: 600px) {
  .project-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
