/* ============================================================
   D'Amico Digital — Reset, typography, layout primitives
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--shadow);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--focus-ring, var(--oxblood));
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--oxblood); color: var(--cream); }

/* ---- Skip link ------------------------------------------- */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--oxblood);
  color: var(--cream);
  padding: 12px 22px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-size: var(--fs-meta);
  font-weight: 600;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--sec-fg, var(--shadow));
  text-wrap: balance;
}

.h1, h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  letter-spacing: var(--ls-display);
}

.h2, h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-display);
}

.h3, h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-display);
}

/* The reference signature: trailing clause drops back. */
.dim { color: var(--sec-dim); }

p { color: var(--sec-muted, rgb(var(--shadow-rgb) / .65)); }

.lead {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-loose);
  color: var(--sec-muted);
  text-wrap: pretty;
}

.meta {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--sec-faint);
  letter-spacing: 0;
}

/* Handwritten section eyebrow + its little arrow */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-script);
  font-size: var(--fs-eyebrow);
  line-height: 1;
  color: var(--sec-eyebrow);
  transform: rotate(-3deg);
  transform-origin: left center;
}
.eyebrow svg { flex: none; width: 60px; height: auto; opacity: .85; }

/* Accent word inside a heading. Resolves through --sec-eyebrow, which is the
   theme-aware "legible gold": #8A6224 on light grounds (5.10:1) and full
   #D8B168 on dark ones (7.62:1). Raw --gold would fail on cream at 1.89:1. */
.accent { color: var(--sec-eyebrow); }

/* System Tag (brand doc §3.3): Space Mono, uppercase, wide tracking.
   Used for every micro-label — chips, add-on tags, plan names, column
   headings, form labels. */
.label,
.chip,
.drawer__title,
.footer__col h3,
.price__name,
.price__flag,
.addon__tag,
.collage__tag,
.field label,
.work-card__type {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}

.label {
  font-size: 0.75rem;
  color: var(--sec-faint);
}

/* ============================================================
   Layout primitives
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sec {
  position: relative;
  background: var(--sec-bg);
  color: var(--sec-fg);
  padding-block: var(--section-y);
}

/* Opt-in divider so two same-coloured sections can still read apart */
.sec--edge { border-top: 1px solid var(--sec-hairline); }

/* Section intro block: eyebrow + h2 + lead */
.sec-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.sec-head .eyebrow { margin-bottom: 1.25rem; }
.sec-head h2 { margin-bottom: 1.25rem; }

.sec-head--compact h2 { font-size: clamp(1.875rem, 3.4vw, 2.625rem); }

.sec-head--center { margin-inline: auto; text-align: center; }
.sec-head--center .eyebrow { transform: rotate(-2deg); }

/* Grids */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================
   Buttons — theme-token driven, so they invert automatically
   ============================================================ */

.btn {
  --btn-py: 16px;
  --btn-px: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--btn-py) var(--btn-px);
  min-height: 44px;
  border-radius: var(--r-default);
  font-size: var(--fs-body);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .28s var(--ease), border-color .28s var(--ease),
              color .28s var(--ease), transform .28s var(--ease);
}
.btn:active { transform: translateY(1px); }

/* The Spotlight. The border is not in the brand doc but is required:
   #D8B168 sits at 1.89:1 against the canvas, so without an edge the
   button has no perceivable boundary (WCAG 1.4.11 asks for 3:1). It is
   transparent on dark grounds, where gold already clears 7.62:1. */
.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  box-shadow: var(--btn-shadow);
}
.btn--primary:hover {
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  color: var(--btn-ghost-fg);
  border: 1px solid var(--btn-ghost-bd);
}
.btn--ghost:hover {
  background: var(--btn-ghost-bg-hover);
  border-color: var(--sec-hairline-strong);
}

.btn--sm { --btn-py: 12px; --btn-px: 20px; font-size: 0.9375rem; font-weight: 600; }
.btn--block { display: flex; width: 100%; }

/* Hover slide-up label (the reference duplicates its labels) */
.btn__label {
  display: block;
  position: relative;
  overflow: hidden;
}
.btn__label span {
  display: block;
  transition: transform .38s var(--ease);
}
.btn__label span:last-child {
  position: absolute;
  inset: 0;
  transform: translateY(105%);
}
.btn:hover .btn__label span:first-child { transform: translateY(-105%); }
.btn:hover .btn__label span:last-child  { transform: translateY(0); }

/* Text link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--sec-accent);
}
.link-arrow svg { transition: transform .3s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ============================================================
   Chips / pills
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--sec-hairline);
  background: var(--sec-surface);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--sec-muted);
}
.chip--accent { border-color: var(--sec-rule); color: var(--sec-accent); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sec-accent);
  position: relative;
  flex: none;
}
.dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping {
  0%        { transform: scale(1);   opacity: .7; }
  75%, 100% { transform: scale(2.6); opacity: 0;  }
}

/* ============================================================
   Scroll reveal — JS adds .is-in
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* No JS? Show everything. */
.no-js .reveal { opacity: 1; transform: none; }

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .dot::after { display: none; }
}

/* Consecutive lead paragraphs in a section intro need separating — without
   this they run together as one block. */
.sec-head .lead + .lead { margin-top: 1rem; }
