/* ==========================================================================
   Payday Wings — main.css
   Design system foundation: fonts, custom properties, reset, typography,
   layout containers, grid, buttons, base forms, utilities.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Self-hosted fonts (WOFF2, variable)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope/manrope-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope/manrope-latin-ext.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter/inter-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /*
   * Neutral base (charcoal + white) with soft pastel accents.
   * Interactive elements are charcoal rather than a brand colour, so inline
   * links are underlined to stay distinguishable without relying on colour.
   */

  /* Brand colours */
  --color-primary: #1C1C1C;
  --color-brand: #1C1C1C;
  --color-accent: #FBC94A;
  --color-background: #F4F4F4;
  --color-white: #FFFFFF;
  --color-text: #1C1C1C;
  --color-muted: #6E6E6E;
  --color-border: #E6E6E6;
  --color-success: #16865C;
  /* Deepened from the brief's #D97706, which fell to 2.91:1 on the warning
     icon chip and failed the 3:1 non-text minimum. This clears 4.5:1, so it
     stays legible if a cost notice ever needs it as text. */
  --color-warning: #B45309;

  /* Derived brand shades */
  --color-primary-light: #262626;
  --color-primary-soft: #333333;
  --color-brand-dark: #000000;
  --color-brand-darker: #000000;
  --color-brand-tint: #F4F4F4;
  --color-accent-tint: #FDF3D7;
  --color-accent-deep: #8A6510;
  --color-warm-neutral: #FBF7F1;
  --color-warm-border: #EDE0CF;
  --color-success-tint: #E8F5F0;

  /* Pastel accents — decorative only, never behind text */
  --color-peach: #F8D5BB;
  --color-periwinkle: #AFBEEC;
  --color-pink: #F2C6BE;

  /* Amber glow under the primary button. Channels, not a hex, because rgba()
     cannot take a hex custom property and the glow needs several alphas. */
  --accent-glow-rgb: 247, 194, 64;

  /* Typography */
  --font-primary: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --fs-eyebrow: 0.8125rem;
  --fs-small: 0.9375rem;
  --fs-body: 1.0625rem;
  --fs-body-lg: 1.125rem;
  --fs-h3: 1.375rem;
  --fs-h2: 2.5rem;
  --fs-h1: 3.375rem;
  --fs-display: 4rem;

  --lh-tight: 1.15;
  --lh-heading: 1.25;
  --lh-body: 1.7;

  /* Layout */
  --container-width: 1240px;
  --container-narrow: 780px;
  --container-gutter: 24px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 56px;
  --space-9: 72px;
  --space-10: 96px;
  --section-padding: 104px;

  /* Radii */
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 18px;
  --radius-pill: 999px;
  --radius-button: 10px;

  /* Borders & shadows — soft borders preferred over heavy shadows */
  --border-hairline: 1px solid var(--color-border);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.04), 0 16px 40px rgba(0, 0, 0, 0.07);
  --shadow-float: 0 4px 12px rgba(0, 0, 0, 0.05), 0 24px 64px rgba(0, 0, 0, 0.1);

  /* Motion.
     --transition-default and --transition-fast already bundle a timing
     function, so do not append another easing after them — two timing
     functions make the whole declaration invalid and the browser drops it.
     Pair --duration-* with --ease-out-soft instead. */
  --transition-default: 250ms ease;
  --transition-fast: 200ms ease;
  --duration-base: 250ms;
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);

  /*
   * Layers. The scrim and drawer both live inside .site-header, so these are
   * resolved against each other inside the header's stacking context. Header
   * content stays below both: the drawer covers it and supplies its own logo
   * and close button.
   */
  --z-sticky-cta: 90;
  --z-header: 100;
  --z-scrim: 199;
  --z-drawer: 200;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

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

/*
 * `clip` rather than `hidden`: the closed mobile drawer is parked off-screen
 * to the right and would otherwise extend the document's scrollable width.
 * `hidden` would suppress the scrollbar but turns the element into a scroll
 * container, which breaks the sticky header. `clip` crops without that.
 */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

figure {
  margin: 0;
}

hr {
  border: none;
  border-top: var(--border-hairline);
  margin: var(--space-7) 0;
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-primary);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.02em;
  color: var(--color-primary);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
}

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

p:last-child {
  margin-bottom: 0;
}

/*
 * Links are charcoal, the same as body text, so the underline — not colour —
 * is what marks them. Underlined by default and opted out per component for
 * navigation and buttons (see components.css §0), which read as links from
 * their shape and position instead.
 */
