/* ==========================================================================
   Iron Woman — Base + shared component library
   Reproduces the locked QP design's global patterns (README §5) as reusable
   classes so module templates stay free of inline styles.
   ========================================================================== */

/* ---------- Resets ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--btn-text); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, figure, figcaption { margin: 0; }
/* The [hidden] attribute must win over display:flex/grid utility classes
   (used by the Projects filter/view-toggle to show/hide cards and panels). */
[hidden] { display: none !important; }
button { font-family: inherit; }

/* Accessibility: visible focus everywhere */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--light);
  padding: 12px 18px; font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Brand logo lockup ----------
   The artwork is inlined once as a <symbol>; its lettering uses currentColor,
   so set `color` on .wordmark to theme it per surface. */
.wordmark { display: inline-flex; align-items: center; color: inherit; line-height: 0; flex: 0 0 auto; }
.wordmark__logo {
  display: block; width: auto;
  height: clamp(26px, 2.3vw, 32px);
  aspect-ratio: 981 / 145;
  overflow: visible;
}
.wordmark__text {
  font-family: var(--font-sans); font-weight: 800; font-size: 21px;
  letter-spacing: -.02em; line-height: 1;
}

/* ---------- Layout primitives ---------- */
.section { padding: var(--sec-y) var(--pad-x); }
.section--tight { padding: var(--sec-y-tight) var(--pad-x); }
.section--loose { padding: var(--sec-y-loose) var(--pad-x); }
.container { max-width: var(--maxw); margin: 0 auto; }

/* Background alternation drives section rhythm */
.bg-cream { background: var(--cream); color: var(--ink); }
.bg-tan   { background: var(--tan);   color: var(--ink); }
.bg-dark  { background: var(--dark);  color: var(--light-body); }
.bg-dark-warm { background: var(--dark-warm); color: var(--light-body); }

/* Dark sections get the layered grid + radial texture (README §5.3) */
.has-texture { position: relative; overflow: hidden; }
.has-texture > .texture {
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 1px, transparent 1px 13px),
    radial-gradient(120% 110% at 82% 8%, rgba(58,80,76,.4), rgba(10,16,15,0) 60%);
}
.has-texture > .container,
.has-texture > .section-inner { position: relative; }

/* ---------- Typography helpers ---------- */
.serif { font-family: var(--font-serif); }
.mono  { font-family: var(--font-mono); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow--dark { color: var(--light-7); }
.eyebrow--accent { color: var(--accent); }

.h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--fs-h1);
  line-height: 1.02;
  letter-spacing: -.016em;
}
.h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--fs-h2);
  line-height: 1.08;
  letter-spacing: -.012em;
}
.h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--fs-h3);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.lead {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: var(--fs-lead);
  line-height: 1.4;
  color: var(--body);
}
.accent-mark { color: var(--accent); }
em, .italic { font-style: italic; }

/* ---------- Section header (README §5.2) ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  margin-bottom: clamp(40px, 6vh, 72px);
}
.section-head--dark { border-top-color: var(--bd-dark-5); }
.section-head__label { display: flex; align-items: baseline; gap: 14px; }
.section-head__index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--accent);
}
.section-head__title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
}
.section-head--dark .section-head__title { color: var(--light-body); }
.section-head__aside {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mono-muted);
}

/* ---------- Split button / CTA (README §5.1) ---------- */
.btn {
  display: inline-flex;
  align-items: stretch;
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--btn-text);
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.btn__label { display: flex; align-items: center; padding: 16px 22px; }
.btn__arrow {
  display: flex; align-items: center; padding: 0 16px;
  border-left: 1px solid rgba(244,241,234,.4);
  font-size: 14px;
}
/* Filled hover: invert to transparent (on dark) */
.btn:hover { background: transparent; color: var(--light); }
/* Filled on a light surface: hover to ink */
.btn--on-light:hover { background: var(--ink); color: var(--btn-text); border-color: var(--ink); }
.btn--on-light .btn__arrow { border-left-color: rgba(244,241,234,.4); }

/* Outlined variant */
.btn--ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--ink) 28%, transparent);
  color: var(--ink);
}
.btn--ghost:hover { background: transparent; color: var(--ink); border-color: var(--accent); }
.btn--ghost.btn--on-dark {
  border-color: var(--bd-dark-28);
  color: var(--light-body);
}
.btn--ghost.btn--on-dark:hover { color: var(--light); border-color: var(--accent); }

/* Single-segment inline button (no arrow divider) */
.btn--solid-inline {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 18px;
}

/* Text link with arrow */
.arrow-link {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
  transition: gap var(--t-base);
}
.arrow-link:hover { gap: 13px; }

