/* ==========================================================================
   MileGravy — one stylesheet for the whole site.

   Palette lifted from the app: deep green #12683A, cream ground, near-black
   text. Mobile-first; the only breakpoint is 700px. No framework, no reset
   library — just the handful of normalisations this site actually needs.
   ========================================================================== */

:root {
  --green:      #12683A;
  --green-dark: #0d4d2b;
  --green-tint: #e6efe8;
  --cream:      #faf6ee;
  --card:       #ffffff;
  --ink:        #14181a;
  --ink-soft:   #4e5a53;
  --line:       #ddd8cc;
  --accent:     #35C46A;
  --radius:     14px;
  --wrap:       min(100% - 2.5rem, 62rem);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
          Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--green-dark); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 4.5vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 650; }
p  { margin: 0 0 1rem; }

.wrap { width: var(--wrap); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9375rem; }
.tiny  { font-size: 0.8125rem; }

/* Visible only to screen readers, but focusable (the skip link). */
.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;
}
.skip:focus {
  position: fixed; top: 0.5rem; left: 0.5rem; z-index: 20;
  width: auto; height: auto; clip: auto; margin: 0;
  padding: 0.6rem 0.9rem; background: var(--card); color: var(--green);
  border-radius: 8px; box-shadow: 0 2px 12px rgb(0 0 0 / 0.2);
}

/* ---------- header / footer ---------------------------------------------- */

.site-head {
  background: var(--green);
  color: #fff;
  padding: 0.75rem 0;
}
.site-head .wrap {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: #fff; text-decoration: none; font-weight: 750; font-size: 1.125rem;
  letter-spacing: -0.02em;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.site-nav { margin-left: auto; display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-nav a { color: #d8ecdf; text-decoration: none; font-size: 0.9375rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; text-decoration: underline; }

.site-foot {
  margin-top: 3.5rem;
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2.5rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.site-foot .wrap { display: flex; gap: 0.6rem 1.25rem; flex-wrap: wrap; align-items: center; }
.site-foot nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* ---------- sections ------------------------------------------------------ */

main { padding-top: 2.25rem; }
section { margin-bottom: 3rem; }

.hero p.lede {
  font-size: 1.1875rem;
  color: var(--ink-soft);
  max-width: 34rem;
}

.cards {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
  padding: 0; margin: 0; list-style: none;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h3 { margin-bottom: 0.35rem; }
.card p  { margin: 0; color: var(--ink-soft); }

.founder {
  border-left: 4px solid var(--green);
  background: var(--green-tint);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.25rem;
}
.founder p:last-child { margin-bottom: 0; }

.price {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.price .amount { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em; }
.price .amount span { font-size: 1rem; font-weight: 500; color: var(--ink-soft); }
.price ul { margin: 0.75rem 0 0; padding-left: 1.1rem; color: var(--ink-soft); }
.price li { margin-bottom: 0.3rem; }

.btn {
  display: inline-block;
  background: var(--green); color: #fff;
  border: 0; border-radius: 10px;
  padding: 0.8rem 1.25rem;
  font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--green-dark); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: default; }

.appstore { display: inline-block; margin-top: 1rem; }
.appstore img { height: 52px; width: auto; }

/* ---------- signup form --------------------------------------------------- */

.signup {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
}
.signup h2 { margin-bottom: 0.35rem; }
.signup .row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }
.signup input[type="email"] {
  flex: 1 1 15rem; min-width: 0;
  font: inherit;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--cream); color: var(--ink);
}
.signup input[type="email"]:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.signup .note { margin: 0.75rem 0 0; }
.signup .note:empty { display: none; }

/* ---------- calculator ---------------------------------------------------- */

.calc {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1fr;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
}
.field { margin-bottom: 1.15rem; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label {
  display: block; font-weight: 650; margin-bottom: 0.35rem;
}
.field .hint { display: block; margin-top: 0.3rem; color: var(--ink-soft); font-size: 0.875rem; }
.field input[type="number"], .field select {
  width: 100%; font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--cream); color: var(--ink);
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}

/* Segmented week / year toggle, built from real radios so it is keyboard-
   and screen-reader-native; the inputs are hidden, the labels are the UI. */
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1; text-align: center; padding: 0.6rem 0.5rem;
  cursor: pointer; font-weight: 600; color: var(--ink-soft); background: var(--cream);
}
.seg label + input + label { border-left: 1px solid var(--line); }
.seg input:checked + label { background: var(--green); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--green); outline-offset: -3px; }

.out { list-style: none; margin: 0; padding: 0; }
.out li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
}
.out li:last-child { border-bottom: 0; }
.out .k { color: var(--ink-soft); }
.out .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.out .big { font-size: 1.5rem; letter-spacing: -0.02em; }

.headline-out {
  background: var(--green); color: #fff;
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-top: 1rem;
}
.headline-out strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.headline-out p { margin: 0; color: #d8ecdf; }

details {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 0.9rem 1.1rem; margin-top: 1rem;
}
details + details { margin-top: 0.6rem; }
summary { cursor: pointer; font-weight: 650; }
details > *:not(summary) { margin-top: 0.75rem; }
details p:last-child { margin-bottom: 0; }
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem; line-height: 1.7;
  background: var(--cream); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.8rem 0.9rem; overflow-x: auto;
}

.prose { max-width: 40rem; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.15rem; }
.prose li { margin-bottom: 0.35rem; }

@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .calc  { grid-template-columns: 1fr 1fr; }
  main   { padding-top: 3rem; }
}

/* ---------- blog ---------------------------------------------------------- */

.post { max-width: 42rem; }
.post-meta {
  color: var(--ink-soft); font-size: 0.9375rem;
  margin: -0.25rem 0 1.25rem;
}
.post-meta .dot { margin: 0 0.45rem; opacity: 0.5; }

.summary-box {
  background: var(--green-tint);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.15rem;
  margin-bottom: 2rem;
}
.summary-box p { margin: 0; }
.summary-box .label {
  display: block; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--green); margin-bottom: 0.3rem;
}

.post h2 { margin-top: 2.25rem; }
.post h3 { margin-top: 1.5rem; }
.post ul, .post ol { padding-left: 1.2rem; }
.post li { margin-bottom: 0.4rem; }
.post blockquote {
  margin: 1.25rem 0; padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 3px solid var(--line); color: var(--ink-soft);
}

/* The one worked example per post. */
.worked {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; margin: 1.5rem 0;
}
.worked h3 { margin-top: 0; }
.worked table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.worked td { padding: 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.worked tr:last-child td { border-bottom: 0; font-weight: 700; }
.worked td + td { text-align: right; white-space: nowrap; padding-left: 1rem; }
.worked .rule td { border-bottom: 2px solid var(--ink); }

.disclaimer {
  margin-top: 2.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.9375rem;
}

.sources { font-size: 0.9375rem; }
.sources ul { padding-left: 1.2rem; }

.read-next { margin-top: 2.5rem; }
.read-next ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.read-next a { font-weight: 650; text-decoration: none; }
.read-next a:hover { text-decoration: underline; }
.read-next p { margin: 0.15rem 0 0; color: var(--ink-soft); font-size: 0.9375rem; }

/* Blog index + "From the blog" listings. */
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.post-list .card h3 { margin-bottom: 0.2rem; }
.post-list .card h3 a { text-decoration: none; color: var(--ink); }
.post-list .card h3 a:hover { color: var(--green); text-decoration: underline; }
.post-list .card .post-meta { margin: 0 0 0.5rem; font-size: 0.8125rem; }

@media (min-width: 700px) {
  .from-blog .post-list { grid-template-columns: repeat(3, 1fr); }
}
