/* ============================================================
   OpenHanse — unified design system
   Maritime night (default) + parchment light theme
   ============================================================ */

:root {
  /* fonts */
  --serif: "Newsreader", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;

  /* accent (overridden by JS tweak) */
  --accent: #d9a441;
  --accent-ink: #1a1304;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --reveal-dur: 0.9s;
  --drift-dur: 70s;
}

/* ---------- dark / maritime night (default) ---------- */
:root,
[data-theme="dark"] {
  --bg: #040813;
  --bg-2: #0a1424;
  --bg-3: #0f1d33;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-line: rgba(195, 214, 244, 0.12);
  --ink: #e9eff8;
  --ink-2: #aebbcf;
  --ink-3: #6b7a93;
  --hero-sky-1: #0a1730;
  --hero-sky-2: #040813;
  --hero-sea: #02060f;
  --grid-line: rgba(133, 164, 209, 0.10);
  --star: rgba(214, 228, 248, 0.9);
  --glow: color-mix(in oklch, var(--accent) 60%, transparent);
}

/* ---------- light / parchment chart (removed) ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

#root { min-height: 100vh; }

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

a { color: inherit; text-decoration: none; }

/* ============================================================
   Reusable type
   ============================================================ */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow .tick { color: var(--accent); }

.display {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.32;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.prose { color: var(--ink-2); max-width: 60ch; text-wrap: pretty; }
.prose + .prose { margin-top: 1.1rem; }

.shell {
  width: min(1180px, 100% - 10vw);
  margin-inline: auto;
}

/* ============================================================
   Background atmosphere
   ============================================================ */
.atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg);
}

/* drifting compass rose, lower right */
.compass {
  position: absolute;
  right: -80px; bottom: -80px;
  width: 320px; height: 320px;
  z-index: 0;
  opacity: 0.32;
  color: var(--accent);
  pointer-events: none;
}
[data-motion="full"] .compass { animation: spin var(--drift-dur) linear infinite; }
[data-motion="calm"] .compass { animation: spin calc(var(--drift-dur) * 2.4) linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Top nav
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
  background: color-mix(in oklch, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--panel-line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.brand__mark {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  color: var(--accent);
}
.brand__name {
  font-family: var(--serif);
  font-size: 1.18rem;
  letter-spacing: 0.01em;
}
.brand__name b { font-weight: 600; }
.brand__name span { color: var(--ink-3); font-weight: 300; }

/* segmented Home / Cloud switch */
.switch {
  position: relative;
  display: flex;
  padding: 4px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: var(--panel);
}
.switch__thumb {
  position: absolute;
  top: 4px; bottom: 4px;
  left: 4px; width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: left 0.42s var(--ease), width 0.42s var(--ease), background 0.4s var(--ease);
  z-index: 0;
}
.switch button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 9px 22px;
  color: var(--ink-2);
  transition: color 0.3s var(--ease);
}
.switch button.is-active { color: var(--accent-ink); }
/* on the signup sub-page: active toggle reads as an outline, not a solid fill */
.switch[data-mode="outline"] .switch__thumb { background: transparent; border: 1px solid var(--accent); }
.switch[data-mode="outline"] button.is-active { color: var(--accent); }
.switch__icon { padding-inline: 12px; }

.nav__cta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  border: 1px solid var(--panel-line);
  padding: 10px 18px;
  border-radius: 999px;
  transition: all 0.3s var(--ease);
}
.nav__cta:hover { color: var(--ink); border-color: var(--accent); }
.nav__cta:disabled { cursor: default; }
/* solid state = "you are here" on the signup sub-page */
.nav__cta--solid, .nav__cta--solid:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ============================================================
   View transition
   ============================================================ */
