/* =============================================================================
   Wombat Home Loans — Shared Stylesheet
   -----------------------------------------------------------------------------
   This is the single source of truth for design tokens, typography, layout
   and shared components across wombatloans.com.au and tomcarr.com.au.

   Section map:
     1. Reset & base
     2. Design tokens (CSS variables)
     3. Typography
     4. Layout primitives (.container, .section, .grid)
     5. Components (.btn, .card, .badge, .nav, .footer, .marquee)
     6. Utilities
     7. Motion & accessibility
   ============================================================================= */


/* -----------------------------------------------------------------------------
   1. Reset & base
   ----------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "kern" 1, "liga" 1;
}

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

a {
  color: var(--steel);
  text-decoration: none;
  transition: color var(--motion-fast) var(--easing);
}

a:hover {
  color: var(--navy);
}

button {
  font: inherit;
  cursor: pointer;
}

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


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

:root {
  /* Colour — primary palette (from brand guide) */
  --navy:        #1c476a;   /* primary brand colour */
  --navy-deep:   #060b38;   /* deepest accent, hero backgrounds */
  --steel:       #507fa9;   /* secondary, links, icons */
  --blue-light:  #97bcd7;   /* highlights, decorative */
  --blue-pale:   #cadbe5;   /* subtle backgrounds, dividers */

  /* Colour — neutrals */
  --ink:         #1a1a1a;   /* primary text */
  --ink-soft:    #4a4a4a;   /* secondary text */
  --ink-muted:   #767676;   /* meta, captions */
  --paper:       #fdfcfa;   /* off-white page background, warmer than #fff */
  --paper-warm:  #f6f1ea;   /* subtle warm section background */
  --paper-cool:  #f3f6f9;   /* subtle cool section background */
  --line:        #e6e2dc;   /* hairline borders */

  /* Colour — accents */
  --gold:        #c89a4a;   /* warm accent for emphasis (use sparingly) */
  --success:     #2f7d5c;
  --danger:      #b8443c;

  /* Typography */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Type scale — fluid via clamp(min, vw-based, max) */
  --fs-display:  clamp(2.75rem, 5.5vw + 0.5rem, 5rem);    /* 44 → 80px */
  --fs-h1:       clamp(2.25rem, 4vw + 0.5rem, 3.5rem);    /* 36 → 56px */
  --fs-h2:       clamp(1.75rem, 2.5vw + 0.5rem, 2.5rem);  /* 28 → 40px */
  --fs-h3:       clamp(1.375rem, 1.5vw + 0.5rem, 1.75rem);/* 22 → 28px */
  --fs-h4:       clamp(1.125rem, 0.75vw + 0.75rem, 1.25rem);
  --fs-body:     1.0625rem;        /* 17px — generous, easy to read */
  --fs-small:    0.9375rem;        /* 15px */
  --fs-meta:     0.8125rem;        /* 13px — labels, eyebrows, meta */

  /* Line heights */
  --lh-display:  1.05;
  --lh-heading:  1.2;
  --lh-body:     1.65;
  --lh-tight:    1.4;

  /* Spacing scale (4px base) */
  --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;
  --space-10: 8rem;

  /* Layout */
  --container-max:     1200px;
  --container-narrow:  720px;
  --container-wide:    1400px;
  --gutter:            clamp(1.25rem, 4vw, 2.5rem);
  --section-pad-y:     clamp(4rem, 8vw, 7rem);

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-pill: 999px;

  /* Shadow — soft, layered, never harsh */
  --shadow-sm:  0 1px 2px rgba(28, 71, 106, 0.06),
                0 1px 1px rgba(28, 71, 106, 0.04);
  --shadow-md:  0 4px 6px rgba(28, 71, 106, 0.06),
                0 2px 4px rgba(28, 71, 106, 0.04);
  --shadow-lg:  0 12px 24px rgba(28, 71, 106, 0.08),
                0 4px 8px rgba(28, 71, 106, 0.04);
  --shadow-xl:  0 24px 48px rgba(28, 71, 106, 0.12),
                0 8px 16px rgba(28, 71, 106, 0.06);

  /* Motion */
  --motion-fast:   180ms;
  --motion-mid:    320ms;
  --motion-slow:   600ms;
  --easing:        cubic-bezier(0.2, 0.8, 0.2, 1);
  --easing-out:    cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-index scale */
  --z-base:    1;
  --z-raised:  10;
  --z-nav:     100;
  --z-modal:   1000;
  --z-toast:   2000;
}


