/* wp-content/themes/mosaic/assets/css/components.css */
/* ============================================================================
   Reusable component styles. Tokens come from design-system.css — never
   hardcode a hex/px/font-name that has a token. Component-internal dimensions
   (e.g. button padding, header height) are the authoritative spec values from
   Design System Brief §4.6 / handoff website.css.
   ============================================================================ */

/* ============================================================================
   BUTTONS  (.btn / variants) — DSB §4.6
   Pill, 600 weight, 15px, pad 13×26, gap 9px, :active scale(.98). SC01
   resolution (CD, 2026-06-04): primary bg --sage-600 → white text = 5.67:1
   (AA), hover --sage-700. Focus ring comes from the global :focus-visible rule.
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px; /* §4.6 button spec */
  font-family: var(--font-body);
  font-weight: var(--fw-semi);
  font-size: 15px; /* §4.6 button spec */
  line-height: 1;
  text-align: center;
  padding: 13px 26px; /* §4.6 button spec */
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 17px; /* §4.6 trailing icon */
  height: 17px;
}

.btn-primary {
  background: var(--sage-600);
  color: var(--primary-ink);
}

.btn-primary:hover {
  background: var(--sage-700);
}

.btn-ghost {
  background: transparent;
  border-color: var(--sage-500);
  color: var(--sage-700);
}

.btn-ghost:hover {
  background: var(--sage-50);
}

.btn-ondark {
  background: var(--paper);
  color: var(--ink-900);
}

.btn-ondark:hover {
  background: var(--surface);
}

/* Ghost button on a dark surface (footer) — lightened border + white text. */
.btn-ghost--on-dark {
  border-color: color-mix(in srgb, var(--surface) 25%, transparent); /* rgba(255,255,255,.25) */
  color: var(--primary-ink);
}

.btn-ghost--on-dark:hover {
  background: color-mix(in srgb, var(--surface) 10%, transparent);
  border-color: var(--surface);
}

/* Apple logo keeps its portrait aspect inside the App Store button
   (overrides the square .btn svg sizing). */
.btn .apple-logo {
  width: auto;
  height: 16px;
}

/* ============================================================================
   IN-PROSE LINKS  (MOS-121 F02) — editorial body-copy links need a non-colour
   distinction (WCAG 1.4.1), so they carry a persistent underline. Scoped to
   prose containers only; nav / CTA / card links are excluded (identified by
   position + shape).
   ============================================================================ */
.modal-story a,
.project-story a,
.entry-content a {
  color: var(--sage-600);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--dur) var(--ease);
}

.modal-story a:hover,
.project-story a:hover,
.entry-content a:hover {
  color: var(--sage-700);
}

@media (prefers-reduced-motion: reduce) {
  .modal-story a,
  .project-story a,
  .entry-content a {
    transition: none;
  }
}

/* ============================================================================
   SECTION SCAFFOLDING — DSB §4.6 (.sec rhythm + .sec-head device)
   Reused across landing sections (spotlight, work). The trailing rule fills
   the remaining width to the right, baseline-aligned. Dark-band colour
   overrides are scoped by each section (e.g. .spot).
   ============================================================================ */
.sec {
  padding: 84px 0; /* §4.6 section rhythm */
}

.sec-head {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: 40px;
}

.sec-head h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
  margin: 6px 0 0;
}

.sec-head .rule {
  flex: 1;
  height: 1px;
  background: var(--line-strong);
  margin-bottom: 10px;
}

/* ============================================================================
   HEADER + PRIMARY NAV  (.hdr) — DSB §4.6
   Sticky 72px bar, translucent paper + blur, hairline bottom border. Mobile
   first: nav links collapse to a hamburger → drawer below 781px; the inline
   nav is restored from 781px up.
   ============================================================================ */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent); /* §4.6: rgba(247,244,236,.82) */
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.hdr-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px; /* §4.6 header spec */
}

/* Brand lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3); /* 12px */
}

.brand-mark {
  height: 30px; /* §4.6 header spec */
  width: auto;
}

.brand-wm {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 24px; /* §4.6 header spec */
  letter-spacing: var(--tracking-display);
  color: var(--ink-900);
}

/* Desktop nav (shown from 781px — see media query below) */
.nav {
  display: none;
  align-items: center;
  gap: 30px; /* §4.6 header spec */
}

.navlink {
  font-family: var(--font-body);
  font-weight: var(--fw-med);
  font-size: 15px; /* §4.6 header spec */
  color: var(--ink-700);
  transition: color var(--dur) var(--ease);
}

.navlink:hover {
  color: var(--sage-600);
}

.nav-cta {
  margin-left: var(--space-2);
}

