/* ---------- Tokens ---------- */
:root {
  --bone: #ECEEE8;
  --bone-deep: #E2E5DD;
  --ink: #1D1B18;
  --muted: #5F6259;
  --rule: #C9CCC2;
  --teak: #8A5332;
  --cobalt: #2A45E0;
  --cobalt-ink: #FFFFFF;
  /* Hero log (rgb triplets, read by main.js) */
  --ring-heart-early: 206, 162, 112;
  --ring-heart-late: 166, 114, 68;
  --ring-sap-early: 233, 222, 196;
  --ring-sap-late: 209, 191, 158;
  --ring-bark: 88, 66, 50;
  --ring-sheen: 255, 250, 240;
  --ring-sheen-a: 0.6;
  --ring-shadow-a: 0.2;
  --ring-rim: 255, 240, 220, 0;       /* outer edge highlight (rgba) */
  --contour-accent: 42, 69, 224;

  --display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;

  /* Type scale, ~1.333 */
  --s-1: 0.875rem;
  --s0: 1.0625rem;
  --s1: 1.375rem;
  --s2: 1.875rem;
  --s3: clamp(2rem, 3.6vw, 2.75rem);
  --hero: clamp(2.9rem, 8.4vw, 7.75rem);

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --max: 88rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bone: #1A1714;
    --bone-deep: #221E1A;
    --ink: #ECE8E0;
    --muted: #A39E94;
    --rule: #3A352F;
    --teak: #C9936A;
    --cobalt: #8397FF;
    --cobalt-ink: #12131F;
    --ring-heart-early: 128, 88, 54;
    --ring-heart-late: 94, 62, 38;
    --ring-sap-early: 150, 128, 98;
    --ring-sap-late: 121, 101, 77;
    --ring-bark: 96, 72, 55;
    --ring-sheen: 255, 226, 190;
    --ring-sheen-a: 0.4;
    --ring-shadow-a: 0.55;
    --ring-rim: 255, 226, 190, 0.22;
    --contour-accent: 131, 151, 255;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--display);
  font-size: var(--s0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--ink);
  color: var(--bone);
  padding: 0.5rem 0.9rem;
  z-index: 20;
}
.skip:focus { top: 0.75rem; }

/* ---------- Header ---------- */
.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) var(--gutter) 1.25rem;
  max-width: var(--max);
  margin-inline: auto;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  /* Same frosted pill as the nav, since the slice can run behind the logo on narrow
     screens. The negative margin keeps the mark aligned with the page's left edge. */
  padding: 0.5rem 0.95rem 0.5rem 0.55rem;
  margin-left: -0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bone) 82%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
}

.mark { width: 1.6rem; height: 1.6rem; }
.mark ellipse { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.mark .core { fill: var(--teak); stroke: none; }

.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 2rem);
  font-size: var(--s-1);
  font-weight: 500;
  /* The log slice runs up behind the nav; a frosted pill keeps the links legible */
  padding: 0.3rem 0.3rem 0.3rem clamp(0.3rem, 2vw, 1.25rem);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bone) 82%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
}
.site-header nav a { text-decoration: none; }
.site-header nav a:not(.nav-cta):hover { color: var(--teak); }

.nav-cta {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: background-color .2s, color .2s;
}
.nav-cta:hover { background: var(--ink); color: var(--bone); }

@media (max-width: 50rem) {
  .site-header nav a:not(.nav-cta) { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}

.field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  touch-action: pan-y;
}

.hero-inner {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding: 8rem var(--gutter) clamp(2.5rem, 7vh, 5rem);
  pointer-events: none;
}
.hero-inner a { pointer-events: auto; }

.hero-title {
  font-size: var(--hero);
  line-height: 0.94;
  letter-spacing: -0.045em;
  font-weight: 600;
  max-width: 12ch;
}

.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.hero-title .line > span {
  display: inline-block;
  transform: translateY(105%);
  animation: rise 1.1s cubic-bezier(.2,.7,.1,1) forwards;
}
.hero-title .line:nth-child(2) > span { animation-delay: .14s; }

@keyframes rise { to { transform: none; } }

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.75rem 3rem;
  margin-top: clamp(2rem, 5vh, 3.25rem);
  opacity: 0;
  animation: fade .9s ease-out .6s forwards;
}

.hero-lede {
  font-family: var(--text);
  font-size: var(--s1);
  line-height: 1.45;
  max-width: 38ch;
}

