/* ==========================================================================
   PNG To DDS — main.css
   Design system: tokens, reset, base typography, layout primitives.
   Theme: "Texture Lab" — crisp near-white surfaces, decisive red action
   accent, deep slate ink, Trustpilot green reserved for ratings.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette */
  --red: #FF4335;          /* primary action accent */
  --red-deep: #E22E20;     /* pressed / links on light */
  --red-soft: #FFE9E7;     /* soft red tint surface */
  --white: #FFFFFF;
  --off: #FBFBFB;          /* page background */
  --rating: #00B67A;       /* Trustpilot green — ratings only */
  --rating-soft: #E4F7F0;

  /* Ink / slate scale */
  --ink: #171A1F;          /* near-black slate ink */
  --slate-900: #1F242C;
  --slate-800: #2B323C;    /* dark surface */
  --slate-700: #3A424E;
  --slate-500: #667085;    /* muted body text */
  --slate-400: #8A93A2;
  --slate-200: #E4E7EC;    /* borders */
  --slate-100: #F1F3F6;    /* subtle fills */

  /* Semantic assignments */
  --bg-page: var(--off);
  --bg-surface: var(--white);
  --bg-dark: var(--slate-900);
  --text-body: var(--slate-700);
  --text-heading: var(--ink);
  --text-muted: var(--slate-500);
  --text-on-dark: #D9DEE7;
  --accent: var(--red);
  --link: var(--red-deep);
  --link-hover: var(--ink);
  --border: var(--slate-200);
  --success: #0E9F6E;
  --error: #D92D20;

  /* Type families */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Fluid type scale */
  --fs-hero: clamp(2.4rem, 1.55rem + 3.6vw, 4.25rem);
  --fs-h1: clamp(2rem, 1.35rem + 2.6vw, 3.1rem);
  --fs-h2: clamp(1.6rem, 1.18rem + 1.7vw, 2.4rem);
  --fs-h3: clamp(1.22rem, 1.05rem + 0.75vw, 1.5rem);
  --fs-h4: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-lead: clamp(1.05rem, 1rem + 0.45vw, 1.25rem);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Shadows (cool-tinted) */
  --shadow-sm: 0 1px 2px rgba(23, 26, 31, 0.05), 0 1px 3px rgba(23, 26, 31, 0.07);
  --shadow-md: 0 6px 18px rgba(23, 26, 31, 0.07), 0 2px 6px rgba(23, 26, 31, 0.05);
  --shadow-lg: 0 20px 46px rgba(23, 26, 31, 0.12), 0 6px 14px rgba(23, 26, 31, 0.07);
  --shadow-red: 0 10px 28px rgba(255, 67, 53, 0.30);

  /* Layout */
  --container: 1180px;
  --container-narrow: 780px;
  --header-h: 70px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 200ms;
}

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

* { margin: 0; }

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

[id] { scroll-margin-top: calc(var(--header-h) + 1.25rem); }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

[hidden] { display: none !important; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

ul, ol { padding-left: 1.25rem; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: auto;
  transition: color var(--dur) var(--ease),
              text-decoration-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}
a:focus-visible { text-decoration-thickness: 2px; }

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-heading);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { max-width: 68ch; }

/* ---------- Focus keyword accent ---------- */
.kw { color: var(--red-deep); font-weight: inherit; }
.kw-link { color: var(--red-deep); font-weight: 600; }
/* On dark surfaces the deep red loses contrast, so lift it. */
.section--dark .kw,
.section--dark .kw-link { color: #FF8A7E; }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--space-9); }
.section--tight { padding-block: var(--space-7); }

.section--dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  background-image:
    radial-gradient(60% 120% at 15% 0%, rgba(255,67,53,0.16), transparent 60%),
    radial-gradient(50% 100% at 100% 100%, rgba(255,67,53,0.10), transparent 55%);
}
.section--dark h1,
.section--dark h2,
.section--dark h3 { color: #fff; }

.section--slate { background: var(--slate-100); }
.section--soft { background: var(--red-soft); }

.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.flow > * + * { margin-top: var(--space-4); }

.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

/* ---------- Section heads ---------- */
.section-head { margin-bottom: var(--space-7); max-width: 62ch; }
.section-head--center { margin-inline: auto; text-align: center; }

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-deep);
}
.section-eyebrow::before {
  content: "";
  width: 22px; height: 2px;
  background: var(--red);
  display: inline-block;
}
.section-head--center .section-eyebrow::before { display: none; }
.section--dark .section-eyebrow { color: #FF7A70; }

.section-title { font-size: var(--fs-h2); margin-top: var(--space-3); }
.section-intro {
  font-size: var(--fs-lead);
  color: var(--text-muted);
  margin-top: var(--space-4);
  max-width: 60ch;
}
.section--dark .section-intro { color: var(--text-on-dark); }
.section-head--center .section-intro { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); color: var(--btn-fg); }
.btn:active { transform: translateY(0); }

.btn--primary { --btn-bg: var(--red); --btn-fg: #fff; box-shadow: var(--shadow-red); }
.btn--primary:hover { --btn-bg: var(--red-deep); box-shadow: 0 14px 34px rgba(255,67,53,0.38); }

.btn--secondary {
  --btn-bg: var(--white); --btn-fg: var(--ink);
  border-color: var(--slate-200);
  box-shadow: var(--shadow-sm);
}
.btn--secondary:hover { --btn-bg: var(--white); border-color: var(--ink); }

.btn--on-dark { --btn-bg: var(--red); --btn-fg: #fff; box-shadow: var(--shadow-red); }
.btn--on-dark:hover { --btn-bg: var(--red-deep); }

.btn--ghost-dark {
  --btn-bg: transparent; --btn-fg: #fff;
  border-color: rgba(255,255,255,0.28);
}
.btn--ghost-dark:hover { --btn-bg: rgba(255,255,255,0.08); --btn-fg: #fff; border-color: rgba(255,255,255,0.5); }

.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--slate-500);
  border-color: var(--border);
}
.btn--ghost:hover { --btn-bg: var(--white); --btn-fg: var(--ink); border-color: var(--slate-400); }

.btn--sm { padding: 0.6rem 1.05rem; font-size: 0.9rem; }

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn:disabled:hover,
.btn[disabled]:hover { transform: none; box-shadow: none; }

.btn__icon { width: 18px; height: 18px; flex: none; }
.btn__arrow { width: 18px; height: 18px; flex: none; transition: transform var(--dur) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---------- Chips ---------- */
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-deep);
  background: var(--red-soft);
  padding: 0.34rem 0.7rem;
  border-radius: var(--radius-pill);
}
.chip--gold { color: var(--slate-800); background: var(--slate-100); }

/* ---------- Rating stars (Trustpilot green) ---------- */
.rating { display: inline-flex; align-items: center; gap: 0.5rem; }
.rating__stars { display: inline-flex; gap: 2px; }
.rating__stars svg { width: 18px; height: 18px; color: var(--rating); }
.rating__text { font-size: var(--fs-small); color: var(--text-muted); }
.rating__text b { color: var(--text-heading); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding-block: var(--space-5) 0; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  font-size: var(--fs-small);
  color: var(--text-muted);
}
.breadcrumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--slate-400); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover {
  color: var(--red-deep);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
}
.breadcrumbs [aria-current="page"] { color: var(--text-heading); font-weight: 500; }

/* ---------- Reveal on scroll ----------
   Added by main.js only when IntersectionObserver exists, so nothing can stay
   invisible without JS. `transform: none` once revealed hands the element
   back to its own :hover rule in the later stylesheets. */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@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;
  }
}
