/* =========================================================================
   Kaleth — "Marked passage"
   A page built like a document a machine has read and marked up for a human.
   The accent is never a button fill; it is the highlight behind the text.
   ========================================================================= */

/* --- Tokens -------------------------------------------------------------- */

:root {
  /* Palette — six values, no more. */
  --paper:        #E4E7E0;  /* page ground: ash-green off-white           */
  --paper-raised: #F0F2EC;  /* console, cards — surfaces lift to the light */
  --ink:          #12181A;  /* text, primary button fills                  */
  --ink-soft:     #5A635F;  /* secondary text, mono labels — 4.96:1        */
  --signal:       #2B31C4;  /* links, focus, citations, the mark's edge    */
  --highlight:    #C7CCF7;  /* the marked span                             */

  /* Type */
  --face-display: "Familjen Grotesk", system-ui, sans-serif;
  --face-body:    "Literata", Georgia, serif;
  --face-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --t-xs:  0.8rem;
  --t-sm:  0.9375rem;
  --t-base: 1.0625rem;              /* 17px */
  --t-md:  clamp(1.1875rem, 1.05rem + 0.6vw, 1.3125rem);
  --t-lg:  clamp(1.375rem, 1.2rem + 0.9vw, 1.6875rem);
  --t-xl:  clamp(1.6875rem, 1.4rem + 1.4vw, 2.25rem);
  --t-2xl: clamp(2.125rem, 1.6rem + 2.6vw, 3rem);

  /* Space */
  --gutter: 1.25rem;
  --flow: 1.1em;
  --section-y: clamp(3.5rem, 2.5rem + 5vw, 6.5rem);
  --radius: 4px;

  --border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  --border-strong: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
}

/* --- Reset --------------------------------------------------------------- */

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

/* Author `display` rules outrank the UA sheet's [hidden] rule, so any element
   JS toggles with .hidden needs this or it never hides. Bit us on the demo's
   error block, which is display:flex. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--face-body);
  font-size: var(--t-base);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
button, input, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3 {
  font-family: var(--face-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0; }

a { color: var(--signal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* Deliberately NOT box-decoration-break: clone — with the default (slice) the
   background paints across every wrapped line but the signal edge is drawn
   once, at the start of the mark. Clone repeats the bar on each line. */
mark {
  background: var(--highlight);
  color: var(--ink);
  padding: 0.08em 0.28em;
  border-left: 2px solid var(--signal);
}

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

::selection { background: var(--highlight); color: var(--ink); }

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

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 20;
  background: var(--ink); color: var(--paper);
  padding: 0.75rem 1rem; border-radius: var(--radius);
  font-family: var(--face-mono); font-size: var(--t-xs);
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

/* --- Shell and the evidence rail ---------------------------------------- */

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

.section { padding-block: var(--section-y); }
.section--tinted { background: color-mix(in srgb, var(--ink) 4%, var(--paper)); }
.section--hero { padding-top: clamp(2rem, 1rem + 5vw, 4rem); }

.layout { display: grid; gap: 0.75rem; }
.layout__body > * + * { margin-top: var(--flow); }

/* The rail: a document index marker. On mobile it is one mono line. */
.rail {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rail__index { color: var(--signal); }

/* The hero already opens with a mono eyebrow; two grey mono lines stacked
   above the h1 read as noise on a phone. */
.section--hero .rail { display: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--face-display);
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn--primary { background: var(--ink); color: var(--paper-raised); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--signal)); }

