/* =========================================================================
   Trelven — "Chart"
   The products are named after ship's parts and instruments: Keelson,
   Binnacle, Bulkhead, Lodestar, Plumbline. So the site is drawn like a
   chart: buff paper, a faint hairline grid, engraved rules, soundings and
   bearings, and the magenta that real charts reserve for things that
   matter. Every product graphic is drawn in SVG from one vocabulary
   (design/plates.mjs). This file is shared by every Trelven site: edit it
   in company-site/design/ and sync, never in a copy.
   ========================================================================= */

:root {
  --paper:     #f6f2e9;
  --paper-2:   #efe9db;
  --water:     #e6eef0;
  --ink:       #11293a;
  --ink-soft:  #41586a;
  --ink-faint: #5a6e7b;
  --rule:      #d9d1be;
  --rule-soft: #e6dfcf;
  --magenta:   #b4106a;
  --magenta-2: #8d0b53;
  --card:      #fffdf7;

  --font:  "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --page: 1120px;
  --gutter: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(0.2, 0.7, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1419; --paper-2: #121b22; --water: #121f26;
    --ink: #e8e3d6; --ink-soft: #a0afb7; --ink-faint: #8fa0a9;
    --rule: #22303a; --rule-soft: #1a262e; --card: #121b22;
    --magenta: #ef5fa6; --magenta-2: #ff86bf;
    color-scheme: dark;
  }
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  /* chart paper: two hairline grids, one fine, one coarse */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 112px 112px, 112px 112px;
  background-position: -1px -1px;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; }
::selection { background: var(--magenta); color: #fff; }

.page { max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Chart labels ---------- */
.tick {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 9px;
}
.tick::before { content: ""; width: 18px; height: 1px; background: var(--magenta); }
.tick.plain::before { display: none; }
.tick.hot { color: var(--magenta); }

/* ---------- Masthead ---------- */
.masthead { border-bottom: 1px solid var(--ink); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 40; }
.masthead .page { display: flex; align-items: center; gap: 14px 26px; height: 64px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; font-size: 19px; font-weight: 600; letter-spacing: -0.03em; }
.wordmark svg { width: 20px; height: 20px; color: var(--magenta); }
.masthead nav { display: flex; gap: clamp(12px, 2.4vw, 26px); }
.masthead nav a { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); padding-block: 4px; border-bottom: 2px solid transparent; }
.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current] { color: var(--ink); border-bottom-color: var(--magenta); }

/* ---------- Type ---------- */
h1 { font-size: clamp(42px, 6.6vw, 78px); line-height: 0.98; font-weight: 600; letter-spacing: -0.042em; }
h1 em { font-style: normal; color: var(--magenta); }
.lede { margin-top: 20px; font-size: clamp(18px, 2.2vw, 23px); line-height: 1.4; color: var(--ink-soft); max-width: 40ch; }
h2.title { font-size: clamp(30px, 4.2vw, 48px); line-height: 1.04; font-weight: 600; letter-spacing: -0.035em; }
.note { color: var(--ink-soft); font-size: 16.5px; max-width: 54ch; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(54px, 8vw, 104px) clamp(36px, 5vw, 64px); }
.hero .page { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center; }
.hero .rose { justify-self: end; width: min(100%, 320px); }
@media (max-width: 860px) { .hero .page { grid-template-columns: 1fr; } .hero .rose { justify-self: start; width: 210px; } }
.hero .cta { margin-top: 28px; display: flex; gap: 14px 22px; flex-wrap: wrap; align-items: center; }

/* ---------- Rules between sections ---------- */
.ruled { border-top: 1px solid var(--ink); }
.ruled-soft { border-top: 1px solid var(--rule); }
.section { padding-block: clamp(46px, 6vw, 86px); }
.section > .page > .head { display: grid; gap: 14px; margin-bottom: clamp(26px, 4vw, 44px); }