/* -----------------------------------------------------------------------------
   3. Typography
   -----------------------------------------------------------------------------
   Fraunces is an opsz-aware variable font; we use higher optical sizes for
   display copy so the design serifs really sing. SOFT setting `9` gives us a
   slightly softer, more humanist feel than the default. */

.display,
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-4);
  color: var(--navy-deep);
  font-variation-settings: "opsz" 80, "SOFT" 50;
  text-wrap: balance;
}

.display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: -0.025em;
  font-weight: 300;
}

h1, .h1 { font-size: var(--fs-h1); font-weight: 300; }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); font-weight: 500; font-variation-settings: "opsz" 36, "SOFT" 50; }
h4, .h4 { font-size: var(--fs-h4); font-weight: 500; font-variation-settings: "opsz" 24, "SOFT" 50; }

.display em,
h1 em, h2 em, h3 em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  color: var(--steel);
}

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

.lede {
  font-size: clamp(1.125rem, 0.5vw + 1rem, 1.375rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 60ch;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: var(--space-3);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-right: var(--space-2);
  transform: translateY(-2px);
}

small, .small { font-size: var(--fs-small); }
.meta { font-size: var(--fs-meta); color: var(--ink-muted); }

ul, ol { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
li { margin-bottom: var(--space-2); }

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--steel);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-style: italic;
  font-weight: 300;
  line-height: 1.4;
  color: var(--navy-deep);
}


/* -----------------------------------------------------------------------------
   4. Layout primitives
   ----------------------------------------------------------------------------- */

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

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

.section {
  padding-block: var(--section-pad-y);
}

.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--warm  { background: var(--paper-warm); }
.section--cool  { background: var(--paper-cool); }
.section--dark  {
  background: var(--navy-deep);
  color: var(--blue-pale);
}
.section--dark h1, .section--dark h2,
.section--dark h3, .section--dark h4 { color: #fff; }
.section--dark .eyebrow { color: var(--blue-light); }
.section--dark a { color: var(--blue-light); }
.section--dark a:hover { color: #fff; }

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

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

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}


/* -----------------------------------------------------------------------------
   5. Components
   ----------------------------------------------------------------------------- */

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.95rem 1.6rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--motion-fast) var(--easing),
              background-color var(--motion-fast) var(--easing),
              color var(--motion-fast) var(--easing),
              border-color var(--motion-fast) var(--easing),
              box-shadow var(--motion-fast) var(--easing);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn--primary {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn--primary:hover {
  background: var(--navy-deep);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.btn--ghost:hover {
  background: var(--navy);
  color: #fff;
}

.btn--light {
  background: #fff;
  color: var(--navy);
}
.btn--light:hover {
  background: var(--blue-pale);
  color: var(--navy-deep);
}

.btn--text {
  padding: 0.5rem 0;
  background: transparent;
  border-radius: 0;
  color: var(--navy);
  border-bottom: 1px solid currentColor;
  border-radius: 0;
}
.btn--text:hover {
  transform: none;
  color: var(--steel);
}

.btn--lg { padding: 1.15rem 2rem; font-size: 1.0625rem; }

.btn .arrow {
  transition: transform var(--motion-fast) var(--easing);
}
.btn:hover .arrow { transform: translateX(3px); }


/* --- Card ----------------------------------------------------------------- */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform var(--motion-mid) var(--easing),
              box-shadow var(--motion-mid) var(--easing),
              border-color var(--motion-mid) var(--easing);
}

.card:hover {
  border-color: var(--blue-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card--feature {
  background: linear-gradient(180deg, #fff 0%, var(--paper-cool) 100%);
}


/* --- Badge ---------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.8rem;
  background: var(--blue-pale);
  color: var(--navy);
  border-radius: var(--radius-pill);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--gold {
  background: rgba(200, 154, 74, 0.12);
  color: #8a6a2e;
}


/* --- Navigation ----------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(253, 252, 250, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--motion-mid) var(--easing),
              background-color var(--motion-mid) var(--easing);
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(253, 252, 250, 0.95);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: var(--space-5);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  color: var(--navy-deep);
}

.nav__brand:hover { color: var(--navy); }

.nav__brand-mark {
  width: auto;
  height: 40px;
  flex: 0 0 auto;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
}

.nav__links a:hover { color: var(--navy); }

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--motion-fast) var(--easing);
}

.nav__links a:hover::after { transform: scaleX(1); }

.nav__cta { margin-left: var(--space-3); }

.nav__cta .btn--primary {
  background: var(--navy);
  color: #fff;
  isolation: isolate;
}
.nav__cta .btn--primary:hover {
  background: var(--navy-deep);
  color: #fff;
}

.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
}

.nav__toggle-icon,
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  content: "";
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--navy-deep);
  position: relative;
  transition: transform var(--motion-fast) var(--easing),
              opacity var(--motion-fast) var(--easing);
}
.nav__toggle-icon::before { position: absolute; top: -6px; }
.nav__toggle-icon::after  { position: absolute; top: 6px; }

.nav.is-open .nav__toggle-icon { background: transparent; }
.nav.is-open .nav__toggle-icon::before { transform: translateY(6px) rotate(45deg); }
.nav.is-open .nav__toggle-icon::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-4) var(--gutter) var(--space-6);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--motion-mid) var(--easing),
                opacity var(--motion-mid) var(--easing);
  }
  .nav__links li { width: 100%; }
  .nav__links a {
    display: block;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.125rem;
  }
  .nav__links a::after { display: none; }
  .nav__cta { margin-left: 0; margin-top: var(--space-4); width: 100%; }
  .nav.is-open .nav__links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}


/* --- Footer --------------------------------------------------------------- */

.footer {
  background: var(--navy-deep);
  color: var(--blue-pale);
  padding-block: var(--space-8) var(--space-6);
  font-size: var(--fs-small);
}

.footer a {
  color: var(--blue-light);
}
.footer a:hover {
  color: #fff;
}

.footer__top {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-7);
  padding-bottom: var(--space-7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 860px) {
  .footer__top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }
  .footer__brand-block { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .footer__top { grid-template-columns: 1fr; }
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  margin-bottom: var(--space-3);
}

.footer__tagline {
  color: rgba(255, 255, 255, 0.7);
  max-width: 36ch;
  margin-bottom: var(--space-4);
}

.footer__heading {
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-light);
  margin-bottom: var(--space-3);
}

.footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer__list li { margin-bottom: var(--space-2); }

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-5);
  font-size: var(--fs-meta);
  color: rgba(255, 255, 255, 0.55);
}


/* --- Marquee -------------------------------------------------------------- */
/* Used for trust strips: lender logos, "as featured in", etc. */

.marquee {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to right,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%);
  mask-image: linear-gradient(to right,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%);
}

