/* ============================================================================
   "Session Ledger" design system — product pages + the hub index
   Editorial warm-paper marketing pages. Deliberately light-only (a printed
   page), serif-first, ruled like good stationery.
   Self-contained: the homepage and product pages link THIS sheet; doc pages
   (privacy/support) still link style.css.
   Per-app identity comes from [data-accent] on <body> (product pages) or on
   each hub entry. No webfonts (CSP font-src 'self'), no JS. Motion is
   CSS-only and guarded.
   ============================================================================ */

:root {
  /* paper + ink */
  --paper:       #f6f3ec;
  --paper-deep:  #eee9dd;
  --ink:         #22261f;
  --ink-soft:    #4d5347;
  --ink-faint:   #79806f;
  --rule:        rgba(34, 38, 31, .16);
  --rule-soft:   rgba(34, 38, 31, .09);

  /* accent (overridden per app via data-accent) */
  --accent:      #3fae7a;              /* graphics, marks */
  --accent-deep: #16714b;              /* text-safe on paper */
  --wash:        rgba(63, 174, 122, .09);

  --shadow-card: 0 1px 2px rgba(34, 38, 31, .06), 0 12px 32px -12px rgba(34, 38, 31, .18);
  --shadow-phone: 0 2px 4px rgba(34, 38, 31, .12), 0 36px 64px -24px rgba(34, 38, 31, .38);

  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", Roboto, Helvetica, sans-serif;
  --mono:  ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --maxw: 1080px;
  --ease: cubic-bezier(.22, .8, .28, 1);
  color-scheme: light;
}

[data-accent="echocare"]   { --accent: #3fae7a; --accent-deep: #16714b; --wash: rgba(63,174,122,.09); }
[data-accent="lunaday"]    { --accent: #5b6cf0; --accent-deep: #3947b8; --wash: rgba(91,108,240,.08); }
[data-accent="sereni"]     { --accent: #2fb6b0; --accent-deep: #157a76; --wash: rgba(47,182,176,.09); }
[data-accent="fire-path"]  { --accent: #e08a3c; --accent-deep: #a05a14; --wash: rgba(224,138,60,.10); }
[data-accent="zoofriends"] { --accent: #f08a4a; --accent-deep: #b05a1e; --wash: rgba(240,138,74,.10); }
[data-accent="streetcall"] { --accent: #1f7a4d; --accent-deep: #175e3c; --wash: rgba(31,122,77,.09); }

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.09rem;
  line-height: 1.72;
  color: var(--ink);
  background-color: var(--paper);
  /* paper grain + a faint warm wash from the top */
  background-image:
    radial-gradient(120% 60% at 50% -10%, var(--wash), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}
::selection { background: var(--accent); color: #fff; }

a { color: var(--accent-deep); text-decoration: none; }
.prose a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:hover { border-bottom-color: var(--accent-deep); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-deep); outline-offset: 3px; border-radius: 3px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.2rem, 5vw, 2.5rem); }

/* ---- entrance (reuses the hub's fixed-delay pattern) --------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; animation: rise .7s var(--ease) forwards; }
  .d1 { animation-delay: .05s; } .d2 { animation-delay: .14s; }
  .d3 { animation-delay: .23s; } .d4 { animation-delay: .32s; }
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .5rem 1rem; border-radius: 8px;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- top bar -------------------------------------------------------------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--maxw); margin: 0 auto;
  padding: 1.1rem clamp(1.2rem, 5vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}
.bar__brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--ink); font-family: var(--sans); font-weight: 600; font-size: .95rem;
}
.bar__brand .mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1.5px solid var(--ink);
  font-family: var(--mono); font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.bar__nav { display: flex; gap: 1.6rem; }
.bar__nav a {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft); padding: .3rem 0;
}
.bar__nav a:hover, .bar__nav a[aria-current="page"] { color: var(--accent-deep); }

/* ---- masthead -------------------------------------------------------------- */
.masthead {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
.masthead__copy { min-width: 0; }

.app-ident { display: flex; align-items: center; gap: .8rem; margin-bottom: clamp(1.2rem, 3vw, 2rem); }
.app-ident img { width: 52px; height: 52px; border-radius: 12px; box-shadow: var(--shadow-card); }
.app-ident .app-name { font-family: var(--sans); font-weight: 650; font-size: 1.02rem; letter-spacing: -.01em; }
.app-ident .app-sub { display: block; font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-top: .15rem; }

.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-deep); margin: 0 0 1rem;
}
h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.1rem);
  font-weight: 700; line-height: 1.06; letter-spacing: -.022em;
  margin: 0 0 1.2rem;
  text-wrap: balance;
}
h1 em { font-style: italic; color: var(--accent-deep); }
.lede {
  font-size: clamp(1.12rem, 2vw, 1.28rem); line-height: 1.65;
  color: var(--ink-soft); max-width: 34em; margin: 0 0 1.8rem;
}

/* CTA row */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; }
.stamp {
  display: inline-block;
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-deep);
  border: 2px solid var(--accent-deep); border-radius: 6px;
  padding: .65rem 1.1rem;
  transform: rotate(-1.6deg);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.btn-store {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--sans); font-weight: 650; font-size: .95rem;
  background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: .75rem 1.5rem;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
  box-shadow: var(--shadow-card);
}
.btn-store:hover { transform: translateY(-2px); box-shadow: var(--shadow-phone); }
.cta-note { font-family: var(--sans); font-size: .88rem; color: var(--ink-faint); }
.cta-note a { color: var(--accent-deep); border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---- the phone -------------------------------------------------------------- */
.device-col { display: grid; justify-items: center; }
.device {
  width: min(320px, 78vw);
  border-radius: clamp(38px, 11vw, 48px);
  background: var(--ink);
  padding: clamp(9px, 2.6vw, 11px);
  box-shadow: var(--shadow-phone);
  transform: rotate(-2.4deg);
  transition: transform .5s var(--ease);
}
.device:hover { transform: rotate(-1.2deg) translateY(-4px); }
.device img {
  display: block; width: 100%; height: auto;
  border-radius: clamp(29px, 8.6vw, 38px);
}
.device-cap {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); text-align: center; margin-top: 1.4rem;
}