/* ============================================================================
   MOBILE NAV TOGGLE (hamburger) — built for the WP version (DSB §4.6 note:
   the prototype only hid the links). ≥44px tap target (F04). Animates to ✕.
   ============================================================================ */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px; /* optical edge alignment with .wrap padding */
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink-900);
  cursor: pointer;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-toggle-bars {
  position: relative;
  transition: background-color var(--dur) var(--ease);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  left: 0;
  transition: transform var(--dur) var(--ease);
}

.nav-toggle-bars::before {
  top: -7px;
}

.nav-toggle-bars::after {
  top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================================
   MOBILE DRAWER  (.nav-drawer) — off-canvas sheet. Behaviour (open/close,
   focus trap, Esc, scroll lock) in assets/js/navigation.js.
   ============================================================================ */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.nav-drawer[hidden] {
  display: none;
}

.nav-drawer-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink-900) 55%, transparent); /* matches modal overlay rgba(31,35,30,.55) */
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.nav-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(82vw, 360px);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: calc(72px + var(--space-5)) var(--space-6) var(--space-6);
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
}

.nav-drawer.is-open .nav-drawer-overlay {
  opacity: 1;
}

.nav-drawer.is-open .nav-drawer-panel {
  transform: translateX(0);
}

.nav-drawer-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink-900);
  cursor: pointer;
}

.nav-drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.nav-drawer-link {
  display: flex;
  align-items: center;
  min-height: 44px; /* tap target (F04) */
  font-family: var(--font-body);
  font-weight: var(--fw-med);
  font-size: var(--fs-lead);
  color: var(--ink-900);
  border-bottom: 1px solid var(--line);
  transition: color var(--dur) var(--ease);
}

.nav-drawer-link:hover {
  color: var(--sage-600);
}

.nav-drawer-cta {
  margin-top: var(--space-5);
  justify-content: center;
}

/* Background scroll lock while the drawer is open (toggled in navigation.js). */
body.nav-open {
  overflow: hidden;
}

/* ============================================================================
   RESPONSIVE — restore inline nav from 781px (prototype breakpoint)
   ============================================================================ */
@media (min-width: 781px) {
  .nav {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }

  .nav-drawer {
    display: none;
  }
}

/* ============================================================================
   REDUCED MOTION — honour the user preference (DSB §5.4)
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn:active,
  .navlink,
  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after,
  .nav-drawer-overlay,
  .nav-drawer-panel,
  .nav-drawer-link {
    transition: none;
  }

  .btn:active {
    transform: none;
  }
}

/* ============================================================================
   FOOTER  (.ft) — DSB §4.6 / handoff §Footer (global; renders on every page)
   Brand lockup + tagline, Instagram button, decorative mosaic tile strip
   (colours via nth-child — no inline styles), legal line.
   ============================================================================ */
.ft {
  padding: 56px 0 34px;
  background: var(--sage-900);
  color: var(--on-dark-muted);
}

.ft-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
  padding-bottom: 36px;
  border-bottom: 1px solid color-mix(in srgb, var(--surface) 10%, transparent); /* rgba(255,255,255,.1) */
}

.ft .brand-mark {
  height: 28px;
}

.ft .brand-wm {
  color: var(--primary-ink);
}

.ft-tagline {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage-300);
}

/* Decorative mosaic tile strip. */
.ft-strip {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 5px;
  margin: 30px 0;
}

.ft-strip .t {
  aspect-ratio: 1;
  border-radius: var(--r-xs); /* 4px */
  background: var(--sage-700);
}

.ft-strip .t:nth-child(3n) { background: var(--sage-500); }
.ft-strip .t:nth-child(4n) { background: var(--sage-800); }
.ft-strip .t:nth-child(5n) { background: transparent; }
.ft-strip .t:nth-child(7n) { background: var(--sage-300); }
.ft-strip .t:nth-child(11n) { background: var(--clay-500); }

.ft-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.ft-bot-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ft-link {
  color: var(--on-dark-muted);
  transition: color var(--dur) var(--ease);
}

.ft-link:hover {
  color: var(--primary-ink);
}

.ft-sep {
  color: color-mix(in srgb, var(--surface) 25%, transparent);
}

/* ============================================================================
   DEFAULT PAGES (.page-body) — Privacy and other utility Pages (MOS-125).
   Readable prose from tokens; in-prose link styling comes from the IN-PROSE
   LINKS block above.
   ============================================================================ */
/* Top/bottom only — leave `.wrap` to own the horizontal gutter (combined on
   the same element; a `padding` shorthand here would zero the side padding). */
.page-body {
  padding-top: 72px;
  padding-bottom: 96px;
}

.page-title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h1);
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
  margin: 0 0 6px;
}

.page-body .entry-content {
  max-width: 70ch;
  color: var(--ink-700);
}

.page-body .entry-content h2 {
  font-size: var(--fs-h3);
  margin: 1.8em 0 0.5em;
}

.page-body .entry-content p,
.page-body .entry-content ul {
  margin: 0 0 1.1em;
}

.page-body .entry-content li {
  margin: 0 0 0.4em;
}
