/* ==========================================================================
   TECH CPR — shared styles
   Loaded by every page. Edit here once instead of in seven files.
   ========================================================================== */

:root {
  --red: #E30613;
  --gold: #D4AF37;
  /* Height of the fixed nav. main.js measures the real nav and overwrites
     this on load/resize; the value below is the pre-JS fallback. */
  --nav-h: 96px;
}

body {
  background: #050505;
  color: white;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* --- Hero ---------------------------------------------------------------- */

.hero-bg {
  background: linear-gradient(180deg, #0a0a0a 0%, #1a0000 50%, #050505 100%);
  /* Clears the fixed nav instead of sliding under it. */
  padding-top: calc(var(--nav-h) + 2rem);
  padding-bottom: 4rem;
}

/* Interior pages: tall enough to feel intentional, short enough that real
   content is visible without scrolling a full screen. */
.hero-bg { min-height: 60vh; }

/* Home page hero gets more room. */
.hero-bg.hero-tall { min-height: 84vh; }

.scanline {
  position: absolute; inset: 0;
  background: linear-gradient(transparent, rgba(227, 6, 19, 0.18), transparent);
  background-size: 100% 400%;
  animation: scan 10s linear infinite;
  pointer-events: none;
  z-index: 2;
  opacity: 0.6;
}
@keyframes scan {
  0%   { background-position: 0 0; }
  100% { background-position: 0 400%; }
}

.disassembly-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.25;
  mix-blend-mode: screen;
  pointer-events: none;
}
.phone-part {
  position: absolute;
  transition: all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
  color: var(--gold);
  filter: drop-shadow(0 0 25px var(--gold));
}

/* --- Brand bits ---------------------------------------------------------- */

/* The logo is a wide horizontal lockup with black text, so it needs a white
   plate behind it. A rounded rectangle fits the 3.5:1 shape; a circle left
   most of the plate empty and shrank the artwork. */
.logo-bg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
}

.heartbeat { animation: beat 1.4s infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* Red -> gold -> red wordmark gradient. */
.text-flatline {
  background-image: linear-gradient(to right, #ef4444, var(--gold), #ef4444);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- Buttons ------------------------------------------------------------- */

.btn-primary,
.btn-outline {
  padding: 18px 32px;
  font-size: 1.25rem;
  font-weight: bold;
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 9999px;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-outline {
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

@media (min-width: 768px) {
  .btn-primary,
  .btn-outline { width: auto; padding: 20px 48px; }
}

/* --- Forms --------------------------------------------------------------- */

.field {
  width: 100%;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  color: white;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field:hover { border-color: rgba(255, 255, 255, 0.35); }
.field:focus {
  border-color: var(--red);
  /* Keeps a visible focus indicator for keyboard users. */
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.35);
}

/* Visible focus ring on every other interactive element too. */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.form-note {
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.form-note-ok    { background: rgba(22, 163, 74, 0.15); border: 1px solid rgba(22, 163, 74, 0.5); }
.form-note-error { background: rgba(227, 6, 19, 0.12); border: 1px solid rgba(227, 6, 19, 0.5); }


/* --- Inline SVG icons -----------------------------------------------------
   Sized in em so the existing text-3xl / text-5xl classes still control them,
   exactly as they did when these were Font Awesome <i> tags.
   ------------------------------------------------------------------------ */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  fill: currentColor;
}

/* The menu button holds both icons and swaps them on aria-expanded, rather
   than main.js rewriting its innerHTML. */
#mobile-menu-button .icon-close { display: none; }
#mobile-menu-button[aria-expanded="true"] .icon-open { display: none; }
#mobile-menu-button[aria-expanded="true"] .icon-close { display: inline-block; }

/* --- Price list filter --------------------------------------------------- */

.chip {
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4d4d8;
  transition: all 0.2s ease;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip-on {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.chip-on:hover { color: white; border-color: var(--red); }

/* --- Device cards, collapsed ---------------------------------------------
   The original card look, just closed by default. Built on <details> so the
   prices stay in the page source and stay indexable, and so it still works
   with JavaScript off.
   ------------------------------------------------------------------------ */

.filter-row { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
@media (min-width: 768px) {
  .filter-row { grid-template-columns: 1.4fr 1fr; }
}
.device-select { cursor: pointer; }
.device-select option { background: #18181b; }

.family-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 3rem 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--gold);
}
.family-head i { font-size: 1.15rem; opacity: 0.8; }
.family-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 9999px;
  padding: 0.15rem 0.6rem;
}
/* Hairline that fills the rest of the row. */
.family-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(212, 175, 55, 0.35), transparent);
}

.device-grid { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 768px) {
  .device-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

.device-card {
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.device-card:hover { border-color: rgba(255, 255, 255, 0.28); transform: translateY(-2px); }
.device-card[open] {
  border-color: rgba(227, 6, 19, 0.55);
  transform: none;
}

/* Collapsed row is just the icon and the device name - the prices live in
   the expanded panel and in the dropdown, so the row stays short. */
.device-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.2rem;
}
.device-card > summary::-webkit-details-marker { display: none; }

@media (min-width: 768px) {
  .device-card > summary { gap: 1rem; padding: 1.1rem 1.4rem; }
}

.dev-icon {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.8rem;
  background: rgba(227, 6, 19, 0.12);
  color: #ef4444;
  font-size: 1.05rem;
}

.dev-name {
  flex: 1;
  min-width: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}
@media (min-width: 768px) { .dev-name { font-size: 1.25rem; } }

/* Chevron. */
.device-card > summary::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-left: 0.25rem;
  border-right: 2px solid #71717a;
  border-bottom: 2px solid #71717a;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}
.device-card[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }

.dev-list {
  padding: 0 1.6rem 1.5rem;
  margin-top: -0.3rem;
}
.dev-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Screen grade badges, colour coded so the options read at a glance. */
.grade {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 9999px;
  padding: 0.12rem 0.6rem;
  border: 1px solid;
}
.grade-lcd        { color: #d4d4d8; border-color: rgba(255, 255, 255, 0.25); }
.grade-oled       { color: #d4d4d8; border-color: rgba(255, 255, 255, 0.25); }
.grade-soft-oled  { color: var(--gold); border-color: rgba(212, 175, 55, 0.5); }
.grade-hard-oled  { color: #f87171; border-color: rgba(248, 113, 113, 0.5); }

/* Briefly mark the device someone jumped to. */
.device-card.just-jumped { border-color: var(--gold); }

/* Visible only to screen readers. */
.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;
}

/* --- Motion preferences -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .heartbeat,
  .scanline { animation: none; }
  .phone-part { transition: none; }
  * { scroll-behavior: auto !important; }
}
