/* Sopiora website. One stylesheet, system fonts, no third-party assets.
   Colours come from the app (frontend/web/src/index.css) plus the logo's mint spark, so the site and the product
   look like one family. Contrast of every text/background pair is checked by site.test.mjs. */
:root {
  --ink: #1f2421;
  --ink-raised: #2b312d;
  --ink-line: #3d4741;
  --graphite: #444b46;
  --graphite-soft: #5b625c;
  --on-dark: #c9d3cc;
  --signal: #0f766e;
  --signal-dark: #0b5f58;
  --signal-soft: #dcf0ec;
  --mint: #99f6e4;
  --surface: #ffffff;
  --surface-sunken: #f7f5f2;
  --line: #e4dfd6;
  --line-strong: #858a84;
  --radius-control: 6px;
  --radius-panel: 10px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--graphite);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--signal-dark); }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
.hero :focus-visible, .contact :focus-visible, .site-footer :focus-visible { outline-color: var(--mint); }

/* rem, not px, so the layout grows with the larger text size set for big screens below. */
.container { width: 100%; max-width: 70rem; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 52rem; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  z-index: 10;
}
.skip-link:focus { top: 16px; }

h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -0.025em; }

/* ---- header ---- */
.site-header { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand img { display: block; }

.nav-list { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-list a:not(.button) {
  display: inline-block;
  padding: 10px 12px;
  color: var(--graphite);
  text-decoration: none;
  border-radius: var(--radius-control);
  white-space: nowrap;
}
.nav-list a:not(.button):hover { color: var(--ink); background: var(--surface-sunken); }
.nav-list .button { margin-left: 8px; }

/* ---- buttons ---- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  background: var(--signal);
  color: #fff;
  border: 2px solid var(--signal);
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.button:hover { background: var(--signal-dark); border-color: var(--signal-dark); color: #fff; }
.button:active { transform: scale(0.98); }
.button-small { min-height: 44px; padding: 0 18px; }
.button-mint { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.button-mint:hover { background: #fff; border-color: #fff; color: var(--ink); }
.button-ghost { background: transparent; border-color: #7b857e; color: #fff; }
.button-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: #fff; color: #fff; }
.button-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button-outline:hover { background: var(--surface-sunken); border-color: var(--ink); color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ---- hero (dark) ---- */
.hero {
  position: relative;
  background-color: var(--ink);
  background-image: radial-gradient(circle, #343c37 1px, transparent 1.4px);
  background-size: 26px 26px;
  color: #fff;
  padding: 56px 0 72px;
}
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
.hero h1, .hero h2 { color: #fff; }

.eyebrow {
  margin: 0 0 16px;
  color: var(--signal-dark);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero .eyebrow { color: var(--mint); }

h1 { margin: 0; font-size: clamp(2.3rem, 7.4vw, 4.6rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.035em; }
.lead { margin: 22px 0 0; max-width: 38rem; font-size: clamp(1.05rem, 2.4vw, 1.25rem); color: var(--graphite); }
.hero .lead { color: var(--on-dark); }

/* The changing word. Only "organisation" is in the page itself; site.js adds the others. */
.rotator { display: inline-grid; vertical-align: bottom; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; color: var(--mint); }
.rot-word { grid-area: 1 / 1; opacity: 0; transform: translateY(100%); transition: transform 0.55s var(--ease), opacity 0.4s ease; }
.rot-word.is-active { opacity: 1; transform: none; }
.rot-word.is-leaving { opacity: 0; transform: translateY(-100%); }

/* ---- the connected-parts diagram ---- */
.orbit { margin: 0 auto; width: 100%; max-width: 32rem; }
.orbit svg { display: block; width: 100%; height: auto; }
.orbit figcaption { margin-top: 4px; text-align: center; color: var(--on-dark); font-size: 0.95rem; }

.orbit-lines line { stroke: var(--ink-line); stroke-dasharray: 4 7; }
.orbit-node rect { fill: var(--ink-raised); stroke: var(--ink-line); stroke-width: 1.5; }
.orbit-node text { fill: #fff; font-family: var(--font); font-size: 15px; font-weight: 600; }
.orbit-core circle { fill: var(--ink-raised); stroke: var(--mint); stroke-width: 2; }

/* ---- sections ---- */
.section { padding: 72px 0; }
.section-tint { background: var(--surface-sunken); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { margin: 0; font-size: clamp(1.7rem, 4.2vw, 2.6rem); }
.section-lead { margin: 14px 0 0; max-width: 40rem; font-size: 1.1rem; color: var(--graphite); }

/* ---- build your Sopiora ---- */
.build-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: start; }
.build-count { margin: 20px 0 0; font-weight: 600; color: var(--ink); }
.build-count span { display: inline-block; min-width: 3.6em; padding: 2px 10px; background: var(--signal-soft); color: var(--signal-dark); border-radius: 999px; text-align: center; font-variant-numeric: tabular-nums; }

.module-list { margin: 20px 0 0; padding: 0; list-style: none; }
.module-list li { border-top: 1px solid var(--line); transition: opacity 0.25s ease; }
.module-list li:last-child { border-bottom: 1px solid var(--line); }
.module-list li:not(.has-switch) { display: grid; gap: 2px; padding: 14px 0; }
.module-list strong { color: var(--ink); display: block; }
.module-list span { color: var(--graphite-soft); font-size: 0.95rem; }

.switch {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 14px 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.switch-track { flex: none; position: relative; width: 46px; height: 26px; margin-top: 2px; background: var(--line-strong); border-radius: 999px; transition: background-color 0.2s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.25s var(--ease); }
.switch[aria-checked="true"] .switch-track { background: var(--signal); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(20px); }
.switch-text { display: grid; gap: 2px; }
.module-list li.is-off strong, .module-list li.is-off .switch-text > span { opacity: 0.55; }

/* a pretend workspace: it only illustrates parts appearing and disappearing */
.workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ws-bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); }
.ws-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.ws-bar span:first-child { background: var(--mint); }
.ws-bar em { margin-left: 8px; font-style: normal; font-size: 0.85rem; font-weight: 600; color: var(--graphite-soft); }
.ws-body { display: grid; grid-template-columns: 8.5rem 1fr; min-height: 21rem; position: relative; }
.ws-nav { margin: 0; padding: 14px 10px; list-style: none; background: var(--ink); }
.ws-nav li { padding: 8px 10px; margin-bottom: 2px; color: #fff; font-size: 0.9rem; border-radius: 6px; }
.ws-nav li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: var(--mint); border-radius: 50%; }
.ws-tiles { margin: 0; padding: 16px; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 10px; align-content: start; }
.ws-tiles li { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--signal); border-radius: 8px; }
.ws-tiles b { display: block; color: var(--ink); font-size: 0.95rem; }
.ws-tiles i { display: block; font-style: normal; font-size: 0.82rem; color: var(--graphite-soft); }
.ws-nav li.is-off, .ws-tiles li.is-off { display: none; }
.ws-tiles li.pop { animation: pop 0.4s var(--ease); }
.ws-empty { position: absolute; inset: 0 0 0 8.5rem; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; color: var(--graphite-soft); }
.ws-empty[hidden] { display: none; }
.ws-note { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-sunken); color: var(--graphite-soft); font-size: 0.85rem; }

/* ---- a day in Sopiora ---- */
.day { list-style: none; margin: 40px 0 0; padding: 0; }
.day-item { position: relative; display: grid; grid-template-columns: 4.6rem 1fr; gap: 0 28px; padding-bottom: 36px; }
.day-item:last-child { padding-bottom: 0; }
.day-item time { color: var(--signal-dark); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.day-item::before { content: ""; position: absolute; left: calc(4.6rem + 13px); top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.day-item:last-child::before { display: none; }
.day-item::after { content: ""; position: absolute; left: calc(4.6rem + 6px); top: 6px; width: 16px; height: 16px; background: var(--surface); border: 3px solid var(--signal); border-radius: 50%; transition: background-color 0.4s ease 0.3s; }
.day-item.is-visible::after { background: var(--signal); }
.day-item h3 { margin: 0 0 6px; font-size: 1.3rem; }
.day-item p { margin: 0; }

/* ---- who it is for ---- */
.roles { margin-top: 32px; display: grid; gap: 16px; }
.role-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.role-tab {
  min-height: 44px;
  padding: 0 20px;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.role-tab:hover { border-color: var(--ink); }
.role-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.role-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 28px; }
.role-panel[hidden] { display: none; }
.role-panel h3 { margin: 0 0 12px; font-size: 1.35rem; }
.roles.is-tabs { display: block; }
.roles.is-tabs .role-panel { animation: fade-in 0.35s var(--ease); }

.tick-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tick-list li { position: relative; padding-left: 32px; }
.tick-list li::before { content: ""; position: absolute; left: 4px; top: 0.35em; width: 8px; height: 14px; border: solid var(--signal); border-width: 0 3px 3px 0; transform: rotate(45deg); }

.small-heading { margin: 48px 0 14px; font-size: 1.15rem; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 8px 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font-size: 0.95rem; }
.after-chips { margin: 20px 0 0; max-width: 40rem; }

/* ---- safe and in your control ---- */
.trust-grid { display: grid; grid-template-columns: 1fr; gap: 32px; }
.trust-list { counter-reset: trust; margin: 0; padding: 0; list-style: none; }
.trust-list li { counter-increment: trust; position: relative; padding: 24px 0 24px 68px; border-top: 1px solid var(--line); }
.trust-list li:last-child { border-bottom: 1px solid var(--line); }
.trust-list li::before { content: counter(trust, decimal-leading-zero); position: absolute; left: 0; top: 22px; color: var(--signal); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.trust-list h3 { margin: 0 0 6px; font-size: 1.2rem; }
.trust-list p { margin: 0; }

/* ---- cards (used on the schools page) ---- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 24px; transition: border-color 0.2s ease; }
.card:hover { border-color: var(--signal); }
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--graphite); }

.two-col { display: grid; grid-template-columns: 1fr; gap: 40px; margin-top: 0; }
.small-heading { letter-spacing: -0.01em; }
.plain-list { margin: 0 0 16px; padding: 0; list-style: none; }
.plain-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 1px solid var(--line); }
.plain-list strong { color: var(--ink); }

/* ---- questions ---- */
.faq { margin-top: 32px; border-top: 1px solid var(--line); }
.faq-item { padding: 24px 0; border-bottom: 1px solid var(--line); }
.faq-item h3 { margin: 0 0 8px; font-size: 1.2rem; }
.faq-item p { margin: 0; }
.more-link { margin: 32px 0 0; }

/* ---- inner page: breadcrumb ---- */
.hero-single .hero-copy { max-width: 52rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 0.95rem; color: var(--on-dark); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--ink-line); }
.breadcrumb a { color: var(--mint); }
.hero-single { padding: 56px 0 64px; }

/* ---- contact ---- */
.contact { background: var(--ink); color: #fff; }
.contact h2, .contact .section-lead { color: #fff; }
.contact-box { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: center; }
.contact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.contact-list li { display: grid; gap: 2px; padding: 16px 20px; border: 1px solid var(--ink-line); border-radius: var(--radius-panel); }
.contact-label { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-dark); }
.contact-list a { color: #fff; font-size: 1.25rem; font-weight: 600; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--mint); }

/* ---- footer ---- */
.site-footer { background: var(--ink); border-top: 1px solid var(--ink-line); color: var(--on-dark); padding: 24px 0; font-size: 0.95rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-row p { margin: 0; }
.footer-name { color: #fff; font-weight: 700; }
.footer-legal { display: grid; gap: 6px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ink-line); font-size: 0.85rem; line-height: 1.55; }
.footer-legal p { margin: 0; max-width: 60rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-block; padding: 6px 0; }
.site-footer a { color: #fff; }

/* ---- 404 ---- */
.not-found { padding: 64px 0; min-height: 70vh; }
.not-found h1 { margin-top: 48px; font-size: clamp(1.9rem, 5vw, 2.8rem); }

/* ---- motion ----
   Each thing that moves has a job. The first screen settles in. The rotating word shows the product is not only for
   one kind of organisation. The diagram pulses part by part, showing information flowing between them. Sections
   appear as you scroll to them. All of it stops for people who ask their device for less motion. */
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes flow { to { stroke-dashoffset: -22; } }
@keyframes node-on {
  0%, 3% { fill: var(--ink-raised); stroke: var(--ink-line); }
  8%, 20% { fill: var(--signal); stroke: var(--mint); }
  28%, 100% { fill: var(--ink-raised); stroke: var(--ink-line); }
}
@keyframes core-glow {
  0%, 100% { stroke-opacity: 1; stroke-width: 2; }
  50% { stroke-opacity: 0.35; stroke-width: 7; }
}

.hero-copy > * { animation: rise 0.8s var(--ease) both; }
.hero-copy > :nth-child(2) { animation-delay: 0.08s; }
.hero-copy > :nth-child(3) { animation-delay: 0.16s; }
.hero-copy > :nth-child(4) { animation-delay: 0.24s; }
.hero-copy > :nth-child(5) { animation-delay: 0.32s; }
.orbit { animation: settle 1s var(--ease) 0.2s both; }

.orbit-lines line { animation: flow 1.4s linear infinite; }
.orbit-node rect { animation: node-on 9s ease-in-out infinite; }
.orbit-node.n1 rect { animation-delay: 0.5s; }
.orbit-node.n2 rect { animation-delay: 2s; }
.orbit-node.n3 rect { animation-delay: 3.5s; }
.orbit-node.n4 rect { animation-delay: 5s; }
.orbit-node.n5 rect { animation-delay: 6.5s; }
.orbit-node.n6 rect { animation-delay: 8s; }
.orbit-core circle { animation: core-glow 3.6s ease-in-out infinite; }

/* Starts hidden only when site.js is running (it adds "reveal-on"), so the page never depends on it. */
.reveal-on .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease var(--delay, 0ms), transform 0.7s var(--ease) var(--delay, 0ms); }
.reveal-on .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- wider screens ---- */
@media (min-width: 720px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: repeat(2, 1fr); gap: 56px; }
  .contact-box { grid-template-columns: 1.1fr 1fr; gap: 56px; }
  .section { padding: 96px 0; }
  .hero { padding: 72px 0 88px; }
  .roles:not(.is-tabs) { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  .hero { padding: 88px 0 104px; }
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 56px; }
  .build-grid { grid-template-columns: 1fr 1.05fr; gap: 64px; }
  .workspace { position: sticky; top: 104px; }
  .trust-grid { grid-template-columns: 0.8fr 1.2fr; gap: 72px; }
  .trust-grid > div:first-child { position: sticky; top: 104px; align-self: start; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .card-grid:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }
}

/* Tablets in portrait: keep the text links but tighten them so the header never wraps. */
@media (max-width: 899px) {
  .nav-list a:not(.button) { padding: 10px 7px; font-size: 0.92rem; }
}

/* On phones the text links would crowd the header; the button stays. */
@media (max-width: 719px) {
  .nav-list li:not(:last-child) { display: none; }
  .container { padding: 0 20px; }
  .actions .button { flex: 1 1 100%; }
  .role-panel { padding: 22px 20px; }
}

@media (max-width: 539px) {
  .ws-body { grid-template-columns: 1fr; }
  .ws-nav { display: none; }
  .ws-empty { inset: 0; }
  .day-item { grid-template-columns: 3.7rem 1fr; gap: 0 22px; }
  .day-item time { font-size: 1.25rem; }
  .day-item::before { left: calc(3.7rem + 10px); }
  .day-item::after { left: calc(3.7rem + 3px); }
  .trust-list li { padding-left: 56px; }
}

/* Very small phones (320 px wide and under). */
@media (max-width: 359px) {
  .container { padding: 0 16px; }
  .brand { font-size: 1.2rem; gap: 8px; }
  .button-small { padding: 0 14px; }
  .card, .role-panel { padding: 20px; }
  .contact-list li { padding: 14px 16px; }
  .contact-list a { font-size: 1.05rem; }
  .orbit-node text { font-size: 16px; }
}

/* Large monitors and TVs: scale the whole page up instead of leaving a small column in the middle. */
@media (min-width: 1600px) { html { font-size: 112.5%; } }
@media (min-width: 2200px) { html { font-size: 125%; } }
@media (min-width: 3000px) { html { font-size: 150%; } }