@keyframes fade { to { opacity: 1; } }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s, color .2s, transform .2s;
}
.btn-primary { background: var(--cobalt); color: var(--cobalt-ink); }
.btn-primary:hover { background: var(--ink); color: var(--bone); }
.btn-quiet {
  background: var(--bone);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.btn-quiet:hover { box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 2.5rem clamp(2rem, 5vw, 5rem);
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(5rem, 11vw, 9rem) var(--gutter) 0;
}

.section-head h2 {
  font-size: var(--s3);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.section-head p {
  margin-top: 1rem;
  font-family: var(--text);
  font-size: var(--s0);
  line-height: 1.55;
  color: var(--muted);
  max-width: 30ch;
}

@media (max-width: 52rem) {
  .section { grid-template-columns: 1fr; }
}

/* ---------- Practice ---------- */
.practice { border-top: 1px solid var(--ink); }

.area { border-bottom: 1px solid var(--rule); }

.area summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name toggle" "sum toggle";
  align-items: center;
  column-gap: 1.5rem;
  padding: 1.6rem 0;
  cursor: pointer;
  list-style: none;
}
.area summary::-webkit-details-marker { display: none; }

.area-name {
  grid-area: name;
  font-size: var(--s2);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  transition: color .2s;
}
.area-sum {
  grid-area: sum;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: var(--s0);
}
.area summary:hover .area-name { color: var(--teak); }

.toggle {
  grid-area: toggle;
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  transition: transform .35s cubic-bezier(.2,.7,.1,1), border-color .2s;
}
.toggle::before, .toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.85rem;
  height: 1.5px;
  background: var(--ink);
  translate: -50% -50%;
}
.toggle::after { rotate: 90deg; transition: rotate .35s cubic-bezier(.2,.7,.1,1); }
.area[open] .toggle { border-color: var(--ink); }
.area[open] .toggle::after { rotate: 0deg; }

.area::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size .45s cubic-bezier(.2,.7,.1,1), content-visibility .45s allow-discrete;
}
.area[open]::details-content { block-size: auto; }

.area-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem 3rem;
  padding: 0 0 2rem;
}
.area-body p {
  font-family: var(--text);
  font-size: var(--s1);
  line-height: 1.4;
  max-width: 28ch;
}
.area-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.area-body li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.4rem;
  border-top: 1px solid var(--rule);
}
.area-body li:first-child { border-top: 0; padding-top: 0.2rem; }
.area-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05em;
  width: 0.6rem;
  height: 0.6rem;
  border: 1.5px solid var(--teak);
  border-radius: 50%;
}
.area-body li:first-child::before { top: 0.65em; }

@media (max-width: 40rem) {
  .area-body { grid-template-columns: 1fr; }
}

/* ---------- Process ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  counter-reset: none;
}
.steps li { position: relative; padding-top: 3.25rem; }

/* The connecting line: one continuous track across the sequence */
.steps li::before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 2.25rem;
  right: -1.5rem;
  height: 1px;
  background: var(--rule);
}
.steps li:last-child::before { display: none; }

.step-n {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: var(--s-1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.steps h3 {
  font-size: var(--s1);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.steps p {
  font-family: var(--text);
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 64rem) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li:nth-child(2)::before { display: none; }
}
@media (max-width: 30rem) {
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps li { padding: 0 0 2rem 3.25rem; }
  .steps li::before,
  .steps li:nth-child(2)::before {
    display: block;
    top: 2.25rem;
    bottom: 0.25rem;
    left: 1rem;
    right: auto;
    width: 1px;
    height: auto;
  }
  .steps li:last-child::before { display: none; }
  .steps h3 { padding-top: 0.2rem; }
}

/* ---------- Principles ---------- */
.principles {
  display: grid;
  gap: 0;
}
.principle {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0.5rem 2rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}
.principle:first-child { border-top-color: var(--ink); }
.principle h3 {
  font-size: var(--s1);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.principle p {
  font-family: var(--text);
  color: var(--muted);
  line-height: 1.55;
  max-width: 44ch;
}
@media (max-width: 40rem) {
  .principle { grid-template-columns: 1fr; }
}

/* ---------- Stablecoins & crypto ---------- */
.blurbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem clamp(1.25rem, 3vw, 2.5rem);
  border-top: 1px solid var(--ink);
  padding-top: 1.5rem;
}
.blurb h3 {
  font-size: var(--s0);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.blurb p {
  font-family: var(--text);
  color: var(--muted);
  line-height: 1.55;
}
.blurbs-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2rem; }
@media (max-width: 52rem) {
  .blurbs, .blurbs-2 { grid-template-columns: 1fr; }
}

/* ---------- Contact ---------- */
.contact {
  margin-top: clamp(6rem, 13vw, 11rem);
  padding-block: clamp(3rem, 7vw, 5.5rem);
  /* Full-bleed band; content aligns with the page's max-width column */
  padding-inline: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  background: var(--bone-deep);
  border-top: 1px solid var(--rule);
}
.contact h2 {
  font-size: var(--s3);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.contact p {
  margin-top: 0.9rem;
  font-family: var(--text);
  color: var(--muted);
  font-size: var(--s1);
  max-width: 40ch;
}
.contact-email {
  display: inline-block;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  font-size: clamp(2rem, 7.5vw, 6.5rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--cobalt), var(--cobalt)) 0 100% / 0 3px no-repeat;
  padding-bottom: 0.1em;
  transition: background-size .45s cubic-bezier(.2,.7,.1,1), color .2s;
}
.contact-email:hover,
.contact-email:focus-visible { background-size: 100% 3px; color: var(--cobalt); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin-inline: auto;
  padding: 1.75rem var(--gutter) calc(1.75rem + env(safe-area-inset-bottom, 0px));
  font-size: var(--s-1);
  color: var(--muted);
}
.site-footer a { text-decoration: none; }
.site-footer .fine { flex-basis: 100%; font-size: 0.8125rem; line-height: 1.5; }
.site-footer .fine p { max-width: 70ch; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-title .line > span,
  .hero-foot { animation: none; transform: none; opacity: 1; }
  .area::details-content { transition: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
}
