@import "./fonts.css";
@import "./tokens.css";

/* ============================================================
   Base / reset
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* Toggling the `hidden` boolean attribute via JS (el.hidden = true) must
   always win, even over an element's own inline `style="display:..."` —
   otherwise elements that need a non-default display (flex/grid forms,
   the checkout modal steps) stay visible after being "hidden". */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-body);
  margin: 0 0 var(--space-4);
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

button,
input,
textarea {
  font: inherit;
}

:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
}

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

@keyframes tw-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   Layout helpers
   ============================================================ */
.tw-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.tw-band {
  padding-top: var(--band-pad-block);
  padding-bottom: var(--band-pad-block);
}

.tw-grid-autofit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 48px;
  align-items: center;
}

/* Lead-capture hero: gives the capture card more weight than the pitch
   column, unlike tw-grid-autofit's equal split. */
.tw-hero-lead-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 56px;
  align-items: start;
}
@media (max-width: 900px) {
  .tw-hero-lead-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes tw-pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(232, 145, 61, 0.5), var(--shadow-sm);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(232, 145, 61, 0), var(--shadow-sm);
  }
}
.tw-btn-pulse,
#tw-hero-cta {
  animation: tw-pulse-glow 2.4s var(--ease-out) infinite;
}
.tw-btn-pulse:hover,
#tw-hero-cta:hover {
  transform: translateY(-1px) scale(1.01);
}
@media (prefers-reduced-motion: reduce) {
  .tw-btn-pulse,
  #tw-hero-cta {
    animation: none;
  }
}

.tw-article-grid {
  display: grid;
  grid-template-columns: 4fr 1fr;
  align-items: start;
}

@media (max-width: 900px) {
  .tw-article-grid {
    grid-template-columns: 1fr;
  }
  .tw-article-grid aside {
    position: static;
  }
}

.tw-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
  margin: 0 0 12px;
}

.tw-eyebrow--on-dark {
  color: var(--brand-300);
}

/* ============================================================
   Card / link-card (product, review, blog cards)
   ============================================================ */
.tw-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.tw-card-link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Diagonal placeholder texture used everywhere a real photo would sit */
.tw-scene {
  position: relative;
  display: grid;
  place-items: center;
}

.tw-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.05) 0 2px,
    transparent 2px 26px
  );
  opacity: 0.5;
  pointer-events: none;
}

.tw-scene-mineral {
  background: linear-gradient(160deg, #eaf5f7 0%, #d6edf1 40%, #8fd3de 100%);
}
.tw-scene-mist {
  background: linear-gradient(160deg, #fbfdfd 0%, #ecf4f6 60%, #d6edf1 100%);
}
.tw-scene-wave {
  background: linear-gradient(160deg, #2ba6bc 0%, #1193ab 45%, var(--brand-700) 100%);
}
.tw-scene-deep {
  background: radial-gradient(120% 90% at 30% 10%, #14506a 0%, var(--deep-900) 55%, var(--deep-950) 100%);
}

.tw-scene--photo::before {
  display: none;
}

.tw-scene-label {
  position: relative;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ============================================================
   Button
   ============================================================ */
.tw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

.tw-btn:active {
  transform: translateY(1px);
}

.tw-btn--full {
  width: 100%;
}

.tw-btn--sm {
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
}
.tw-btn--md {
  font-size: 1rem;
  padding: 0.72rem 1.15rem;
}
.tw-btn--lg {
  font-size: 1.1rem;
  font-weight: var(--weight-bold);
  padding: 1rem 1.5rem;
}

.tw-btn--primary {
  background: var(--brand-primary);
  color: var(--ink-on-brand);
  box-shadow: var(--shadow-xs);
}
.tw-btn--primary:hover {
  background: var(--brand-primary-hover);
}

.tw-btn--cta {
  background: var(--accent-warm);
  color: #3a2200;
  box-shadow: var(--shadow-sm);
}
.tw-btn--cta:hover {
  background: var(--accent-warm-strong);
}

.tw-btn--secondary {
  background: var(--surface-card);
  color: var(--brand-700);
  border-color: var(--border-strong);
}
.tw-btn--secondary:hover {
  background: var(--surface-sunken);
}

.tw-btn--ghost {
  background: transparent;
  color: var(--brand-700);
}
.tw-btn--ghost:hover {
  background: var(--brand-100);
}

.tw-btn--on-dark {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-on-dark);
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px);
}
.tw-btn--on-dark:hover {
  background: rgba(255, 255, 255, 0.18);
}

.tw-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================================
   Badge
   ============================================================ */
.tw-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 0.36rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  white-space: nowrap;
}

.tw-badge--verdict {
  background: var(--brand-100);
  color: var(--brand-700);
}
.tw-badge--stock {
  background: #e4f4ea;
  color: #1f7a44;
}
.tw-badge--out-of-stock {
  background: #f6e5df;
  color: #a9411f;
}
.tw-badge--save {
  background: var(--accent-warm);
  color: #3a2200;
}
.tw-badge--neutral {
  background: var(--surface-sunken);
  color: var(--ink-muted);
}
.tw-badge--supplied {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--border-strong);
}

/* ============================================================
   Nav link
   ============================================================ */
.tw-nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(234, 245, 247, 0.82);
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.tw-nav-link:hover {
  background: rgba(143, 211, 222, 0.12);
  color: var(--brand-300);
}

.tw-footer-link {
  color: rgba(234, 245, 247, 0.78);
  text-decoration: none;
  font-size: 0.92rem;
}
.tw-footer-link:hover {
  color: var(--brand-300);
}

/* ============================================================
   Form fields
   ============================================================ */
.tw-input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--ink-body);
  width: 100%;
}

