/* Phlox Engineering site styles */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --ink: #17191c;
  --ink-2: #4a4f57;
  --ink-3: #757b84;
  --line: #dedad1;
  --accent: #d9481f;
  --accent-ink: #b63a15;
  --accent-soft: #fbe7dd;
  --radius: 14px;
  --max: 1120px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --surface: #1b1d20;
    --surface-2: #222428;
    --ink: #f0eee9;
    --ink-2: #b9bcc2;
    --ink-3: #8b9098;
    --line: #2f3237;
    --accent: #f26a3d;
    --accent-ink: #ff8a5f;
    --accent-soft: #3a2018;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 650; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); font-weight: 650; }
h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}

.lead { font-size: 1.2rem; color: var(--ink-2); max-width: 40em; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand img { width: 18px; height: auto; }
.brand span small { font-weight: 500; color: var(--ink-3); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; padding: 8px 12px; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.nav .btn { margin-left: 8px; }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 64px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; }
  .nav .btn { margin: 8px 0 0; text-align: center; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 0.98rem; text-decoration: none;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.nav .btn-primary { padding: 8px 16px; font-size: 0.92rem; color: #fff; }
.nav .btn-primary:hover { background: var(--accent-ink); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }

/* Sections */
section { padding: 88px 0; }
section + section { border-top: 1px solid var(--line); }
@media (max-width: 600px) { section { padding: 64px 0; } }
.section-head { max-width: 46em; margin-bottom: 40px; }

/* Hero */
.hero { padding: 72px 0 88px; }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 56px; align-items: center; }
.hero h1 { max-width: 15em; }
.hero-photo { position: relative; }
.hero-photo img { border-radius: var(--radius); aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }
.hero-photo figcaption { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); margin-top: 10px; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-photo { max-width: 200px; order: -1; }
}

/* Feature (lead proof) */
.feature { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; }
.feature-media { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feature-media img { border-radius: 6px; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; gap: 28px; } }

blockquote {
  margin: 1.5rem 0; padding: 0 0 0 20px; border-left: 3px solid var(--accent);
  font-size: 1.15rem; color: var(--ink);
}
blockquote cite { display: block; margin-top: 8px; font-style: normal; font-size: 0.9rem; color: var(--ink-3); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px; margin: 1.5rem 0 2.5rem; padding: 0; list-style: none; }
.facts strong { display: block; font-size: 1.5rem; letter-spacing: -0.02em; }
.facts span { font-size: 0.9rem; color: var(--ink-3); }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: p; padding: 0; margin: 0; list-style: none; }
.principles li { counter-increment: p; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.principles li::before { content: "0" counter(p); display: block; font-family: var(--mono); font-size: 0.8rem; color: var(--accent-ink); margin-bottom: 14px; }
.principles p { color: var(--ink-2); font-size: 0.97rem; margin: 0; }
@media (max-width: 960px) { .principles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .principles { grid-template-columns: 1fr; } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--ink-3); color: var(--ink); transform: translateY(-2px); }
.card p { color: var(--ink-2); margin: 0; font-size: 0.98rem; }
.card .more { margin-top: auto; padding-top: 8px; font-weight: 600; font-size: 0.95rem; color: var(--accent-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2);
}
.tag.status { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); }

/* Fields */
.fields { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 24px 0 0; list-style: none; }
.fields li { padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.95rem; }

/* Split text */
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 48px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 16px; } }
.split p { color: var(--ink-2); }

/* Call to action */
.cta { text-align: left; }
.cta-box { background: var(--ink); color: var(--bg); border-radius: 20px; padding: 56px; }
.cta-box h2 { color: var(--bg); max-width: 18em; }
.cta-box p { color: color-mix(in srgb, var(--bg) 75%, transparent); max-width: 36em; }
.cta-box .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.cta-box .btn-ghost:hover { border-color: var(--bg); }
@media (max-width: 600px) { .cta-box { padding: 32px 24px; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; font-size: 0.92rem; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }

/* Article pages */
.page-head { padding: 72px 0 40px; }
.prose { max-width: 44em; }
.prose h2 { margin-top: 2.2em; font-size: 1.6rem; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin-bottom: 0.4em; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
figure { margin: 2rem 0; }
figure figcaption { font-size: 0.88rem; color: var(--ink-3); margin-top: 10px; }
.media-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.media-frame img, .media-frame video { border-radius: 6px; width: 100%; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .two-up { grid-template-columns: 1fr; } }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 32px 28px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline .when { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3); }
.timeline h3 { margin: 4px 0 2px; }
.timeline .where { color: var(--ink-3); font-size: 0.95rem; margin-bottom: 8px; }
.timeline p { color: var(--ink-2); margin: 0; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Independence Ladder */
.principles.ladder { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .principles.ladder { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .principles.ladder { grid-template-columns: 1fr; } }

/* Savings calculator */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .calc { grid-template-columns: 1fr; } }
.calc-form, .calc-out { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.calc-form { display: grid; gap: 14px; }
.calc-form label { display: grid; gap: 6px; font-size: 0.92rem; color: var(--ink-2); }
.calc-form input {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.calc-form button { justify-self: start; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.calc-out { background: var(--ink); color: var(--bg); border-color: var(--ink); display: flex; flex-direction: column; justify-content: space-between; }
.calc-out dl { margin: 0; display: grid; gap: 14px; }
.calc-out dl div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); padding-bottom: 12px; }
.calc-out dt { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.calc-out dd { margin: 0; text-align: right; font-family: var(--mono); }
.calc-total { margin: 24px 0 0; font-size: 1.1rem; }
.calc-total strong { display: block; font-size: 2.4rem; letter-spacing: -0.02em; color: var(--accent); }
.eyebrow a { color: inherit; }
