/* ============================================================
   Base site styles. Typography uses the GRT tokens from grt.css
   (never hard-code sizes/line-heights — reference the --grt-* vars).
   Dark, quiet, gallery-first: the photos are the color, the UI is not.
   ============================================================ */

/* ── Theme tokens ──────────────────────────────────────────── */
:root {
  --bg:       #0d0d0f;
  --surface:  #161619;
  --text:     #ece9e3;
  --muted:    #97948c;
  --line:     rgba(255, 255, 255, 0.11);
  --accent:   #c9a86a;   /* warm, filmic */
  --focus:    #7aa2ff;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--grt-scale-1);
  line-height: var(--grt-lh-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent); }

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

/* ── Typographic rhythm (GRT) ──────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
/* h1/h2 are fluid: they scale from a smaller GRT step on phones up to the full
   GRT size on desktop. Anchors are GRT tokens (never eyeballed); line-heights
   are the GRT ratios expressed unitless so leading scales with the font. */
h1 {
  font-size: clamp(var(--grt-h3-size), 6vw, var(--grt-h1-size));
  line-height: 1.44; /* = 68/47.125, the GRT h1 ratio */
}
h2 {
  font-size: clamp(var(--grt-h4-size), 5vw, var(--grt-h2-size));
  line-height: 1.48; /* = 55/37.047, the GRT h2 ratio */
}
h3 { font-size: var(--grt-h3-size); line-height: var(--grt-h3-lh); }
h4 { font-size: var(--grt-h4-size); line-height: var(--grt-h4-lh); }
h5 { font-size: var(--grt-h5-size); line-height: var(--grt-h5-lh); }
h6 { font-size: var(--grt-h6-size); line-height: var(--grt-h6-lh); }

p, ul, ol { max-width: var(--grt-content-width); }
p + p { margin-top: var(--grt-space-md); }

small, figcaption, .caption {
  font-size: var(--grt-space-xs);
  line-height: var(--grt-lh-1);
  color: var(--muted);
}

/* ── Layout shell ──────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(var(--grt-space-md), 5vw, var(--grt-space-xl));
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--grt-space-md);
  padding-block: var(--grt-space-md);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-size: var(--grt-h5-size);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wordmark .dot { color: var(--accent); }
.site-nav {
  display: flex;
  gap: var(--grt-space-md);
  font-size: var(--grt-space-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-main { flex: 1 0 auto; padding-block: var(--grt-space-xl); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--grt-space-lg);
  color: var(--muted);
  font-size: var(--grt-space-xs);
}
.site-footer a { color: var(--text); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { margin-bottom: var(--grt-space-xxl); max-width: 940px; }
.hero .eyebrow {
  font-size: var(--grt-space-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--grt-space-sm);
}
.hero h1 { margin-bottom: var(--grt-space-md); }
.hero .lede {
  font-size: var(--grt-scale-2);
  line-height: var(--grt-lh-2);
  color: var(--muted);
  max-width: var(--grt-content-width);
}

/* ── Album grid (aspect-aware layout lands in Phase 3) ─────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--grt-space-md);
  list-style: none;
  padding: 0;
  max-width: none;
}
.album-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 3 / 2;
  padding: var(--grt-space-md);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface) center / cover no-repeat;
  border: 1px solid var(--line);
  transition: transform 0.2s ease;
}
.album-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.1) 55%, transparent 100%);
}
.album-card:hover { transform: translateY(-3px); }
.album-card-body { position: relative; z-index: 1; }
.album-card-title {
  display: block;
  font-size: var(--grt-h4-size);
  line-height: var(--grt-h4-lh);
  font-weight: 600;
}
.album-card-meta {
  display: block;
  font-size: var(--grt-space-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Album page ────────────────────────────────────────────── */
.album-head { margin-bottom: var(--grt-space-xl); }
.album-head h1 { margin-block: var(--grt-space-xs) var(--grt-space-sm); }
.album-meta { color: var(--muted); font-size: var(--grt-space-sm); }

/* Justified flex gallery: rows fill the width, aspect ratios preserved. */
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--grt-space-xs);
}
.photo-grid .tile {
  position: relative;
  height: 260px;
  flex-grow: 1;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface) center / cover no-repeat; /* blur placeholder via inline style */
}
.photo-grid .tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.photo-grid .tile.is-loaded img { opacity: 1; }
.photo-grid .tile::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 3px;
  pointer-events: none;
}
.tile-filler { flex-grow: 999999; height: 0; }
@media (max-width: 700px) {
  .photo-grid .tile { height: 180px; }
}

/* ── Photo detail ──────────────────────────────────────────── */
.detail-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--grt-space-md);
  margin-bottom: var(--grt-space-lg);
  font-size: var(--grt-space-sm);
}
.detail-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.photo-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--grt-space-xl);
  align-items: start;
}
.photo-frame {
  margin: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface) center / cover no-repeat;
  max-height: 82vh;
}
.photo-frame img {
  width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.photo-frame.is-loaded img { opacity: 1; }

.photo-info { position: sticky; top: var(--grt-space-md); }
.photo-date { color: var(--muted); margin-bottom: var(--grt-space-md); }
.exif {
  display: grid;
  gap: var(--grt-space-xs);
  border-top: 1px solid var(--line);
  padding-top: var(--grt-space-md);
}
.exif div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--grt-space-sm);
  align-items: baseline;
  padding-bottom: var(--grt-space-xs);
  border-bottom: 1px solid var(--line);
}
.exif dt {
  color: var(--muted);
  font-size: var(--grt-space-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.exif dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.photo-place { margin-top: var(--grt-space-md); color: var(--muted); }
.photo-download { margin-top: var(--grt-space-lg); }
.photo-download a {
  display: inline-block;
  padding: 0.5em 1em;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: var(--grt-space-sm);
}
.photo-download a:hover { border-color: var(--accent); }

.photo-pager {
  display: flex;
  justify-content: space-between;
  margin-top: var(--grt-space-xl);
  padding-top: var(--grt-space-md);
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .photo-detail { grid-template-columns: 1fr; gap: var(--grt-space-lg); }
  .photo-info { position: static; }
}

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: var(--grt-space-xl);
  text-align: center;
  color: var(--muted);
}
.empty code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text);
  background: var(--surface);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