.view { position: relative; z-index: 1; }
.view-enter { animation: viewIn 0.6s var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
[data-motion="off"] .view-enter { animation: none; }

/* ============================================================
   Reveal on scroll
   ============================================================ */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.in { opacity: 1; transform: none; transition: opacity var(--reveal-dur) var(--ease), transform var(--reveal-dur) var(--ease); }
[data-motion="off"] .reveal { opacity: 1; transform: none; }

/* ============================================================
   Hero (shared)
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 140px 0 90px;
  background-image:
    linear-gradient(180deg, rgba(4,8,19,0.5) 0%, rgba(4,8,19,0.12) 26%, rgba(4,8,19,0.32) 62%, var(--bg) 100%),
    linear-gradient(90deg, rgba(4,8,19,0.92) 0%, rgba(4,8,19,0.5) 42%, rgba(4,8,19,0.08) 72%, rgba(4,8,19,0) 100%),
    url("assets/hero.webp");
  background-size: cover;
  background-position: center 38%;
  background-repeat: no-repeat;
}
.hero__title { font-size: clamp(3rem, 9vw, 7.5rem); }
.hero__sub { margin-top: 1.6rem; font-size: clamp(1.25rem, 2.4vw, 1.9rem); color: var(--ink-2); max-width: 26ch; }
.hero__row { margin-top: 2.8rem; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

.scrollcue {
  position: absolute;
  left: 50%; bottom: 34px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.scrollcue .bar { width: 1px; height: 46px; background: linear-gradient(var(--accent), transparent); }
[data-motion="full"] .scrollcue .bar { animation: drip 2.2s var(--ease) infinite; }
@keyframes drip { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 15px 26px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s var(--ease);
}
.btn--solid { background: var(--accent); color: var(--accent-ink); }
.btn--solid:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -16px var(--glow); }
.btn--ghost { background: transparent; border-color: var(--panel-line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn .arr { transition: transform 0.3s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: clamp(80px, 13vh, 160px) 0; position: relative; }
/* simple solid background with slight variations between sections */
.view section.section:nth-of-type(even) { background: var(--bg-2); }
.section__head { display: flex; flex-direction: column; gap: 1.4rem; max-width: 30ch; margin-bottom: 3.4rem; }
.section__title { font-size: clamp(2rem, 5vw, 3.6rem); }

.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(40px, 7vw, 110px); align-items: start; }
.split--chart { grid-template-columns: 1.35fr 0.65fr; align-items: center; }
@media (max-width: 860px) { .split, .split--chart { grid-template-columns: 1fr; gap: 36px; } }

/* numbered triad cards */
.triad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--panel-line); border: 1px solid var(--panel-line); border-radius: 16px; overflow: hidden; }
@media (max-width: 760px) { .triad { grid-template-columns: 1fr; } }
.cell {
  background: var(--bg);
  padding: 36px 32px 40px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
  transition: background 0.4s var(--ease);
}
.cell:hover { background: var(--bg-2); }
.cell__no { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.2em; color: var(--accent); }
.cell__title { font-family: var(--serif); font-size: 1.55rem; line-height: 1.1; }
.cell__body { color: var(--ink-2); font-size: 0.98rem; }
.cell__link { margin-top: auto; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); display: inline-flex; gap: 8px; align-items: center; padding-top: 18px; }
.cell__link .arr { transition: transform 0.3s var(--ease); }
.cell:hover .cell__link .arr { transform: translateX(4px); }