/* ---------- Courses (hub) ---------- */
.courses { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.course {
  position: relative; display: grid; gap: 14px; align-content: start;
  background: var(--card); border: 1px solid var(--rule);
  padding: clamp(24px, 3vw, 38px); overflow: hidden;
  transition: border-color 160ms var(--ease), transform 220ms var(--ease);
}
.course:hover { border-color: var(--magenta); transform: translateY(-3px); }
.course h2 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.04; }
.course p { color: var(--ink-soft); font-size: 16.5px; max-width: 34ch; }
.course .go { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--magenta); }
.course .plate { margin-top: 6px; }

/* ---------- Plates (the product graphics) ---------- */
.plate { background: var(--water); border: 1px solid var(--rule); overflow: hidden; }
.plate svg { width: 100%; height: auto; display: block; }

/* ---------- Alternating product rows ---------- */
.spec { display: grid; gap: clamp(22px, 4vw, 54px); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; padding-block: clamp(26px, 4vw, 46px); border-top: 1px solid var(--rule); }
.spec:first-of-type { border-top: 0; }
.spec.flip .plate { order: 2; }
@media (max-width: 820px) { .spec { grid-template-columns: 1fr; } .spec.flip .plate { order: 0; } }
.spec .body { display: grid; gap: 12px; align-content: start; }
.spec h3 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }
.spec p { color: var(--ink-soft); max-width: 44ch; }
.spec .meta { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Compact plate cards ---------- */
.fleet { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); }
.vessel { display: grid; gap: 10px; align-content: start; }
.vessel h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.028em; }
.vessel p { font-size: 14.5px; line-height: 1.45; color: var(--ink-soft); }

/* ---------- Index list ---------- */
.list { display: grid; }
.list a, .list div.item { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: 6px 26px; align-items: baseline; padding-block: 18px; border-top: 1px solid var(--rule); }
.list h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.026em; }
.list p { color: var(--ink-soft); font-size: 15.5px; }
.list a:hover h3 { color: var(--magenta); }
.list .at { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--magenta); justify-self: end; white-space: nowrap; }
@media (max-width: 720px) { .list a, .list div.item { grid-template-columns: 1fr; } .list .at { justify-self: start; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); font-size: 15.5px; font-weight: 500; padding: 13px 24px; border: 1px solid var(--ink); }
.btn:hover { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--magenta); color: var(--magenta); background: transparent; }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--ink); padding-block: 38px 56px; }
.foot .cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); padding-bottom: 26px; border-bottom: 1px solid var(--rule); }
.foot h4 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px; font-weight: 600; }
.foot ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.foot a, .foot p, .foot span { font-size: 14.5px; color: var(--ink-soft); }
.foot a:hover { color: var(--magenta); }
.foot .fine { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-top: 20px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--ink-soft); text-transform: uppercase; }

/* ---------- Scroll reveal ---------- */
.rise { opacity: 0; transform: translateY(18px); transition: opacity 620ms var(--ease), transform 620ms var(--ease); }
.rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rise { opacity: 1; transform: none; transition: none; } .course:hover { transform: none; } }

/* ---------- Prototype ribbon ---------- */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .proto a { color: var(--magenta); } }

/* ---------- Plate drawing vocabulary ---------- */
.plate svg .grid  { stroke: var(--rule); stroke-width: 1; }
.plate svg .ink   { stroke: var(--ink-soft); fill: none; opacity: .85; }
.plate svg .deep  { stroke: var(--ink-soft); fill: none; }
.plate svg .hot   { stroke: var(--magenta); fill: none; }
.plate svg .hotf  { fill: var(--magenta); }
.plate svg .inkf  { fill: var(--ink-soft); }
.plate svg .wash  { fill: var(--water); }
.plate svg .lbl   { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.14em; fill: var(--ink); text-transform: uppercase; }
.plate svg .lbl.dim { fill: var(--ink-soft); }
.rose .hot { stroke: var(--magenta); fill: none; }
.rose .hotf { fill: var(--magenta); }
.rose .ink { stroke: var(--ink-soft); fill: none; opacity: .8; }
.rose .deep { stroke: var(--ink); fill: none; }
.rose .lbl { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; fill: var(--ink-soft); }