/* ---- the waveform → note-lines motif (echoes the app icon) ----------------- */
.flow-strip { padding: clamp(.5rem, 2vw, 1.5rem) 0 0; overflow: hidden; }
.flow-strip svg { display: block; width: min(560px, 92%); height: auto; margin: 0 auto; }
.flow-strip .wave, .flow-strip .lines { stroke: var(--accent); stroke-width: 10; stroke-linecap: round; fill: none; }
.flow-strip .lines { stroke: var(--accent-deep); }
@media (prefers-reduced-motion: no-preference) {
  .flow-strip .lines path {
    stroke-dasharray: 400; stroke-dashoffset: 400;
    animation: draw 1.1s var(--ease) .5s forwards;
  }
  .flow-strip .lines path:nth-child(2) { animation-delay: .68s; }
  .flow-strip .lines path:nth-child(3) { animation-delay: .86s; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- SOAP-structured sections ---------------------------------------------- */
.soap { list-style: none; margin: clamp(2rem, 6vw, 4rem) 0 0; padding: 0; }
.soap > li {
  position: relative;
  border-top: 1px solid var(--rule);
  padding: clamp(2.2rem, 5vw, 3.6rem) 0 clamp(2.4rem, 5vw, 4rem);
}
.soap-label {
  display: flex; align-items: baseline; gap: 1rem;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 clamp(1.4rem, 3vw, 2.2rem);
}
.soap-label .no { color: var(--accent-deep); font-weight: 700; }
/* the big ghost letter */
.soap > li::before {
  content: attr(data-letter);
  position: absolute; top: clamp(.5rem, 2vw, 1.5rem); right: -.05em;
  font-family: var(--serif); font-weight: 700; font-style: italic;
  font-size: clamp(7rem, 18vw, 15rem); line-height: 1;
  color: color-mix(in srgb, var(--accent) 11%, transparent);
  pointer-events: none; user-select: none;
}

.soap h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 700; letter-spacing: -.018em;
  line-height: 1.15; margin: 0 0 1.1rem; max-width: 18em; text-wrap: balance;
}
.soap .prose { max-width: 42em; color: var(--ink-soft); }
.soap .prose strong { color: var(--ink); }

/* Subjective: the therapist's voice */
.quote {
  font-size: clamp(1.5rem, 3.4vw, 2.3rem); font-style: italic; font-weight: 500;
  line-height: 1.35; letter-spacing: -.01em;
  max-width: 24em; margin: 0 0 1.4rem;
}
.quote mark { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--accent) 32%, transparent) 58%); color: inherit; padding: 0 .08em; }
.attrib { font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* Objective: steps + vitals ledger */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.2rem, 3vw, 2.4rem); margin: clamp(1.6rem, 4vw, 2.6rem) 0; padding: 0; list-style: none; }
.steps li { border-top: 2px solid var(--ink); padding-top: 1rem; }
.steps .n { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 1.9rem; color: var(--accent-deep); display: block; margin-bottom: .3rem; }
.steps h3 { font-family: var(--sans); font-size: 1rem; font-weight: 650; margin: 0 0 .35rem; letter-spacing: -.005em; }
.steps p { font-family: var(--sans); font-size: .92rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }

.vitals { margin: clamp(1.8rem, 4vw, 2.8rem) 0 0; max-width: 44em; }
.vitals-title { font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .8rem; }
.vitals dl { margin: 0; }
.vitals .row {
  display: flex; align-items: baseline; gap: .8rem;
  padding: .55rem 0; border-bottom: 1px dotted var(--rule);
}
.vitals dt { font-family: var(--sans); font-size: .95rem; font-weight: 600; white-space: nowrap; }
.vitals .leader { flex: 1; }
.vitals dd { margin: 0; font-family: var(--mono); font-size: .85rem; color: var(--accent-deep); text-align: right; }

/* Assessment: the boundary figure */
.boundary {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.2rem;
  margin: clamp(1.8rem, 4vw, 2.8rem) 0; padding: 1.4rem 0;
  border-block: 1px solid var(--rule-soft);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint); text-align: center;
}
.boundary .edge {
  border: 2px dashed var(--accent-deep); border-radius: 14px;
  padding: 1rem 1.4rem; color: var(--accent-deep); font-weight: 700;
}
.boundary .void { opacity: .55; }

/* Plan: requirements + FAQ */
.req { list-style: none; padding: 0; margin: 1.2rem 0 2rem; max-width: 42em; }
.req li {
  font-family: var(--sans); font-size: .97rem; color: var(--ink-soft);
  padding: .6rem 0 .6rem 1.7rem; position: relative; border-bottom: 1px dotted var(--rule-soft);
}
.req li::before { content: "✓"; position: absolute; left: .1rem; color: var(--accent-deep); font-weight: 700; }

.faq { max-width: 44em; margin: 1.6rem 0 0; }
.faq details { border-top: 1px solid var(--rule-soft); }
.faq details:last-child { border-bottom: 1px solid var(--rule-soft); }
.faq summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-family: var(--sans); font-weight: 650; font-size: 1rem;
  padding: .95rem 0;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); font-size: 1.1rem; color: var(--accent-deep); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .a { font-family: var(--sans); font-size: .95rem; color: var(--ink-soft); margin: 0 0 1.1rem; max-width: 40em; }