.tw-input--on-dark {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--ink-on-dark);
}
.tw-input--on-dark::placeholder {
  color: rgba(234, 245, 247, 0.6);
}

/* ============================================================
   Spinner
   ============================================================ */
.tw-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border: 4px solid var(--surface-sunken);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: tw-spin 0.9s linear infinite;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ============================================================
   Stars rating
   ============================================================ */
.stars-glyphs {
  position: relative;
  display: inline-block;
  font-size: var(--stars-size, 1rem);
  line-height: 1;
  letter-spacing: 0.08em;
  font-family: Georgia, "Times New Roman", serif;
}
.stars-track {
  color: var(--border-strong);
}
.stars-fill {
  position: absolute;
  inset: 0;
  width: var(--stars-pct, 0%);
  overflow: hidden;
  white-space: nowrap;
  color: var(--rating-fill);
}
.stars-number {
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: 0.92em;
  color: var(--text-body);
}

/* ============================================================
   Hardness checker widget
   ============================================================ */
.hc-card {
  background: var(--surface-card);
  color: var(--ink-body);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: clamp(1.25rem, 1rem + 2vw, 2rem);
}
.hc-progress {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-4);
}
.hc-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  transition: background var(--dur-med) var(--ease-standard);
}
.hc-progress-dot.is-active {
  background: var(--brand-500);
}
.hc-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-2);
}
.hc-head h3 {
  font-size: var(--text-h3);
  margin: 0;
}
.hc-sub {
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  font-size: 0.98rem;
}
.hc-form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.hc-input {
  flex: 1 1 12rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 0.72rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--text-body);
}
.hc-input--error {
  border-color: var(--accent-danger);
}
.hc-error {
  color: var(--accent-danger);
  font-size: 0.9rem;
  margin: var(--space-3) 0 0;
}
@keyframes hc-result-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hc-result-card {
  --hc-accent: var(--hard-1);
  background: color-mix(in srgb, var(--hc-accent) 14%, var(--surface-sunken));
  border-left: 6px solid var(--hc-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  animation: hc-result-in var(--dur-med) var(--ease-out);
}
.hc-result-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}
.hc-result-band {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.3em 0.85em;
  border-radius: var(--radius-pill);
  background: var(--hc-accent);
  color: #12202a;
  white-space: nowrap;
}
.hc-result-ppm {
  font-size: 1.05rem;
  font-weight: var(--weight-bold);
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}
.hc-result-ppm-note {
  margin: 0 0 var(--space-3);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.hc-result-area {
  margin: 0 0 var(--space-3);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hc-result-card h3 {
  margin: 0 0 var(--space-2);
}
.hc-result-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.hc-disclaimer {
  margin: var(--space-4) 0 0;
  font-size: 0.76rem;
  color: var(--text-faint);
}

/* ---- Address autocomplete ---- */
.hc-autocomplete-wrap {
  position: relative;
}
.hc-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  z-index: 2;
}
.hc-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-body);
  cursor: pointer;
}
.hc-suggestions button:last-child {
  border-bottom: none;
}
.hc-suggestions button:hover,
.hc-suggestions button:focus-visible {
  background: var(--surface-sunken);
}
.hc-link-btn {
  font-size: 0.84rem;
  color: var(--brand-500);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  align-self: flex-start;
}

/* ---- Result confirm chip ---- */
.hc-confirm-chip {
  font-size: 0.84rem;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  margin: var(--space-3) 0;
}

/* ---- Suggested filters (soft/slightly-hard path) ---- */
.hc-filter-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.hc-filter-card {
  display: block;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.92rem;
}
.hc-filter-card:hover {
  border-color: var(--border-strong);
}

/* ---- Lead form checkbox ---- */
.hc-checkbox-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.hc-checkbox-row input {
  margin-top: 3px;
}

/* ============================================================
   Buy Now modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 34, 47, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  overflow: hidden;
}
.modal-step[hidden] {
  display: none;
}
.modal-step {
  padding: var(--space-6);
  text-align: left;
}
.modal-step--center {
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.modal-close {
  background: var(--surface-sunken);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
}
.qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.qty-btn {
  width: 38px;
  height: 38px;
  background: var(--surface-card);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--ink-body);
}
.qty-value {
  width: 44px;
  text-align: center;
  font-weight: 600;
}
.buy-sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  margin-top: var(--space-8);
  background: var(--surface-card);
  border-top: 1px solid var(--border-card);
  box-shadow: 0 -8px 24px rgba(6, 34, 47, 0.08);
}