.btn--ghost { background: transparent; color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.btn--ghost:hover { border-color: var(--signal); color: var(--signal); }

.btn--sm { min-height: 44px; padding: 0.5rem 0.9rem; font-size: var(--t-xs); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* --- Header / footer ----------------------------------------------------- */

.site-header { padding-block: 1rem; border-bottom: var(--border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header__cta { display: none; }

.wordmark {
  font-family: var(--face-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.site-footer {
  border-top: var(--border);
  padding-block: 2.5rem 6rem;
  font-size: var(--t-sm);
  color: var(--ink-soft);
}
.site-footer__inner > * + * { margin-top: 0.85rem; }
.site-footer__year { font-family: var(--face-mono); font-size: var(--t-xs); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer__legal { font-family: var(--face-mono); font-size: var(--t-xs); line-height: 1.7; }

/* --- Hero ---------------------------------------------------------------- */

.eyebrow {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.lede { font-size: var(--t-md); line-height: 1.5; max-width: 34ch; margin-top: 1.25rem; }
.lede--sm { font-size: var(--t-base); max-width: 52ch; }

.layout__body > h1 + .lede { max-width: 40ch; }

/* --- The console: signature element -------------------------------------- */

.console {
  margin-top: 2.5rem;
  background: var(--paper-raised);
  border: var(--border-strong);
  border-radius: var(--radius);
  padding: 1.125rem;
}

.console__label {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

.console__form { display: flex; flex-direction: column; gap: 0.5rem; }

.console__input {
  min-height: 48px;
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--paper);
  border: var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--face-body);
  font-size: var(--t-base);
}
.console__input::placeholder { color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }

.chip {
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  background: transparent;
  border: var(--border);
  border-radius: var(--radius);
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  line-height: 1.35;
  text-align: left;
  color: var(--ink-soft);
  cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--signal); }

.console__output { margin-top: 1.25rem; }
.console__output > * + * { margin-top: 0.85rem; }

.console__status {
  display: inline-block;
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
}
.console__status--example { background: var(--highlight); color: var(--ink); }
.console__status--error {
  color: var(--ink);
  background: repeating-linear-gradient(
    -45deg, var(--highlight), var(--highlight) 5px,
    color-mix(in srgb, var(--highlight) 55%, var(--paper-raised)) 5px,
    color-mix(in srgb, var(--highlight) 55%, var(--paper-raised)) 10px);
}
.console__status--live { border: var(--border); color: var(--ink-soft); }

.console__question {
  font-family: var(--face-display);
  font-weight: 600;
  font-size: var(--t-md);
  line-height: 1.25;
}

.console__answer > * + * { margin-top: 0.7rem; }
.console__answer strong { font-weight: 500; font-family: var(--face-mono); font-size: 0.94em; }

.cite {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  line-height: 1.5;
  padding-top: 0.75rem;
  border-top: var(--border);
  overflow-wrap: anywhere;
}
.cite__label {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.5rem;
}

.console__error { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.25rem; }
.console__error-text { font-size: var(--t-sm); }

.console.is-busy .console__submit { opacity: 0.6; pointer-events: none; }

.console__loading {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.console__loading::after {
  content: "";
  display: inline-block;
  width: 0.5em; height: 0.5em;
  margin-left: 0.5em;
  background: var(--signal);
  animation: pulse 900ms steps(2, end) infinite;
}
@keyframes pulse { 50% { opacity: 0.2; } }

/* --- Cards --------------------------------------------------------------- */

.cards { display: grid; gap: 0.85rem; margin-top: 1.75rem; }

.card {
  background: var(--paper-raised);
  border: var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card > * + * { margin-top: 0.6rem; }
.card__title { color: var(--ink); }

.card--featured { border: var(--border-strong); border-top: 3px solid var(--signal); }

.fineprint {
  margin-top: 1.5rem;
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* --- Steps --------------------------------------------------------------- */

.steps { margin-top: 1.75rem; display: grid; gap: 1.5rem; }
.step { max-width: 58ch; }
.step > * + * { margin-top: 0.4rem; }

.step__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; }
.step__num { font-family: var(--face-mono); font-size: var(--t-sm); color: var(--signal); }
.step__name { font-family: var(--face-display); font-weight: 600; font-size: var(--t-md); }
.step__time {
  font-family: var(--face-mono); font-size: var(--t-xs);
  color: var(--ink-soft); letter-spacing: 0.04em;
}

.statement { font-size: var(--t-md); line-height: 1.45; max-width: 42ch; }

/* --- Calculator ---------------------------------------------------------- */

.calc {
  margin-top: 1.75rem;
  background: var(--paper-raised);
  border: var(--border-strong);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.calc__fields { display: grid; gap: 1.25rem; }

.field { display: grid; gap: 0.4rem; }
.field__label {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.field__range {
  width: 100%;
  min-height: 44px;
  accent-color: var(--signal);
  background: transparent;
}

.field__value {
  font-family: var(--face-mono);
  font-size: var(--t-sm);
  color: var(--ink);
}

.field__number, .field__text {
  min-height: 48px;
  width: 100%;
  max-width: 12rem;
  padding: 0.6rem 0.75rem;
  background: var(--paper);
  border: var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--face-mono);
  font-size: var(--t-base);
}
.field__text { max-width: 26rem; font-family: var(--face-body); }
.field__textarea { min-height: 7rem; resize: vertical; }

.calc__result {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: var(--border);
}
.calc__result > * + * { margin-top: 0.5rem; }

.calc__headline { font-size: var(--t-md); line-height: 1.4; }
.calc__figure {
  font-family: var(--face-mono);
  font-weight: 400;
  background: var(--highlight);
  border-left: 2px solid var(--signal);
  padding: 0.08em 0.3em;
}
.calc__against { font-family: var(--face-mono); font-size: var(--t-sm); color: var(--ink-soft); }
.calc__against strong, .calc__weeks { color: var(--ink); font-weight: 400; }

/* --- Pricing ------------------------------------------------------------- */

.price {
  font-family: var(--face-display);
  font-weight: 700;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
}
.price__term { font-family: var(--face-mono); font-size: var(--t-xs); color: var(--ink-soft); letter-spacing: 0.04em; }

.spec { margin: 0; }
.spec dt {
  font-family: var(--face-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-top: 0.9rem;
}
.spec dd { margin: 0.2rem 0 0; font-size: var(--t-sm); line-height: 1.55; }

.card--price { display: flex; flex-direction: column; }
.card--price > * + * { margin-top: 0.35rem; }
/* After the flow rule on purpose: equal specificity, so source order decides.
   `auto` pins every card's CTA to the bottom so the three line up. */
.card--price .btn { margin-top: auto; }
.card--price .spec { margin-bottom: 1.5rem; }

.notes { margin-top: 1.75rem; display: grid; gap: 0.85rem; }
.note {
  font-size: var(--t-sm);
  line-height: 1.6;
  max-width: 62ch;
  padding-left: 0.9rem;
  border-left: 2px solid color-mix(in srgb, var(--signal) 35%, transparent);
}
.note strong { font-weight: 500; }

/* --- Case ---------------------------------------------------------------- */

.case { max-width: 58ch; margin-top: 1.75rem; }
.case > * + * { margin-top: 0.85rem; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin: 0; }
.metric dt {
  font-family: var(--face-mono); font-size: var(--t-xs);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft);
}
.metric dd {
  margin: 0.15rem 0 0;
  font-family: var(--face-mono);
  font-size: var(--t-lg);
  line-height: 1.1;
}

.link-arrow { font-family: var(--face-mono); font-size: var(--t-sm); }

/* --- Person -------------------------------------------------------------- */

.person { display: flex; gap: 1rem; align-items: flex-start; margin-top: 1.75rem; }
.person__photo {
  width: 72px; height: 72px;
  border-radius: var(--radius);
  object-fit: cover;
  background: color-mix(in srgb, var(--ink) 8%, var(--paper-raised));
  flex: none;
}
.person__body > * + * { margin-top: 0.35rem; }
.person__name { font-size: var(--t-md); }

/* --- FAQ ----------------------------------------------------------------- */

.faq { margin-top: 1.75rem; display: grid; gap: 1.5rem; max-width: 58ch; }
.faq__q { font-size: var(--t-base); font-weight: 600; }
.faq__a { margin-top: 0.4rem; }

/* --- Booking and form ---------------------------------------------------- */

.section--book h2 { max-width: 24ch; }

.cal-embed {
  margin-top: 2rem;
  min-height: 480px;
  background: var(--paper-raised);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* No calendar link configured — don't reserve 480px for one line of text. */
.cal-embed.is-unconnected { min-height: 0; }
.cal-embed noscript p { padding: 1.25rem; font-size: var(--t-sm); }

.fallback {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: var(--border);
}
.fallback__title { font-size: var(--t-base); }
.fallback__intro { font-family: var(--face-mono); font-size: var(--t-xs); color: var(--ink-soft); margin-top: 0.35rem; }

.form { margin-top: 1.25rem; display: grid; gap: 1rem; max-width: 26rem; }
.form__status { font-family: var(--face-mono); font-size: var(--t-xs); line-height: 1.6; }
.form__status:empty { display: none; }
.form__status[data-state="ok"] {
  background: var(--highlight);
  border-left: 2px solid var(--signal);
  padding: 0.6rem 0.75rem;
}
.form__status[data-state="error"] { color: var(--ink); }
.form.is-sent .form__actions, .form.is-sent .field { display: none; }

.field__text:invalid:not(:placeholder-shown) { border-color: var(--signal); }

/* --- Sticky CTA (mobile only) -------------------------------------------- */

.sticky-cta {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 15;
  padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: var(--border);
}
.sticky-cta .btn { width: 100%; }
.sticky-cta[hidden] { display: none; }

/* --- Desktop ------------------------------------------------------------- */

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }

  .site-header__cta { display: inline-flex; }

  .layout {
    grid-template-columns: minmax(0, 1fr) 9rem;
    gap: 2.5rem;
    align-items: start;
  }
  .layout__body { grid-column: 1; grid-row: 1; }
  .rail {
    grid-column: 2; grid-row: 1;
    position: sticky; top: 2rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    text-align: left;
  }

  .console { padding: 1.5rem; }
  .console__form { flex-direction: row; }
  .console__input { flex: 1; }
  .console__submit { flex: none; padding-inline: 1.75rem; }

  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .calc { padding: 1.75rem; }
  .calc__fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; align-items: start; }

  .person__photo { width: 96px; height: 96px; }

  .site-footer__inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1.5rem; justify-content: space-between; }
  .site-footer__inner > * + * { margin-top: 0; }
  .site-footer__legal { width: 100%; }

  .sticky-cta { display: none; }
}

@media (min-width: 64rem) {
  .layout { grid-template-columns: minmax(0, 1fr) 11rem; gap: 3.5rem; }
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