/* ---------- List rows (README §5.4) ---------- */
.rows { max-width: 1080px; }
.row {
  display: flex; gap: 18px; align-items: baseline;
  padding: clamp(20px, 2.8vh, 32px) 0;
  border-top: 1px solid var(--bd-light-2);
}
.row:last-child { border-bottom: 1px solid var(--bd-light-2); }
.row__index {
  flex: 0 0 auto; min-width: 1.4em;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .04em;
  color: var(--accent);
}
.row__text {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(1.02rem, 1.45vw, 1.22rem);
  line-height: 1.5;
  color: var(--ink-strong-2);
}

/* ---------- Cards (README §5.5) ---------- */
.card {
  background: var(--cream);
  border: 1px solid var(--bd-light);
  padding: clamp(24px, 2.4vw, 34px);
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -20px rgba(26, 23, 20, .45);
}

/* ---------- Image plate placeholder (README §5.3) ---------- */
.plate {
  position: relative;
  background: var(--dark);
  color: var(--light-body);
  overflow: hidden;
  min-height: 320px;
  display: block;
}
.plate::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 1px, transparent 1px 11px),
    radial-gradient(120% 120% at 75% 12%, rgba(58,80,76,.35), rgba(10,16,15,0) 62%);
}
.plate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plate__tag {
  position: absolute; top: 16px; left: 16px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--light-7);
  border: 1px solid var(--bd-dark-2); padding: 6px 11px;
}
.plate__code {
  position: absolute; top: 16px; right: 16px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--light-45);
}
.plate__caption {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--light-55);
}
/* When a real image is present, remove ALL the placeholder chrome
   (tag / code / caption) and the striped texture so only the photo shows. */
.plate.has-image::before { opacity: 0; }
.plate.has-image .plate__tag,
.plate.has-image .plate__caption,
.plate.has-image .plate__code { display: none; }
/* Subtle editorial zoom on hover when a plate sits inside a link/card. */
.plate img { transition: transform .7s cubic-bezier(.16, .84, .44, 1); }
a:hover > .plate img,
.card:hover .plate img,
.project-card:hover .plate img { transform: scale(1.04); }

/* ---------- Forms (README §5.6) ---------- */
.field-label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  display: block; margin-bottom: 8px;
}
/* Dark (job apply / login): boxed inputs */
.input--dark, .form--dark .gfield input:not([type=submit]),
.form--dark .gfield textarea, .form--dark .gfield select {
  font-family: var(--font-sans); font-size: 16px;
  color: var(--light); background: rgba(236,231,220,.04);
  border: 1px solid var(--bd-dark-2); padding: 13px 15px; width: 100%;
  outline: none; transition: border-color var(--t-fast), background var(--t-fast);
}
.input--dark:focus, .form--dark .gfield input:focus,
.form--dark .gfield textarea:focus, .form--dark .gfield select:focus {
  border-color: var(--accent); background: rgba(236,231,220,.07);
}
.input--dark::placeholder { color: var(--light-40); }
.form--dark .field-label, .form--dark label { color: var(--light-55); }

/* Light (contact): underline inputs */
.input--light, .form--light .gfield input:not([type=submit]),
.form--light .gfield textarea, .form--light .gfield select {
  font-family: var(--font-sans); font-size: 16px;
  color: var(--ink); background: transparent;
  border: none; border-bottom: 1px solid var(--bd-light-3);
  padding: 12px 2px; width: 100%; outline: none;
  transition: border-color var(--t-fast);
}
.input--light:focus, .form--light .gfield input:focus,
.form--light .gfield textarea:focus, .form--light .gfield select:focus {
  border-bottom-color: var(--accent);
}

/* File input (CV upload) */
.input--file {
  font-family: var(--font-sans); font-size: 14px;
  color: var(--light-62); background: rgba(236,231,220,.04);
  border: 1px dashed rgba(236,231,220,.3);
  padding: 14px 15px; width: 100%; outline: none; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input--file:hover { border-color: var(--bd-dark-5); }
.input--file:focus { border-color: var(--accent); }
.input--file::file-selector-button {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--btn-text); background: var(--accent);
  border: none; padding: 9px 14px; margin-right: 14px; cursor: pointer;
  transition: background var(--t-fast);
}
.input--file::file-selector-button:hover { background: var(--accent-hover); }
.field-hint {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .04em; margin-top: 8px;
}
.form--dark .field-hint { color: var(--light-40); }

/* ---------- Reveal on scroll (site-wide) ----------
   Only active when JS is present (html.js, set before paint) so content is
   never hidden if scripts fail. app.js tags elements + toggles .is-revealed. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.16, .84, .44, 1),
              transform .7s cubic-bezier(.16, .84, .44, 1);
  will-change: opacity, transform;
}
html.js [data-reveal].is-revealed { opacity: 1; transform: none; }

/* Stagger children within a group (set by app.js as --reveal-i). */
html.js [data-reveal] { transition-delay: calc(var(--reveal-i, 0) * 70ms); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-reveal] { opacity: 1 !important; transform: none !important; }
}
