/* ===================================================================
   ANSAFF ASHRAFF PORTFOLIO
   Minimal, photo-first. White by default, dark optional.
   =================================================================== */

/* Space Grotesk: wordmark and nav-level display text. Hanken Grotesk:
   body copy, captions, controls. Both self-hosted (files above), so no
   webfont CDN dependency ever hits CloudFront. */
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --font-display: 'Space Grotesk', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  /* type scale, multiplied by --text-scale (resizable text control) */
  --text-scale: 1;
  --step--1: calc(0.8rem * var(--text-scale));
  --step-0:  calc(0.95rem * var(--text-scale));
  --step-1:  calc(1.15rem * var(--text-scale));
  --step-2:  calc(1.5rem * var(--text-scale));
  --step-3:  calc(2.4rem * var(--text-scale));

  --gap: 6px;              /* grid gutter */
  --pad: 24px;             /* header / footer side padding */
  --grid-pad: 48px;        /* inset of the photo grid from the page edge */
  --max-width: 1720px;

  --bg: #FFFFFF;
  --ink: #111111;
  --muted: #8A8A8A;
  --line: #E6E6E6;
}

[data-theme="dark"] {
  --bg: #111111;
  --ink: #F2F2F2;
  --muted: #8A8A8A;
  --line: #2A2A2A;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--bg);
  padding: 0.6em 1em; z-index: 200;
}
.skip-link:focus { left: var(--pad); top: var(--pad); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Header --------------------------------------------------------- */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px var(--pad) 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(2.4rem * var(--text-scale));
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.primary-nav {
  grid-column: 2;
  display: flex;
  gap: 28px;
  justify-content: center;
}
.primary-nav a {
  font-size: var(--step-0);
  color: var(--muted);
  padding: 6px 0;
}
.primary-nav a[aria-current="page"],
.primary-nav a:hover { color: var(--ink); }

.header-controls {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 18px;
}
.text-size-group { display: flex; gap: 2px; }
.ctl {
  color: var(--muted);
  font-size: var(--step--1);
  min-width: 34px; min-height: 34px;       /* comfortable tap target */
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.ctl:hover { color: var(--ink); }
.ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ctl .icon-sun { display: none; }
[data-theme="dark"] .ctl .icon-sun { display: block; }
[data-theme="dark"] .ctl .icon-moon { display: none; }

/* ---- Sub-header (filter tabs), centered ------------------------------ */
.subheader {
  display: flex;
  justify-content: center;
  padding: 0 var(--pad) 28px;
}
.filter-tabs { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.filter-tabs button {
  font-size: var(--step--1);
  color: var(--muted);
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
}
.filter-tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.filter-tabs button:hover { color: var(--ink); }

/* ---- Portfolio: tight masonry, no captions ---------------------------- */
main { max-width: var(--max-width); margin: 0 auto; }

.plate-grid {
  padding: 0 var(--grid-pad) 48px;
  column-count: 6;
  column-gap: var(--gap);
}
.plate {
  display: block;
  break-inside: avoid;
  margin-bottom: var(--gap);
  min-height: 120px;                   /* holds space until the image lands */
  background: var(--line);
}
.plate img { width: 100%; height: auto; transition: opacity 0.2s ease; }
.plate:hover img { opacity: 0.9; }
.js .plate:hover img.is-loaded { opacity: 0.9; }
.plate[hidden] { display: none; }

@media (max-width: 1500px) { .plate-grid { column-count: 5; } }
@media (max-width: 1200px) { .plate-grid { column-count: 4; } }
@media (max-width: 900px)  { .plate-grid { column-count: 3; } :root { --grid-pad: 24px; } }
@media (max-width: 600px)  { .plate-grid { column-count: 2; } :root { --grid-pad: 14px; } }

/* ---- Lightbox ------------------------------------------------------------ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.94);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
}
.lightbox[open] { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close, .lightbox-nav {
  position: absolute;
  color: #fff; line-height: 1;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.75;
}
.lightbox-close:hover, .lightbox-nav:hover { opacity: 1; }
.lightbox-close { top: 12px; right: 12px; font-size: 30px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); font-size: 44px; }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox.single .lightbox-nav { display: none; }
@media (max-width: 600px) { .lightbox { padding: 56px 8px; } .lightbox-nav { font-size: 36px; } }

/* ---- Journal ------------------------------------------------------------ */
.journal-grid {
  padding: 0 var(--grid-pad) 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px var(--gap);
}
.entry-card { display: block; }
.entry-card .frame { margin-bottom: 12px; background: var(--line); min-height: 120px; }
.entry-card .entry-tag { font-size: var(--step--1); color: var(--muted); }
.entry-card h3 { font-size: var(--step-1); font-weight: 500; margin: 4px 0 6px; line-height: 1.3; }
.entry-card p { color: var(--muted); margin: 0; }
.entry-card[hidden] { display: none; }

@media (max-width: 900px) { .journal-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .journal-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---- About & Contact ----------------------------------------------------- */
.about-contact {
  padding: 0 var(--pad) 48px;
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 420px);
  justify-content: center;
  gap: 64px;
  align-items: start;
}
.about-contact .frame { margin-bottom: 20px; background: var(--line); }
.about-contact h1, .about-contact h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: var(--step-2);
  font-weight: 600;
  margin: 0 0 14px;
}
.about-contact p { margin: 0 0 1em; max-width: 60ch; }
.contact-block p { color: var(--muted); }
.btn {
  display: inline-block;
  background: var(--ink); color: var(--bg);
  padding: 12px 22px;
  font-size: var(--step-0);
}
.btn:hover { opacity: 0.85; }
.social-list { display: flex; gap: 22px; margin: 28px 0 0; padding: 0; list-style: none; }
.social-list a { color: var(--muted); font-size: var(--step--1); }
.social-list a:hover { color: var(--ink); }

@media (max-width: 800px) {
  .about-contact { grid-template-columns: 1fr; gap: 36px; }
}

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px var(--pad) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer .foot-links { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.site-footer a:hover { color: var(--ink); }

/* ---- Mobile header -------------------------------------------------------- */
@media (max-width: 760px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 28px var(--pad) 20px;
    gap: 14px;
  }
  .logo { font-size: calc(2rem * var(--text-scale)); }
  .primary-nav { grid-column: 1; gap: 24px; }
  .primary-nav a { padding: 8px 0; }
  .header-controls { grid-column: 1; justify-self: center; }
  .subheader { padding-bottom: 20px; }
  .site-footer { justify-content: center; text-align: center; }
}

/* ---- Motion (only when JS is running) ------------------------------------ */
.js body { opacity: 0; transition: opacity 0.35s ease; }
.js body.is-ready { opacity: 1; }

.js .plate, .js .entry-card {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .plate.is-visible, .js .entry-card.is-visible { opacity: 1; transform: none; }

.js .plate img, .js .entry-card img { opacity: 0; transition: opacity 0.5s ease; }
.js .plate img.is-loaded, .js .entry-card img.is-loaded { opacity: 1; }

.plate-grid, .journal-grid { transition: opacity 0.22s ease; }
.plate-grid.is-filtering, .journal-grid.is-filtering { opacity: 0; }

/* ---- Utility, empty states, journal posts ---------------------------------- */
[hidden] { display: none !important; }

.empty-state { padding: 80px var(--pad); text-align: center; color: var(--muted); margin: 0; }
.entry-link { border-bottom: 1px solid currentColor; padding-bottom: 1px; color: var(--ink); }

.post { max-width: 720px; margin: 0 auto; padding: 0 var(--pad) 72px; }
.post h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-3); line-height: 1.1; margin: 4px 0 28px; }
.post-meta { color: var(--muted); font-size: var(--step--1); margin: 0; }
.post figure { margin: 0 0 32px; }
.post figure img { width: 100%; height: auto; }
.post p { font-size: var(--step-1); line-height: 1.65; margin: 0 0 1.2em; max-width: 62ch; }

@media (max-width: 600px) { .post h1 { font-size: var(--step-2); } }