.marquee__track {
  display: flex;
  gap: var(--space-7);
  width: max-content;
  animation: marquee 40s linear infinite;
}

.marquee:hover .marquee__track { animation-play-state: paused; }

.marquee__item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 56px;
  color: var(--ink-muted);
  font-size: var(--fs-small);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}


/* --- Decorative: low-poly accent line ------------------------------------- */
/* A subtle echo of the wombat logo's polygonal style. Use as a section
   divider or inline emphasis. */

.poly-rule {
  display: block;
  width: 64px;
  height: 8px;
  margin: var(--space-5) 0;
  background:
    linear-gradient(135deg, var(--navy) 50%, transparent 50%) 0 0 / 16px 8px,
    linear-gradient(45deg,  var(--steel) 50%, transparent 50%) 0 0 / 16px 8px;
}


/* -----------------------------------------------------------------------------
   6. Utilities
   ----------------------------------------------------------------------------- */

.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;
}

.text-center { text-align: center; }
.text-balance { text-wrap: balance; }
.muted { color: var(--ink-muted); }

.max-prose { max-width: 65ch; }
.max-narrow { max-width: 48ch; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }


/* -----------------------------------------------------------------------------
   7. Motion & accessibility
   ----------------------------------------------------------------------------- */

/* Reveal-on-scroll — opt in by adding `data-reveal` to an element. JS toggles
   `is-visible`. Defaults are gentle: 16px lift + fade. Stagger via inline
   `style="--reveal-delay: 80ms"` if needed. */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--motion-slow) var(--easing-out) var(--reveal-delay, 0ms),
              transform var(--motion-slow) var(--easing-out) var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Honor reduced motion preferences */
@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;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* Dark mode hook — not enabled by default. Add `data-theme="dark"` on <html>
   to activate. Kept minimal here; expand once the light scheme is locked. */
[data-theme="dark"] {
  --paper:      #0f1830;
  --paper-warm: #14213d;
  --paper-cool: #122035;
  --ink:        #e6edf3;
  --ink-soft:   #b6c2cc;
  --ink-muted:  #8a96a3;
  --line:       rgba(255, 255, 255, 0.08);
}