a {
  color: var(--color-brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-thickness var(--transition-fast);
}

a:hover {
  color: var(--color-brand-darker);
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 600;
  color: var(--color-primary);
}

small {
  font-size: var(--fs-small);
}

/* Visible keyboard focus — WCAG 2.2 AA */
:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: var(--radius-small);
}

::selection {
  background: var(--color-brand);
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   5. Layout
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-padding);
  position: relative;
}

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

.section--ice {
  background-color: var(--color-background);
}

.section--navy {
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.78);
}

.section--warm {
  background-color: var(--color-warm-neutral);
}

/* 12-column grid */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-6);
}

.grid--gap-lg {
  gap: var(--space-7);
}

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* --------------------------------------------------------------------------
   6. Section headings
   -------------------------------------------------------------------------- */

.section-heading {
  max-width: 1180px;
  margin-bottom: var(--space-8);
}

.section-heading--centred {
  margin-inline: auto;
  text-align: center;
}

.section-heading p {
  font-size: var(--fs-body-lg);
  color: var(--color-muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-family: var(--font-primary);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-brand);
}

.section--navy .eyebrow {
  color: var(--color-accent);
}

.section--navy h2,
.section--navy h3 {
  color: var(--color-white);
}

.section--navy p {
  color: rgba(255, 255, 255, 0.72);
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-default),
    border-color var(--transition-default), color var(--transition-default),
    transform var(--transition-default), box-shadow var(--transition-default);
}

.btn:hover {
  text-decoration: none;
}

.btn svg {
  flex-shrink: 0;
  transition: transform var(--transition-default);
}

.btn--primary {
  background-color: var(--color-brand);
  border-color: var(--color-brand);
  color: var(--color-white);
  box-shadow: 0 1px 2px rgba(var(--accent-glow-rgb), 0.2),
    0 8px 20px rgba(var(--accent-glow-rgb), 0.18);
}

.btn--primary:hover {
  background-color: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(var(--accent-glow-rgb), 0.22),
    0 12px 28px rgba(var(--accent-glow-rgb), 0.26);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background-color: var(--color-white);
  border-color: var(--color-border);
  color: var(--color-primary);
}

.btn--secondary:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
  background-color: var(--color-brand-tint);
}

.btn--ghost {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--color-white);
}

.btn--ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--color-white);
}

.btn--small {
  min-height: 40px;
  padding: 9px 18px;
  font-size: var(--fs-small);
}

.btn--large {
  min-height: 54px;
  padding: 16px 32px;
  font-size: 1.0625rem;
}

.btn--block {
  width: 100%;
}

/* Text link with directional arrow — reinforces the forward-motion idea */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-brand);
  text-decoration: none;
}

.link-arrow::after {
  content: '';
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url('../images/icons/arrow-right.svg') center / contain no-repeat;
  mask: url('../images/icons/arrow-right.svg') center / contain no-repeat;
  transition: transform var(--transition-default);
}

.link-arrow:hover {
  text-decoration: none;
  color: var(--color-brand-darker);
}

.link-arrow:hover::after {
  transform: translateX(4px);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   8. Base form styles
   -------------------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: var(--space-4);
}

.field__label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-primary);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-primary);
}

.field__hint {
  display: block;
  margin-top: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  font-size: var(--fs-body);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #D4D4D4;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(28, 28, 28, 0.14);
}

.select {
  appearance: none;
  padding-right: 42px;
  background-image: url('../images/icons/chevron-down.svg');
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
  cursor: pointer;
}

.textarea {
  min-height: 132px;
  resize: vertical;
}

/* Invalid state is carried by border AND an adjacent message, never colour
   alone. aria-invalid is set by the validation script. */
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--color-warning);
}

.input[aria-invalid='true']:focus,
.select[aria-invalid='true']:focus,
.textarea[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.16);
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: var(--space-2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-warning);
}

.field__error::before {
  content: '';
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
  background-color: currentColor;
  -webkit-mask: url('../images/icons/alert-triangle.svg') center / contain no-repeat;
  mask: url('../images/icons/alert-triangle.svg') center / contain no-repeat;
}

.field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.checkbox {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin: 2px 0 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.field--checkbox .field__label {
  margin-bottom: 0;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   9. Utilities
   -------------------------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 999;
  padding: 12px 20px;
  background-color: var(--color-brand);
  color: var(--color-white);
  border-radius: var(--radius-small);
  font-family: var(--font-primary);
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-white);
  text-decoration: none;
}

.text-muted { color: var(--color-muted); }
.text-centre { text-align: center; }
.lead { font-size: var(--fs-body-lg); color: var(--color-muted); }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.list-reset {
  list-style: none;
}

/* Scroll reveal — opt-in, honours reduced motion (see §10) */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease-out-soft), transform 600ms var(--ease-out-soft);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   10. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