/* ---------- Narrow screens: let the nav wrap under the wordmark ---------- */
@media (max-width: 760px) {
  .masthead .page { height: auto; padding-block: 12px; flex-wrap: wrap; gap: 10px; }
  .masthead .wordmark { margin-right: 0; width: 100%; }
  .masthead nav { width: 100%; gap: 6px 16px; flex-wrap: wrap; }
  .masthead nav a { font-size: 11px; letter-spacing: 0.1em; }
}

/* ---------- Document pages (Legal, About) ---------- */
.doc { display: grid; gap: clamp(26px, 4vw, 48px); grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 820px) { .doc { grid-template-columns: 1fr; } }
.doc .side { position: sticky; top: 92px; display: grid; gap: 10px; align-content: start; }
@media (max-width: 820px) { .doc .side { position: static; } }
.prose { display: grid; gap: 18px; max-width: 64ch; }
.prose p { color: var(--ink-soft); font-size: 17px; line-height: 1.62; }
.prose p.lead { color: var(--ink); font-size: clamp(19px, 2.2vw, 23px); line-height: 1.42; }
.prose h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.028em; margin-top: 6px; }
.prose a { color: var(--magenta); text-decoration: underline; text-underline-offset: 3px; }
.stamp { border: 1px solid var(--rule); background: var(--card); padding: 18px 20px; display: grid; gap: 7px; }
.stamp dt { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.stamp dd { margin: 0; font-size: 15.5px; }

/* ================================================================
   Live plates
   Each plate is a drawing that keeps working: soundings re-measure,
   rings ping, swell travels, the rose turns. Nothing moves fast and
   nothing moves while it is off screen.
   ================================================================ */
@keyframes pl-ping   { 0% { transform: scale(.42); opacity: 0; } 14% { opacity: .85; } 100% { transform: scale(4.4); opacity: 0; } }
@keyframes pl-ring   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes pl-sound  { 0%, 100% { transform: scaleY(.88); } 50% { transform: scaleY(1); } }
@keyframes pl-cont   { 0%, 100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.028) translateY(-3px); } }
@keyframes pl-float  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pl-wave   { to { transform: translateX(104px); } }
@keyframes pl-spin   { to { transform: rotate(360deg); } }
@keyframes pl-core   { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.55); opacity: .72; } }
@keyframes pl-box    { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.014); } }
@keyframes pl-bead   { 0% { transform: translateY(0); opacity: 0; } 18% { opacity: 1; } 82% { opacity: 1; } 100% { transform: translateY(54px); opacity: 0; } }
@keyframes pl-scan   { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: .7; } 88% { opacity: .7; } 100% { transform: translateX(428px); opacity: 0; } }
@keyframes pl-block  { 0%, 62%, 100% { transform: scale(1); opacity: 1; } 78% { transform: scale(1.28); opacity: .6; } }
@keyframes pl-march-a { to { stroke-dashoffset: -7; } }
@keyframes pl-march-b { to { stroke-dashoffset: -8; } }
@keyframes pl-march-c { to { stroke-dashoffset: -13; } }

