/* Poppy Finance — site styles
   Tokens follow the Brand & Style Guide v1.0. */

:root {
  --coral: #ff5a3c;
  --coral-deep: #c9361a;   /* text-safe coral for links on cream */
  --eucalypt: #0f3d34;
  --eucalypt-2: #164c41;
  --cream: #fff4e8;
  --petal: #ffe7d6;
  --pollen: #ffc24b;
  --sage: #a9cbb2;
  --ink: #1f2421;
  --muted: #56605a;
  --line: #ecdccb;
  --white: #ffffff;
  --error: #b3261e;

  --font: 'Poppins', Arial, Helvetica, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.44rem);
  --step-4: clamp(2.25rem, 1.6rem + 3.2vw, 3.8rem);

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --wrap: 1160px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--coral-deep); text-underline-offset: 3px; }
a:hover { color: var(--eucalypt); }
h1, h2, h3 { color: var(--eucalypt); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.6em; }
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.035em; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 64ch; }
:focus-visible { outline: 3px solid var(--pollen); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--eucalypt); color: var(--cream); padding: 0.6rem 1rem; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 0.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: 700 0.95rem/1 var(--font); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
  padding: 1.05rem 1.6rem; border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: translateY(1px); }
/* Ink on coral keeps contrast above 4.5:1 (white on coral does not). */
.btn-primary { background: var(--coral); color: var(--ink); }
.btn-primary:hover { background: #ff7458; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--eucalypt); border-color: var(--eucalypt); }
.btn-ghost:hover { background: var(--eucalypt); color: var(--cream); }
.btn-light { background: var(--cream); color: var(--eucalypt); }
.btn-light:hover { background: var(--white); color: var(--eucalypt); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------------------------------------------------------------- header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 244, 232, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--ink); font-size: 1.45rem; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; }
.brand b { font-weight: 700; }
.brand span { font-weight: 300; }
.nav { display: flex; align-items: center; gap: 1.75rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--coral-deep); }
.nav .btn { padding: 0.8rem 1.2rem; font-size: 0.82rem; }
.nav-toggle { display: none; background: none; border: 0; padding: 0.5rem; cursor: pointer; color: var(--eucalypt); }
.nav-toggle svg { width: 28px; height: 28px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 72px; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--cream); border-bottom: 1px solid var(--line); padding: 0.5rem var(--gutter) 1.25rem; display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 1rem; border-bottom: 0; padding: 1rem; }
}

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(3rem, 7vw, 6rem) 0 clamp(3.5rem, 8vw, 7rem); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { max-width: 12ch; }
.hero .lede { font-size: var(--step-1); color: var(--muted); max-width: 34ch; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }
.hero-note { font-size: var(--step--1); color: var(--muted); margin-top: 1.25rem; }

.hero-visual { position: relative; min-height: 420px; }
.bloom { position: absolute; width: 78%; right: -14%; top: -6%; }
.bloom .petal { transform-box: fill-box; transform-origin: center; }
.bloom .petal, .bloom .pollen { animation: open 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.bloom .petal:nth-child(1) { animation-delay: 0.05s; }
.bloom .petal:nth-child(2) { animation-delay: 0.13s; }
.bloom .petal:nth-child(3) { animation-delay: 0.21s; }
.bloom .petal:nth-child(4) { animation-delay: 0.29s; }
.bloom .petal:nth-child(5) { animation-delay: 0.37s; }
.bloom .pollen { transform-box: fill-box; transform-origin: center; animation-delay: 0.55s; }
@keyframes open { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.summary-card {
  position: relative; z-index: 2; margin-top: 7.5rem; max-width: 360px;
  background: var(--white); border-radius: var(--radius-md); padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -24px rgba(15, 61, 52, 0.35);
}
.summary-card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--ink); letter-spacing: 0; }
.summary-card dl { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 0.7rem; font-size: 0.95rem; }
.summary-card dt { color: var(--muted); }
.summary-card dd { margin: 0; font-weight: 600; text-align: right; }
.summary-card .total { border-top: 1px dashed var(--line); padding-top: 0.8rem; font-size: 1.1rem; color: var(--eucalypt); }
.summary-card .fine { font-size: 0.75rem; color: var(--muted); margin: 1rem 0 0; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { min-height: 0; }
  .bloom { width: 190px; right: -24px; top: -24px; }
  .summary-card { margin-top: 5rem; }
}

