/* ==========================================================================
   Panelicious — Base
   Reset, typography, layout primitives, buttons.
   ========================================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

::selection { background: var(--red); color: var(--offwhite); }

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

/* --- Headings: Michroma, display only --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-lead); }

p { margin: 0 0 1em; max-width: 62ch; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 400; color: var(--red); } /* Varela ships one weight; emphasise with colour */

/* --- Layout primitives --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}
.container--wide { max-width: var(--container-wide); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.62); }

/* Dark surfaces */
.on-dark {
  background: var(--bg-dark);
  color: var(--ink-invert);
}
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--ink-invert); }
.on-dark p { color: var(--ink-invert-dim); }

/* Eyebrow / kicker */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}
.on-dark .eyebrow { color: var(--red); }

/* Lead / sub-head */
.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--ink-dim);
  max-width: 54ch;
}
.on-dark .lead { color: var(--ink-invert-dim); }

.measure { max-width: 60ch; }
.center { text-align: center; margin-inline: auto; }
.center .lead, .center p { margin-inline: auto; }

/* Section heading block */
.section-head { max-width: 56ch; margin-bottom: var(--gap-lg); }
.section-head.center { margin-inline: auto; }

/* Hairline divider — the "screen bezel" rule */
.hairline { border: 0; border-top: 1px solid var(--hairline); margin: 0; }
.on-dark .hairline { border-top-color: var(--hairline-dark); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1;
  padding: 0.85em 1.4em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
              border-color 0.2s var(--ease), transform 0.2s var(--ease);
  white-space: nowrap;
  transition-duration: 0.3s;
}
#main .btn:hover {
    box-shadow: 0 0 8px 2px rgba(250, 247, 245, 0.25);
    border: 1px solid rgba(250, 247, 245, 0.25);
    -webkit-transform: scale(1.03);
    transform: scale(1.03);
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--red); color: var(--offwhite); }
.btn--primary:hover { background: #ee0700; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn--ghost:hover { border-color: var(--ink); }
.on-dark .btn--ghost { color: var(--ink-invert); border-color: var(--hairline-dark-strong); }
.on-dark .btn--ghost:hover { border-color: var(--offwhite); background: rgba(250,247,245,0.06); }

.btn--lg { padding: 1em 1.6em; font-size: 1.05rem; }

.hero__copy .btn--ghost {
  background: rgba(36, 39, 44, .35);
}

/* Text link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--lightred);
  font-family: var(--font-body);
}
.link-arrow .arrow { transition: transform 0.2s var(--ease); }
.link-arrow:hover .arrow { transform: translateX(3px); }

/* --- "screen_NN · synced" status mark --- */
.synced {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--ls-mono);
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  white-space: nowrap;
}
.on-dark .synced { color: var(--ink-invert-dim); }
.synced::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(224,7,0,0.5);
  animation: syncPulse 2.6s var(--ease) infinite;
  flex: none;
}
@keyframes syncPulse {
  0%   { box-shadow: 0 0 0 0 rgba(224,7,0,0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(224,7,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,7,0,0); }
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 3px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--darkgrey); color: var(--offwhite);
  padding: 0.75em 1.25em; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