.pl .ping      { opacity: 0; animation: pl-ping 5.6s cubic-bezier(.22, .61, .36, 1) infinite paused; animation-delay: calc(var(--i) * 2.8s); }
.pl .ring      { animation: pl-ring calc(6s + var(--i) * 700ms) var(--ease) infinite paused; animation-delay: calc(var(--i) * -900ms); }
.pl .sd        { animation: pl-sound 3.8s var(--ease) infinite paused; animation-delay: calc(var(--i) * -290ms); }
.pl .cont      { animation: pl-cont calc(8s + var(--i) * 900ms) var(--ease) infinite paused; animation-delay: calc(var(--i) * -1.3s); }
.pl .lay       { animation: pl-float 5s var(--ease) infinite paused; animation-delay: calc(var(--i) * -340ms); }
.pl .wave      { animation: pl-wave calc(9s + var(--i) * 1.5s) linear infinite paused; }
.pl .box       { animation: pl-box calc(5.4s + var(--i) * 600ms) var(--ease) infinite paused; animation-delay: calc(var(--i) * -700ms); }
.pl .bead      { opacity: 0; animation: pl-bead 2.8s var(--ease) infinite paused; animation-delay: calc(var(--i) * 900ms); }
.pl .scan      { opacity: 0; animation: pl-scan 4.6s linear infinite paused; }
.pl .block     { animation: pl-block 2.8s var(--ease) infinite paused; animation-delay: 1.1s; }
.pl .spin,      .rose .spin      { animation: pl-spin 56s linear infinite paused; }
.pl .spin-slow, .rose .spin-slow { animation: pl-spin 26s linear infinite paused; }
.pl .sweep,     .rose .sweep     { animation: pl-spin 7.5s linear infinite paused; }
.pl .core,      .rose .core      { animation: pl-core 3s var(--ease) infinite paused; }
.rose .spin-slow { animation-duration: 96s; }
.rose .sweep     { animation-duration: 11s; }
.pl .march-a   { animation: pl-march-a 1.5s linear infinite paused; }
.pl .march-b   { animation: pl-march-b 1.8s linear infinite paused; }
.pl .march-c   { animation: pl-march-c 7s linear infinite paused; }

/* Paused until the plate is on screen; the rose in the hero always turns. */
/* The shorthand above carries `paused`; these rules let it run. */
.plate.live .pl *, svg.rose.live * { animation-play-state: running; }

@media (prefers-reduced-motion: reduce) {
  .pl *, svg.rose * { animation: none !important; }
  .pl .sweep, .rose .sweep { display: none; }
}

/* ---------- Mail: the address, then a choice ---------- */
.mailrow { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 22px 0 4px; border-top: 1px solid var(--rule); }
.addr { font-family: var(--mono); font-size: clamp(17px, 2.4vw, 23px); font-weight: 500; color: var(--ink); letter-spacing: -0.01em; user-select: all; }
.addr.sm { font-size: 14px; letter-spacing: 0; }
.mailacts { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.sm { font-size: 13px; font-weight: 500; padding: 9px 16px; font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.copy { cursor: pointer; font-family: var(--mono); }
.copy.done { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.mailnote { flex-basis: 100%; margin: 2px 0 0; font-size: 14.5px; color: var(--ink-soft); }
@media (max-width: 560px) { .mailrow { gap: 12px; } .mailacts { width: 100%; } .btn.sm { flex: 1 1 auto; justify-content: center; } }

/* ---------- Consulting sub-navigation (second bar) ---------- */
.subnav { border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.subnav .page { display: flex; align-items: center; gap: 6px clamp(14px, 2.4vw, 28px); min-height: 46px; flex-wrap: wrap; padding-block: 8px; }
.subnav a { font-size: 14.5px; font-weight: 500; color: var(--ink-soft); padding-block: 3px; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current] { color: var(--ink); border-bottom-color: var(--magenta); }
.subnav a.cta { margin-left: auto; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--magenta); border: 1px solid var(--magenta); padding: 7px 12px; }
.subnav a.cta:hover, .subnav a.cta[aria-current] { background: var(--magenta); color: #fff; }
@media (max-width: 720px) { .subnav a.cta { margin-left: 0; } }

/* ---------- Three courses on the hub ---------- */
.courses.three { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

/* ---------- Questions (support) ---------- */
.faq details { border-top: 1px solid var(--rule); padding-block: 4px; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding-block: 16px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; display: flex; justify-content: space-between; gap: 18px; align-items: baseline; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--magenta); font-weight: 500; }
.faq details[open] summary::after { content: "\2212"; }
.faq details > *:not(summary) { color: var(--ink-soft); max-width: 68ch; margin: 0 0 12px; }
.faq details ul { padding-left: 20px; }
.faq details li { margin-bottom: 6px; }
.faq a { color: var(--magenta); text-decoration: underline; text-underline-offset: 3px; }
