/* Anthony Preston — portfolio
   Swiss-informed system: clear hierarchy, disciplined grid, quiet color. */

:root {
  --paper: #f7f7f5;
  --paper-2: #eeeeeb;
  --ink: #111111;
  --ink-2: #444444;
  --ink-3: #5f5f5f;
  --line: #c9c9c4;
  --accent: #e13224;
  --accent-ink: #c62519;
  --card: #ffffff;
  --shadow: none;

  --font-display: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.2rem);
  --step-4: clamp(2.6rem, 1.8rem + 4vw, 5.2rem);
  --step-5: clamp(3rem, 1.6rem + 7vw, 7.5rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4rem, 3rem + 6vw, 8rem);

  --wrap: 1200px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 0;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.02; margin: 0; letter-spacing: -0.035em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--space-2); top: -3rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; border-radius: 6px; z-index: 100; }
.skip:focus { top: var(--space-2); }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 0.75rem;
}
.eyebrow::before { content: ""; width: 1.5rem; height: 1px; background: var(--accent); }

.lede { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.measure { max-width: 62ch; text-wrap: pretty; }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.72rem 1rem; border-radius: 0;
  font-weight: 600; font-size: var(--step--1); text-decoration: none; line-height: 1;
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  transition: background 0.18s, color 0.18s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { border-color: var(--ink); padding-inline: 1rem; text-decoration: none; }
.btn-ghost:hover { border-color: var(--ink); text-decoration: none; }
.arrow-link { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; text-decoration: none; color: var(--ink); }
.arrow-link::after { content: "→"; transition: transform 0.4s var(--ease); color: var(--accent); }
.arrow-link:hover::after { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 4.25rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; font-weight: 600; font-size: var(--step-0); letter-spacing: -0.01em; }
.brand-mark { width: 0.72rem; height: 0.72rem; border-radius: 0; background: var(--accent); }
.site-nav { display: flex; gap: clamp(1rem, 2.5vw, 2rem); align-items: center; }
.site-nav a { text-decoration: none; font-weight: 500; font-size: var(--step--1); color: var(--ink-2); padding: 0.4rem 0; border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.site-nav .nav-cta { color: var(--ink); border: 1px solid var(--ink); border-radius: 0; padding: 0.45rem 0.9rem; }
.site-nav .nav-cta:hover { border-color: var(--ink); }
.nav-toggle { display: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; position: relative; }
.nav-toggle-bar { position: absolute; left: 0.75rem; right: 0.75rem; height: 2px; background: var(--ink); transition: transform 0.4s var(--ease), top 0.4s var(--ease); }
.nav-toggle-bar:nth-child(1) { top: calc(50% - 4px); }
.nav-toggle-bar:nth-child(2) { top: calc(50% + 3px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { top: 50%; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { top: 50%; transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    transform-origin: top; transform: scaleY(0.96); opacity: 0; pointer-events: none;
    transition: opacity 0.25s, transform 0.3s var(--ease);
  }
  .site-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .site-nav a { font-size: var(--step-1); padding: 0.8rem 0; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-weight: 400; }
  .site-nav .nav-cta { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0.8rem 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(4rem, 10vh, 8rem) var(--space-6); border-bottom: 1px solid var(--line); }

/* ---------- Background fields (homepage only) ----------
   Two pre-blurred color fields behind the page. --step is set by site.js as
   major sections enter view; without JS (or with reduced motion) they are static. */
.bg-fields { --step: 0; position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.field { position: absolute; width: 84vmax; height: 84vmax; border-radius: 50%; opacity: 0.14; will-change: transform; transition: transform 1.6s var(--ease); }
.field-a {
  top: -16vmax; right: -8vmax;
  background: radial-gradient(circle at center, #e13224 0%, rgba(225, 50, 36, 0.55) 28%, rgba(225, 50, 36, 0) 62%);
  transform: translate3d(calc(var(--step) * -22px), calc(var(--step) * 46px), 0);
}
.field-b {
  bottom: -22vmax; left: -12vmax;
  background: radial-gradient(circle at center, #4a6fa5 0%, rgba(74, 111, 165, 0.55) 28%, rgba(74, 111, 165, 0) 62%);
  transform: translate3d(calc(var(--step) * 20px), calc(var(--step) * -44px), 0);
}
@media (prefers-reduced-motion: reduce) { .field { transition: none; } }
@media (max-width: 720px) { .field { opacity: 0.11; } }
.hero-grid { display: grid; gap: var(--space-4); align-items: end; grid-template-columns: 1fr; }
.hero-name { font-size: var(--step-5); letter-spacing: -0.065em; line-height: 0.82; font-weight: 600; }
.hero-name em { font-style: normal; font-weight: 600; color: var(--accent); }
.hero-role { margin-top: var(--space-3); font-size: var(--step-1); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.hero-role .dot { color: var(--accent); }
.hero-copy { display: grid; gap: var(--space-3); max-width: 44em; }
.hero-copy .lede { color: var(--ink); }
.hero-now { color: var(--ink-2); max-width: 40em; text-wrap: pretty; }
.hero-now a { font-weight: 500; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-5); }
  .hero-copy { padding-bottom: 0.6rem; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--space-6); border-top: 1px solid var(--line); }
.section-head { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); max-width: 52em; }
.section-title { font-size: var(--step-3); letter-spacing: -0.02em; text-wrap: balance; }
.section-intro { color: var(--ink-2); font-size: var(--step-1); line-height: 1.45; text-wrap: pretty; }
.section-alt { background: var(--paper-2); }

/* Work groups: Current work, then IDEXX, inside one continuous section */
.group + .group { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--ink); }
.group-label { font-size: var(--step--1); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.group-idexx .section-head { margin-bottom: var(--space-4); }
.group-idexx .section-title { font-size: var(--step-2); }
.gallery-note { margin-top: var(--space-3); color: var(--ink-3); font-size: var(--step--1); }

/* Feature (current work) */
.feature { display: grid; gap: var(--space-4); align-items: center; padding-block: var(--space-5); }
.feature + .feature { border-top: 1px solid var(--line); }
.feature-media { position: relative; }
.feature-media picture, .feature-media img { border-radius: 0; box-shadow: none; }
.feature-media::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line); pointer-events: none;
}
.feature-body { display: grid; gap: var(--space-3); }
.feature-title { font-size: var(--step-4); letter-spacing: -0.025em; line-height: 0.98; }
.feature-summary { font-size: var(--step-1); line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
@media (min-width: 900px) {
  .feature { grid-template-columns: repeat(12, 1fr); gap: var(--space-5); }
  .feature-media { grid-column: 1 / span 7; }
  .feature-body { grid-column: 8 / span 5; }
  .feature.is-flipped .feature-media { grid-column: 6 / span 7; order: 2; }
  .feature.is-flipped .feature-body { grid-column: 1 / span 5; order: 1; }
}

/* Bullets */
.bullets { display: grid; gap: 0.6rem; color: var(--ink-2); }
.bullets li { position: relative; padding-left: 1.4rem; text-wrap: pretty; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--accent); }

/* Case grid (IDEXX) */
.case-grid { display: grid; gap: var(--space-4); }
@media (min-width: 720px) { .case-grid { grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-4); } }
.case-card {
  display: grid; gap: var(--space-3); text-decoration: none; color: inherit;
  padding: var(--space-3) 0; border-radius: 0;
  background: transparent; border: 0; border-top: 1px solid var(--ink);
  transition: color 0.2s;
}
.case-card:hover { transform: none; box-shadow: none; color: var(--accent-ink); }
.case-media { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 0; background: var(--paper-2); }
.case-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.case-card:hover .case-media img { transform: scale(1.03); }
.case-body { display: grid; gap: 0.6rem; }
.case-title { font-size: var(--step-2); letter-spacing: -0.015em; }
.case-summary { color: var(--ink-2); text-wrap: pretty; }
.case-card .arrow-link { margin-top: 0.25rem; }

/* About */
.about-eyebrow { margin-bottom: var(--space-4); }
.about-grid { display: grid; gap: var(--space-4); align-items: start; }
.about-portrait picture, .about-portrait img { border-radius: 0; }
.about-portrait { max-width: 22rem; }
.about-copy { display: grid; gap: var(--space-3); font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.about-copy p:first-child { color: var(--ink); font-size: var(--step-2); font-family: var(--font-display); line-height: 1.25; letter-spacing: -0.01em; }
@media (min-width: 900px) {
  .about-grid { grid-template-columns: repeat(12, 1fr); }
  .about-portrait { grid-column: 1 / span 4; }
  .about-copy { grid-column: 6 / span 7; }
}

/* What I do */
.skills { display: grid; gap: 0; border-top: 1px solid var(--line); counter-reset: skill; }
.skills li { display: grid; grid-template-columns: 3rem 1fr; align-items: baseline; padding: 1rem 0; border-bottom: 1px solid var(--line); font-size: var(--step-1); font-family: var(--font-display); letter-spacing: -0.01em; }
.skills li::before { counter-increment: skill; content: counter(skill, decimal-leading-zero); font-family: var(--font-body); font-size: var(--step--1); color: var(--accent); font-weight: 600; }
@media (min-width: 720px) { .skills { grid-template-columns: 1fr 1fr; column-gap: var(--space-5); } }

/* Résumé teaser */
.resume-teaser { display: grid; gap: var(--space-3); }
@media (min-width: 900px) { .resume-teaser { grid-template-columns: 1fr auto; align-items: end; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-6) var(--space-4); background: var(--paper-2); }
.footer-title { font-size: var(--step-3); letter-spacing: -0.02em; max-width: 24em; margin-top: var(--space-2); text-wrap: balance; }
.contact-list { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin-top: var(--space-4); }
.contact-list a { font-size: var(--step-1); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 0.15rem; transition: border-color 0.2s; }
.contact-list a:hover { border-color: var(--accent); }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; margin-top: var(--space-6); color: var(--ink-3); font-size: var(--step--1); }

/* ---------- Case study pages ---------- */
.case-hero { padding-block: var(--space-5) var(--space-4); }
.case-hero .eyebrow { margin-bottom: var(--space-2); }
.case-hero-title { font-size: var(--step-4); letter-spacing: -0.025em; line-height: 0.98; max-width: 10em; }
.case-hero-grid { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
@media (min-width: 900px) {
  .case-hero-grid { grid-template-columns: repeat(12, 1fr); }
  .case-hero-grid .lede { grid-column: 1 / span 6; }
  .case-hero-grid .bullets { grid-column: 8 / span 5; }
}
.case-cover { margin-top: var(--space-5); }
.case-cover picture, .case-cover img { border-radius: 0; box-shadow: none; }
.case-actions { margin-top: var(--space-4); }

.gallery { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
@media (min-width: 720px) { .gallery { grid-template-columns: 1fr 1fr; } }
.gallery figure { margin: 0; display: grid; gap: 0.6rem; }
.gallery .shot { display: block; width: 100%; padding: 0; border-radius: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); cursor: zoom-in; transition: border-color 0.2s; }
.gallery .shot:hover { transform: none; box-shadow: none; border-color: var(--ink); }
.gallery .shot img { width: 100%; }
.gallery .is-portrait { grid-row: span 2; }
.gallery figcaption { font-size: var(--step--1); color: var(--ink-3); }

.case-nav { display: grid; gap: var(--space-2); margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.case-nav .eyebrow { margin-bottom: 0.5rem; }
.case-nav-list { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.case-nav-list a { text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); border-bottom: 1px solid var(--line); }
.case-nav-list a:hover, .case-nav-list a[aria-current="page"] { border-color: var(--accent); }
.case-nav-list a[aria-current="page"] { color: var(--ink-3); }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1600px); max-height: 96vh; }
.lightbox::backdrop { background: rgba(10, 10, 12, 0.88); backdrop-filter: blur(6px); }
.lightbox figure { margin: 0; display: grid; gap: 0.75rem; justify-items: center; }
.lightbox img { max-width: 96vw; max-height: 86vh; width: auto; height: auto; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lightbox figcaption { color: #e8e4de; font-size: var(--step--1); text-align: center; }
.lightbox-close { position: fixed; top: 1rem; right: 1rem; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 1.6rem; line-height: 1; }
.lightbox-close:hover { background: rgba(255, 255, 255, 0.24); }

/* ---------- Résumé page ---------- */
.resume { display: grid; gap: var(--space-5); padding-block: var(--space-5) var(--space-6); }
.resume-head { display: grid; gap: var(--space-3); }
.resume-grid { display: grid; gap: var(--space-5); }
@media (min-width: 900px) { .resume-grid { grid-template-columns: 2fr 1fr; gap: var(--space-6); } }
.resume h2 { font-size: var(--step-2); margin-bottom: var(--space-3); }
.role { display: grid; gap: 0.4rem; padding-block: var(--space-3); border-top: 1px solid var(--line); }
.role-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; align-items: baseline; }
.role-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; }
.role-org { color: var(--ink-2); }
.role-dates { color: var(--ink-3); font-size: var(--step--1); white-space: nowrap; }
.role p { color: var(--ink-2); text-wrap: pretty; }
.role-place { font-size: var(--step--1); color: var(--ink-3); }
.role-bullets { display: grid; gap: 0.5rem; color: var(--ink-2); margin-top: 0.25rem; }
.role-bullets li { position: relative; padding-left: 1.4rem; text-wrap: pretty; }
.role-bullets li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--accent); }
.resume-meta { color: var(--ink-3); font-size: var(--step--1); }
.resume-summary { max-width: 48em; }
.side-list { display: grid; gap: 0.5rem; color: var(--ink-2); }
.side-block + .side-block { margin-top: var(--space-4); }

/* ---------- Reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* 404 */
.notfound { padding-block: var(--space-6); display: grid; gap: var(--space-3); }

/* Print-only elements (see print.css) stay out of the screen rendering. */
.print-only { display: none; }

/* ---------- Experiment: handwritten labels ----------
   Architects Daughter (SIL OFL 1.1), self-hosted from /assets/fonts so it is
   served through the site's own CDN. Applies to the small uppercase labels
   (.eyebrow kickers such as "Prototype" and "IDEXX · 2014–2025", and the
   matching .group-label). Headings, body text, and the résumé PDF stay in
   Inter. Remove this block to return to Inter. */
@font-face {
  font-family: "Architects Daughter";
  src: url("../fonts/architects-daughter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root { --font-hand: "Architects Daughter", "Bradley Hand", "Segoe Print", cursive; }
.eyebrow, .group-label {
  font-family: var(--font-hand);
  font-weight: 400;
  letter-spacing: 0.04em;
  font-size: calc(var(--step--1) * 1.15);
}
/* Experiment: About lead line in Architects Daughter, all caps. Remove to revert. */
.about-copy p:first-child {
  font-family: var(--font-hand);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Résumé education: school (with place) over degree and year, like a role header over its details. */
.edu-list { gap: var(--space-2); }
.edu span { display: block; }
.edu-school strong { color: var(--ink); font-weight: 600; }