/* ---------------------------------------------------------------- sections */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-head { max-width: 40rem; margin-bottom: 2.75rem; }
.section-head p { color: var(--muted); font-size: 1.075rem; }
.section-alt { background: var(--white); }

/* Steps — a real sequence, so they're numbered. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 3.75rem; }
.steps li::before {
  content: counter(step); position: absolute; top: 0; left: 0;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--petal); color: var(--coral-deep); font-weight: 700; font-size: 1.1rem;
}
.steps li:not(:last-child)::after { content: ''; position: absolute; top: 1.375rem; left: 3.5rem; right: -0.75rem; height: 2px; background: var(--line); }
.steps h3 { margin-bottom: 0.4rem; }
.steps p { color: var(--muted); font-size: 0.97rem; }
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr 1fr; row-gap: 2.5rem; }
  .steps li::after { display: none; }
}
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* Repayment explainer */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.chart-panel { background: var(--cream); border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2rem); }
.chart-panel figcaption { font-size: var(--step--1); color: var(--muted); margin-top: 1rem; }
.chart-legend { display: flex; gap: 1.25rem; font-size: 0.85rem; margin-bottom: 1rem; color: var(--ink); }
.chart-legend span { white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-legend .k-sales { background: var(--sage); }
.chart-legend .k-repay { background: var(--coral); }
.checklist { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.checklist li { position: relative; padding-left: 2rem; margin-bottom: 0.8rem; }
.checklist li::before {
  content: ''; position: absolute; left: 0; top: 0.35em; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--coral) radial-gradient(circle, var(--pollen) 0 30%, transparent 32%);
}

/* Fit — two honest columns */
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.fit > div { border-radius: var(--radius-md); padding: clamp(1.5rem, 3vw, 2.25rem); }
.fit .yes { background: var(--eucalypt); color: var(--cream); }
.fit .yes h3 { color: var(--pollen); }
.fit .no { background: var(--white); border: 1px solid var(--line); }
.fit ul { margin: 0; padding-left: 1.2rem; }
.fit li { margin-bottom: 0.55rem; }
.fit .no li { color: var(--muted); }
@media (max-width: 760px) { .fit { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- form */
.apply { background: var(--eucalypt); color: var(--cream); border-radius: var(--radius-lg); padding: clamp(1.75rem, 5vw, 4rem); display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(2rem, 5vw, 4rem); }
.apply h2 { color: var(--cream); }
.apply-intro p { color: var(--sage); }
.apply-intro ul { padding-left: 1.2rem; color: var(--cream); }
.apply-intro li { margin-bottom: 0.5rem; }
@media (max-width: 900px) { .apply { grid-template-columns: 1fr; } }

.form { background: var(--cream); color: var(--ink); border-radius: var(--radius-md); padding: clamp(1.25rem, 3vw, 2rem); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.field label, .field legend { font-weight: 500; font-size: 0.92rem; color: var(--eucalypt); padding: 0; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin: -0.15rem 0 0.1rem; }
.field .optional { font-weight: 400; color: var(--muted); }
input[type='text'], input[type='email'], input[type='tel'], select, textarea {
  font: 400 1rem/1.4 var(--font); color: var(--ink); width: 100%;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 0.9rem;
  transition: border-color 0.15s ease;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230F3D34' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.4rem; }
textarea { min-height: 7rem; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #d9c4ad; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--eucalypt); box-shadow: 0 0 0 3px rgba(255, 194, 75, 0.6); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.82rem; font-weight: 500; min-height: 0; }
.field-error:empty { display: none; }

fieldset.field { border: 0; margin: 0; padding: 0; }
.segmented { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-block; padding: 0.65rem 1.1rem; border-radius: 999px; background: var(--white); border: 1.5px solid var(--line); font-weight: 500; font-size: 0.92rem; color: var(--ink); }
.segmented input:checked + span { background: var(--eucalypt); border-color: var(--eucalypt); color: var(--cream); }
.segmented input:focus-visible + span { outline: 3px solid var(--pollen); outline-offset: 2px; }

.consent { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start; font-size: 0.88rem; color: var(--ink); }
.consent input { width: 1.2rem; height: 1.2rem; margin: 0.2rem 0 0; accent-color: var(--eucalypt); }
.collection-notice { font-size: 0.8rem; color: var(--muted); background: var(--white); border-radius: var(--radius-sm); padding: 0.9rem 1rem; margin: 0; max-width: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 0.4rem; }
.form-actions p { font-size: 0.8rem; color: var(--muted); margin: 0; }
.form-status { margin-top: 1rem; font-weight: 500; }
.form-status.is-error { color: var(--error); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-success { text-align: left; padding: clamp(1rem, 3vw, 2rem) 0.5rem; }
.form-success svg { width: 64px; height: 64px; margin-bottom: 1rem; }
.form-success h3 { font-size: var(--step-2); }
.form-success .ref { font-weight: 600; color: var(--eucalypt); }

/* ---------------------------------------------------------------- FAQ */
.faq { max-width: 50rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 1.25rem 2.5rem 1.25rem 0; font-weight: 600; font-size: 1.08rem; color: var(--eucalypt); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; position: absolute; right: 0.4rem; top: 50%; width: 12px; height: 12px; border-right: 2px solid var(--coral-deep); border-bottom: 2px solid var(--coral-deep); transform: translateY(-70%) rotate(45deg); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details > div { padding: 0 0 1.25rem; color: var(--muted); }

/* ---------------------------------------------------------------- broker page bits */
.criteria { width: 100%; border-collapse: collapse; font-size: 0.97rem; background: var(--white); border-radius: var(--radius-md); overflow: hidden; }
.criteria th, .criteria td { text-align: left; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.criteria th { width: 38%; font-weight: 600; color: var(--eucalypt); }
.criteria tr:last-child th, .criteria tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; border-radius: var(--radius-md); }
.reasons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.5rem 3rem; }
.reasons h3 { display: flex; align-items: center; gap: 0.7rem; }
.reasons h3 img { width: 22px; height: 22px; flex: none; }
.reasons p { color: var(--muted); }
@media (max-width: 760px) { .reasons { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- footer */
.site-footer { background: var(--eucalypt); color: var(--sage); padding: 3.5rem 0 2.5rem; font-size: 0.88rem; margin-top: clamp(3rem, 7vw, 5rem); }
.site-footer .brand { color: var(--cream); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; }
.site-footer h2 { font-size: 0.95rem; color: var(--cream); letter-spacing: 0; margin-bottom: 0.8rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.45rem; }
.site-footer a { color: var(--cream); text-decoration: none; }
.site-footer a:hover { color: var(--pollen); text-decoration: underline; }
.legal { border-top: 1px solid var(--eucalypt-2); padding-top: 1.5rem; font-size: 0.78rem; line-height: 1.6; }
.legal p { max-width: 90ch; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- plain pages (legal, thanks, 404) */
.plain-page { max-width: 46rem; margin: 0 auto; padding: clamp(3rem, 7vw, 5rem) var(--gutter); }
.plain-page h2 { font-size: var(--step-2); margin-top: 2.2em; }
.plain-page li { margin-bottom: 0.5rem; }
.plain-page .updated { color: var(--muted); font-size: 0.9rem; }
.draft-banner { background: var(--pollen); color: var(--ink); padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 2rem; }
.error-list { color: var(--error); padding-left: 1.2rem; }
.center-page { text-align: center; }
.center-page img { width: 88px; margin: 0 auto 1.5rem; }
.center-page p { margin-left: auto; margin-right: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.form-success img { width: 64px; height: 64px; margin-bottom: 1rem; }