/* principles ledger */
.ledger { display: flex; flex-direction: column; }
.ledger__row {
  display: grid; grid-template-columns: 2.2rem 1fr; gap: clamp(20px,4vw,60px);
  padding: 40px 0;
  border-top: 1px solid var(--panel-line);
  align-items: baseline;
}
.ledger__row:last-child { border-bottom: 1px solid var(--panel-line); }
.ledger__no { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.ledger__grid { display: grid; grid-template-columns: 0.7fr 1.3fr; gap: clamp(16px,4vw,60px); }
@media (max-width: 760px) { .ledger__grid { grid-template-columns: 1fr; gap: 12px; } }
.ledger__name { font-family: var(--serif); font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.ledger__body { color: var(--ink-2); }

/* contact band */
.band { text-align: center; padding: clamp(90px,16vh,190px) 0; }
.band__title { font-size: clamp(2.2rem, 6vw, 4.6rem); margin-bottom: 2.6rem; }

/* ============================================================
   Footer
   ============================================================ */
.foot {
  position: relative;
  overflow: hidden;
  z-index: 1;
  background: #02040a;
  border-top: 1px solid var(--panel-line);
  padding: clamp(56px, 8vh, 92px) 0 30px;
}
.foot__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: clamp(28px, 5vw, 64px);
}
.foot__brand { display: flex; flex-direction: column; gap: 18px; max-width: 36ch; }
.foot__tag { color: var(--ink-2); font-size: 1rem; text-wrap: pretty; }
.foot__by { color: var(--ink-3); font-size: 0.9rem; }
.foot__by a { color: var(--ink-2); border-bottom: 1px solid var(--panel-line); transition: all 0.25s var(--ease); }
.foot__by a:hover { color: var(--accent); border-color: var(--accent); }
.foot__col { display: flex; flex-direction: column; gap: 13px; }
.foot__col h4 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.foot__col a { color: var(--ink-2); font-size: 0.97rem; cursor: pointer; width: fit-content; transition: color 0.25s var(--ease); }
.foot__col a:hover { color: var(--accent); }
.foot__bottom {
  position: relative;
  z-index: 1;
  margin-top: clamp(40px, 6vh, 72px);
  padding-top: 24px;
  border-top: 1px solid var(--panel-line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
@media (max-width: 860px) {
  .foot__grid { grid-template-columns: 1fr 1fr; row-gap: 36px; }
  .foot__brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .foot__grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   CLOUD VIEW
   ============================================================ */
.cloud-tag { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; color: var(--ink-2); border: 1px solid var(--panel-line); padding: 7px 14px; border-radius: 999px; }
.cloud-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--glow); }

.code-accent { color: var(--accent); font-family: var(--mono); }

/* Rustlet chart */
.chart-wrap { position: relative; }
.chart {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 9.09%,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 6.25% 100%,
    var(--bg-2);
  overflow: hidden;
}
.chart__lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.route { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 5 7; stroke-linecap: round; opacity: 0.9; }
[data-motion="full"] .route { animation: sail 1.2s linear infinite; }
[data-motion="calm"] .route { animation: sail 2.6s linear infinite; }
@keyframes sail { to { stroke-dashoffset: -24; } }

.port {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  cursor: pointer;
  text-align: center;
  width: 124px;
}
.port__node {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border: 1px solid var(--panel-line);
  background: var(--bg);
  color: var(--ink-2);
  border-radius: 14px;
  transition: all 0.35s var(--ease);
  position: relative;
}
.port:hover .port__node { border-color: var(--accent); color: var(--ink); transform: translateY(-3px); }
.port.on .port__node { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 0 5px var(--glow); }
.port__label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.port.on .port__label { color: var(--ink); }
.port__seq { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-ink); color: var(--accent); font-family: var(--mono); font-size: 0.66rem; display: grid; place-items: center; }

/* central "My Solution" hub */
.hub { position: absolute; transform: translate(-50%, -50%); z-index: 2; }
.hub__node {
  width: 132px; height: 132px;
  border-radius: 50%;
  display: grid; place-items: center; align-content: center; gap: 2px;
  text-align: center;
  border: 1.5px dashed var(--panel-line);
  background: radial-gradient(circle at 50% 40%, var(--bg-3), var(--bg));
  transition: all 0.4s var(--ease);
}
.hub__node.live {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 6px var(--glow), 0 0 40px -6px var(--glow);
}
.hub__count { font-family: var(--serif); font-size: 2.4rem; line-height: 1; color: var(--ink-3); transition: color 0.4s var(--ease); }
.hub__node.live .hub__count { color: var(--accent); }
.hub__label { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }

/* chart readout */
.readout { display: flex; flex-direction: column; gap: 22px; }
.readout__count { font-family: var(--serif); font-size: clamp(2.6rem,6vw,4rem); line-height: 1; }
.readout__count b { color: var(--accent); font-weight: 400; }
.readout__desc { min-height: 3.2em; color: var(--ink-2); }
.readout__desc strong { color: var(--ink); font-weight: 600; }
.readout__hint { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; }

/* feature grid (alt viz) */
.fgrid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--panel-line); border: 1px solid var(--panel-line); border-radius: 16px; overflow: hidden; }
@media (max-width: 820px) { .fgrid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 540px) { .fgrid { grid-template-columns: 1fr; } }
.fcard { background: var(--bg); padding: 30px 28px 34px; display: flex; flex-direction: column; gap: 12px; transition: background 0.35s var(--ease); }
.fcard:hover { background: var(--bg-2); }
.fcard__icon { width: 40px; height: 40px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--panel-line); border-radius: 11px; margin-bottom: 6px; }
.fcard__name { font-family: var(--serif); font-size: 1.3rem; }
.fcard__body { color: var(--ink-2); font-size: 0.95rem; }

/* signup */
.signup { border: 1px solid var(--panel-line); border-radius: 22px; background: var(--panel); padding: clamp(32px,5vw,64px); position: relative; overflow: hidden; }
.signup__form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.field label .req { color: var(--accent); }
.field input, .field textarea {
  background: var(--bg);
  border: 1px solid var(--panel-line);
  border-radius: 11px;
  padding: 14px 16px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  transition: border-color 0.3s var(--ease);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
@media (max-width: 620px) { .signup__form { grid-template-columns: 1fr; } }

.thanks { text-align: center; padding: 30px 0 8px; }
.thanks__mark { width: 60px; height: 60px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.thanks__title { font-family: var(--serif); font-size: 2rem; margin-bottom: 10px; }

/* spacing helpers */
.mt-s { margin-top: 1rem; }
.mt-m { margin-top: 2rem; }

/* ============================================================
   Mobile refinements
   ============================================================ */
@media (max-width: 620px) {
  .chart { aspect-ratio: 1 / 1; }
  .hub__node { width: 104px; height: 104px; }
  .hub__count { font-size: 1.9rem; }
  .port { width: 92px; }
  .port__node { width: 44px; height: 44px; }
  .port__label { font-size: 0.6rem; }
}
@media (max-width: 600px) {
  .nav { padding: 12px 16px; }
  .brand__name { font-size: 1rem; }
  .switch button { padding: 8px 13px; font-size: 0.64rem; }
  .switch__icon { padding-inline: 10px; }
  .nav__cta { padding: 8px 12px; font-size: 0.6rem; letter-spacing: 0.06em; }
  .readout__count { font-size: 2.6rem; }
}
@media (max-width: 430px) {
  .brand__name { display: none; }
}

/* ============================================================
   Web-component hosts (light DOM custom elements)
   ============================================================ */
openhanse-app { display: block; min-height: 100vh; }
main-view, cloud-view, contact-view { display: block; }
