/* HARDGAP Global Styles
   Reset, base styles, and layout primitives.
   All values reference tokens from tokens.css. */

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* The [hidden] attribute is how every script on this site shows and conceals
   things. The UA stylesheet implements it as `[hidden] { display: none }`,
   which any authored display rule outranks on specificity — so a button or a
   badge given `display: inline-flex` below ignores it and renders anyway.
   That is not hypothetical: it put a "Sign out" control in front of every
   signed-out visitor and pinned a permanent "0" to the cart badge. */
[hidden] {
  display: none !important;
}

/* The universal margin reset above strips dialog's UA `margin: auto`, which is
   what centres a modal in the viewport — without this it pins to the top-left
   corner. */
dialog {
  margin: auto;
}

/* No page may scroll sideways. Wide content scrolls inside its own
   container (see .table-scroll), never by dragging the whole document. */
html, body {
  overflow-x: hidden;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Sticky footer. Without this, short pages — the empty cart, 404, the
   password reset form — left the footer floating in the middle of the screen
   with a few hundred pixels of dead black beneath it. The nav is fixed, so it
   sits outside the flex flow; <main> takes the slack and the footer settles on
   the bottom edge. Every page has exactly one <main>. */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* width:100% is not redundant. Several pages centre <main> with
   `margin: 0 auto`, and an auto cross-axis margin switches off the flex
   container's default stretch — the box then shrink-to-fits and the whole
   page collapses to the width of its longest line. */
body > main {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
}

body > .footer {
  flex-shrink: 0;
}

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

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* Section headings on the landing page are set in the display face with wide
   tracking — the visual language of a spec sheet, which is what the audience
   reads before deciding. */
h2 {
  letter-spacing: 0.08em;
}

/* Keyboard focus must be obvious. The default ring disappears against a near
   black background on several browsers. */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* Bypass the fixed nav and the hero for anyone tabbing in. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  padding: var(--space-1) var(--space-2);
  font-weight: 600;
}

.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

/* Lede paragraph under a section heading */
.section-lede {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}

/* Sign out is an action rather than a link, but it sits shoulder to shoulder
   with CART and ACCOUNT in the same row. Styling it as body text made it read
   as a stray word dropped next to the nav rather than a peer of it, so it
   borrows the nav link typography and keeps only the button reset. */
.nav-signout {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.nav-signout:hover {
  color: var(--text-primary);
}

/* Inline status line for cart and form actions */
.store-status {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.store-status.is-error { color: var(--accent-danger); }
.store-status.is-success { color: var(--accent-primary); }

button:disabled, .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* Utility text */
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--text-accent); }
.text-gold { color: var(--accent-gold); }
.text-mono { font-family: var(--font-mono); }

/* Navigation — shared across all pages */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background-color: transparent;
  transition: background-color var(--transition-base);
}

.nav.scrolled {
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
}

.nav-links a,
.nav-links button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 2px;
}

.nav-links a {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* NFC near-field background layer, created by /js/nfc-field.js when the
   feature flag is on. Fixed rather than absolute so it does not add to
   document height, and inset:0 with no width:100vw, because 100vw includes the
   scrollbar gutter and would trip the overflow-x guard above. */
.nfc-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: block;
}

/* The band layer is a grid-resolution canvas — around 145x91 — stretched to the
   viewport here rather than in JS. Upscaling it with drawImage cost ~50ms a
   frame without a GPU; the compositor does the same bilinear filter for free.
   width/height rather than a transform, so it reflows with the viewport. */
.nfc-field-bands {
  width: 100%;
  height: 100%;
}

/* Strokes sit above the bands. Both are behind all content. */
.nfc-field-lines {
  z-index: -1;
}

/* Shared footer.
   Every page ships the same footer markup, so it is styled here rather than
   in a page stylesheet. It used to live in landing.css, which only the landing
   page loads — the other fifteen pages rendered the link row as a bare
   bulleted list. */
.footer {
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  padding: var(--space-8) var(--space-3);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-bottom: var(--space-2);
  list-style: none;
}

/* Inline anchors default to a 17px box on a 13px font, under the 24px WCAG
   2.5.8 target and genuinely hard to hit where links sit shoulder to
   shoulder. inline-flex is what lets min-height apply. */
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* Utility spacing classes */
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.text-sm { font-size: 0.8125rem; }
.inline-flex { display: inline-flex; }
.flex-row { display: flex; gap: var(--space-2); }

/* Recent orders links on account dashboard */
.recent-order-link {
  display: block;
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
}

/* Order item detail styling */
.order-item-detail {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-default);
}

.order-item-name {
  font-weight: 600;
}

.order-item-edition {
  font-family: var(--font-mono);
  color: var(--accent-gold);
}

/* Address card line emphasis */
.address-line1 {
  font-weight: 600;
}

.address-badge {
  margin-top: var(--space-1);
  display: inline-block;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.container-narrow {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* Buttons */
button, .btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-base);
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(100, 210, 255, 0.3);
  text-decoration: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  text-decoration: none;
}

.btn-gold {
  background-color: var(--accent-gold);
  color: var(--bg-primary);
}

.btn-gold:hover {
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.3);
  text-decoration: none;
}

.btn-danger {
  background-color: var(--accent-danger-fill);
  color: var(--text-primary);
}

/* Forms */
input, textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-1) var(--space-2);
  width: 100%;
  transition: border-color var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

/* Cards / Surfaces */
.surface {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-base);
  padding: var(--space-3);
}

.elevated {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-base);
  padding: var(--space-3);
}

/* Visually hidden (accessible) */
.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;
}

/* Status badges */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
}

.badge-success {
  background-color: var(--accent-success);
  color: var(--text-primary);
}

.badge-gold {
  background-color: var(--accent-gold);
  color: var(--bg-primary);
}

.badge-danger {
  background-color: var(--accent-danger);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }

  .container, .container-narrow {
    padding: 0 var(--space-2);
  }
}

/* Horizontally scrollable wrapper for content that cannot reflow narrower —
   the specification table and the legal processor tables. The scroll lives
   here so the page body never has to. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-3);
  /* A hairline on the trailing edge signals there is more to the right. */
  background:
    linear-gradient(to right, var(--bg-primary) 30%, rgba(0, 0, 0, 0)) left / 24px 100% no-repeat,
    linear-gradient(to left, var(--bg-primary) 30%, rgba(0, 0, 0, 0)) right / 24px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0)) left / 12px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0)) right / 12px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}

.table-scroll > table {
  min-width: 520px;
}

/* Nav on a narrow screen: the label set has to shrink or it runs off the
   edge. Journey is the first thing to go — it is reachable from the footer
   of every page. */
@media (max-width: 560px) {
  .nav {
    padding: var(--space-1) var(--space-2);
  }

  .nav-logo {
    font-size: 0.9375rem;
    letter-spacing: 0.2em;
  }

  .nav-links {
    gap: var(--space-2);
    font-size: 0.8125rem;
  }

  .nav-links li:first-child {
    display: none;
  }
}