/* closing CTA band */
.close-band {
  margin: clamp(1rem, 3vw, 2rem) 0 0;
  border-top: 2px solid var(--ink);
  padding: clamp(2rem, 5vw, 3rem) 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.close-band .big {
  font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; font-style: italic; letter-spacing: -.015em; margin: 0;
}

/* ---- footer ----------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--rule);
  margin-top: clamp(2rem, 5vw, 3rem);
}
.foot .wrap {
  display: flex; flex-wrap: wrap; gap: .8rem 2rem; align-items: baseline; justify-content: space-between;
  padding-top: 1.4rem; padding-bottom: 2.2rem;
  font-family: var(--sans); font-size: .85rem; color: var(--ink-faint);
}
.foot a { color: var(--ink-soft); }
.foot a:hover { color: var(--accent-deep); }
.foot .links { display: flex; gap: 1.6rem; }

/* ---- responsive -------------------------------------------------------------- */
@media (max-width: 860px) {
  .masthead { grid-template-columns: 1fr; }
  .device-col { order: 2; padding-top: 1rem; }
  .device { transform: rotate(-1.6deg); }
  .steps { grid-template-columns: 1fr; gap: 1.1rem; }
  .soap > li::before { font-size: clamp(6rem, 26vw, 9rem); opacity: .8; }
  .boundary { grid-template-columns: 1fr; gap: .8rem; }
}

/* ---- hub (mortiz.org index): the publication's table of contents ------------ */
.bar__tag {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
}

.hub-head { padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.hub-head h1 { max-width: 14em; }
.hub-head .lede { margin-bottom: 0; }

.contents-label {
  display: flex; align-items: baseline; gap: 1rem;
  border-top: 2px solid var(--ink);
  padding-top: .9rem; margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint);
}
.contents-label .leader, .entry__label .leader {
  flex: 1; min-width: 2rem;
  border-bottom: 1px dotted var(--rule);
  transform: translateY(-.35em);
}

.toc { list-style: none; margin: 0; padding: 0; }
.toc > li {
  position: relative;
  padding: clamp(1.8rem, 4vw, 2.6rem) 0 clamp(1.9rem, 4vw, 2.8rem);
}
.toc > li + li { border-top: 1px solid var(--rule); }
/* ghost ordinal, same move as the product pages' ghost letters */
.toc > li::before {
  content: attr(data-no);
  position: absolute; top: clamp(.6rem, 2vw, 1.2rem); right: -.04em;
  font-family: var(--serif); font-weight: 700; font-style: italic;
  font-size: clamp(4.5rem, 11vw, 8.5rem); line-height: 1;
  color: color-mix(in srgb, var(--accent) 11%, transparent);
  pointer-events: none; user-select: none;
}

.entry__label {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .8rem;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 1rem;
}
.entry__label .no { color: var(--accent-deep); font-weight: 700; }
.status--live { color: var(--accent-deep); font-weight: 700; }
.status--live::before { content: "●"; margin-right: .55em; font-size: .8em; }
.status--review { color: var(--accent-deep); }

.toc h2 {
  font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 700;
  letter-spacing: -.02em; line-height: 1.1;
  margin: 0 0 .7rem; text-wrap: balance;
}
.toc h2 a { color: inherit; }
.toc h2 a:hover { color: var(--accent-deep); }

.entry__sell {
  font-size: clamp(1.02rem, 1.6vw, 1.12rem); line-height: 1.65;
  color: var(--ink-soft); max-width: 36em; margin: 0 0 1.3rem;
}

.entry__links { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.7rem; margin: 0; }
.entry__links a:not(.btn-store) {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); padding: .3rem 0;
}
.entry__links a:not(.btn-store):hover { color: var(--accent-deep); }
.entry__links .go { color: var(--accent-deep); font-weight: 700; }
.entry__links .go::after {
  content: "→"; display: inline-block; margin-left: .5em;
  transition: transform .18s var(--ease);
}
.entry__links .go:hover::after { transform: translateX(4px); }
.entry__links .btn-store { font-size: .88rem; padding: .6rem 1.2rem; }

@media (max-width: 640px) {
  .toc > li::before { font-size: clamp(3.4rem, 16vw, 5rem); opacity: .8; }
}

/* ---- reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; }
}

/* ---- print ---------------------------------------------------------------------- */
@media print {
  .bar, .flow-strip, .device-col, .skip-link { display: none !important; }
  body { background: #fff; }
}
