/* Glassa public site. Tokens are the Glassa shell's (light and dark), so the
   landing page and the signed-in app read as one product. No web fonts and no
   inline styles: the pages' Content-Security-Policy allows only this stylesheet,
   same-origin images, theme.js and the one inline script that applies the
   visitor's theme before the first paint. Alphas are baked into tokens rather
   than mixed at use, so a browser without color-mix() keeps the panes.

   The theme: light by default, dark when the system is dark, unless the visitor
   chose one with the switch, which sets data-theme on <html> to light, dark or
   system (theme.js). Without scripts there is no switch and no data-theme, and
   the page follows the system. The two dark blocks hold the same tokens
   (src/site/theme.test.ts). */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --page: #ebe9f9;
  --fg: hsl(228 22% 9%);
  --muted: hsl(222 12% 34%);
  --border: hsl(245 45% 86%);
  --card: #fff;
  --primary: hsl(234 89% 60%);
  --primary-soft: hsl(244 88% 94%);
  --primary-soft-fg: hsl(245 55% 13%);
  --accent-text: hsl(234 89% 60%);
  --g-card: rgba(255, 255, 255, 0.62);
  --g-rim: rgba(255, 255, 255, 0.85);
  --g-rim-far: rgba(201, 162, 255, 0.29);
  --g-sheen: rgba(255, 255, 255, 0.65);
  --g-btn: linear-gradient(100deg, #4b5bf5, #6a3fe8);
  --g-link: #4352dd;
  --g-word-g: #4b5bf5;
  /* Which of each screen’s two pictures the theme shows, the light one or the dark one. */
  --shot-light: block;
  --shot-dark: none;
  --radius: 12px;
  --gutter: 24px;
}

/* The system is dark, and the visitor has not chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #04031a;
    --fg: hsl(220 27% 96%);
    --muted: hsl(234 21% 74%);
    --border: hsl(244 40% 26%);
    --card: hsl(244 58% 14%);
    --primary: hsl(234 89% 68%);
    --primary-soft: hsl(245 48% 20%);
    --primary-soft-fg: hsl(220 27% 96%);
    --accent-text: #bdb5ff;
    --g-card: rgba(18, 15, 56, 0.58);
    --g-rim: rgba(159, 227, 255, 0.43);
    --g-rim-far: rgba(209, 155, 255, 0.16);
    --g-sheen: rgba(255, 255, 255, 0.08);
    --g-link: #bdb5ff;
    --g-word-g: #9fe3ff;
    --shot-light: none;
    --shot-dark: block;
  }
}

/* The visitor chose dark: the same tokens as the block above. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #04031a;
  --fg: hsl(220 27% 96%);
  --muted: hsl(234 21% 74%);
  --border: hsl(244 40% 26%);
  --card: hsl(244 58% 14%);
  --primary: hsl(234 89% 68%);
  --primary-soft: hsl(245 48% 20%);
  --primary-soft-fg: hsl(220 27% 96%);
  --accent-text: #bdb5ff;
  --g-card: rgba(18, 15, 56, 0.58);
  --g-rim: rgba(159, 227, 255, 0.43);
  --g-rim-far: rgba(209, 155, 255, 0.16);
  --g-sheen: rgba(255, 255, 255, 0.08);
  --g-link: #bdb5ff;
  --g-word-g: #9fe3ff;
  --shot-light: none;
  --shot-dark: block;
}

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

html {
  scroll-behavior: smooth;
}

/* A plain page in the theme's colour: nothing behind it moves. */
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.6 var(--font);
  background: var(--page);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--g-link);
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}

h1 {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 750;
}

h2 {
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 720;
}

h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- glass ---------- */

.glass {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--g-sheen) 0%, transparent 40%), var(--g-card);
  -webkit-backdrop-filter: blur(36px) saturate(160%);
  backdrop-filter: blur(36px) saturate(160%);
  box-shadow:
    inset 0 1px 0 var(--g-rim),
    0 0 0 1px var(--g-rim-far),
    0 10px 30px -20px rgba(30, 20, 90, 0.45);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 8px 8px 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--fg);
}

.brand-word {
  height: 26px;
  width: auto;
  aspect-ratio: 475 / 172;
}

.word-g {
  fill: var(--g-word-g);
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-links a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--fg);
  background: var(--primary-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--g-btn);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(75, 91, 245, 0.8);
}

.btn-secondary {
  background: var(--card);
  color: var(--fg);
}

.btn-secondary:hover {
  border-color: var(--primary);
}

.btn-lg {
  min-height: 48px;
  padding: 0 22px;
  font-size: 16px;
}

/* ---------- theme switch ---------- */

/* Light, dark or the system's, as a radio group. It shows once the page's head has read the
   visitor's choice onto <html> (data-theme), which needs scripts: without them the page follows
   the system and offers no switch. The picked one is drawn from data-theme too, so the switch
   shows the theme the page is in from the first paint. */
.theme-switch {
  display: none;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

:root[data-theme] .theme-switch {
  display: inline-flex;
}

.theme-switch label {
  position: relative;
  display: block;
}

/* The radio lies over its picture, so a click, a tap or the arrow keys pick it. */
.theme-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-switch svg {
  display: block;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 8px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switch label:hover svg {
  color: var(--fg);
}

:root[data-theme='light'] .theme-switch input[value='light'] + svg,
:root[data-theme='dark'] .theme-switch input[value='dark'] + svg,
:root[data-theme='system'] .theme-switch input[value='system'] + svg {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1.5px var(--primary);
  color: var(--primary-soft-fg);
}

.theme-switch input:focus-visible + svg {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- type ---------- */

.lead {
  margin: 20px auto 0;
  max-width: 620px;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--muted);
  text-wrap: pretty;
}

.kicker {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* ---------- the home page: the app, screen by screen ---------- */

/* The home page's column, top bar to footer: wide enough that a screen of the app is drawn near
   its own size on a 1440-pixel laptop, and the gutter's width off the edge on anything narrower. */
.wrap.wide {
  max-width: 1320px;
}

.hero {
  padding: 48px 0 0;
  text-align: center;
}

.hero h1 {
  max-width: 980px;
  margin: 0 auto;
}

.hero .lead {
  text-wrap: balance;
}

.hero > .btn {
  margin-top: 28px;
}

/* A screen of the app, taken at twice its size (1440 by 900 at 2x), in a glass frame. */
.screen {
  margin: 0;
  padding: 8px;
}

.hero .screen {
  margin-top: 44px;
}

.screen img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--card);
}

/* Each screen was taken in both themes; the page shows the one taken in its own (the tokens). */
.screen .shot-light {
  display: var(--shot-light);
}

.screen .shot-dark {
  display: var(--shot-dark);
}

.screen figcaption {
  padding: 10px 4px 2px;
  font-size: 13px;
  color: var(--muted);
}

/* One part of the app: what it does in a line, the one action, then its screen. */
.feature {
  padding-top: 112px;
  scroll-margin-top: 72px;
}

.feature:last-child {
  padding-bottom: 48px;
}

.feature-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 48px;
  margin-bottom: 28px;
}

.feature-head h2 {
  max-width: 780px;
  font-size: clamp(28px, 3.4vw, 40px);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

/* The legal links, which scripts/legal-pages.mjs writes, sit in the nav as its own links do. */
.footer-legal {
  display: contents;
}

.footer a:hover,
.footer a[aria-current='page'] {
  color: var(--fg);
}

/* A page under the top bar: the legal pages. */
.page-main {
  padding-top: 48px;
}

/* Legal pages (site/legal/): one readable column in a glass pane. */
.legal {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
}

.legal h1 {
  font-size: clamp(34px, 5vw, 52px);
}

.legal > p:not([class]),
.legal-section p,
.legal-section li {
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}

.legal-updated {
  margin: 12px 0 28px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}

.legal-section h2 {
  margin-bottom: 14px;
  font-size: clamp(22px, 2.4vw, 26px);
}

.legal-section p {
  margin: 0 0 14px;
}

.legal-section ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.legal-section li {
  margin-bottom: 10px;
}

.legal strong {
  color: var(--fg);
}

.legal a {
  color: var(--accent-text);
  text-underline-offset: 3px;
}

.legal code {
  font-family: var(--mono);
  font-size: 0.92em;
}

/* The sub-processor list (site/legal/subprocessors/): a card per vendor, its facts labelled. */
.legal .vendors {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal .vendor {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scroll-margin-top: 80px;
}

.legal .vendor h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.legal .vendor dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px;
  margin: 0;
}

.legal .vendor dt {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--fg);
}

.legal .vendor dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
}

@media (max-width: 640px) {
  .legal .vendor dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .legal .vendor dd + dt {
    margin-top: 8px;
  }
}

/* The cookie notice (site/legal/cookies/): a table per kind of storage, a card per row on a phone. */
.legal .storage {
  width: 100%;
  margin: 0 0 14px;
  border-collapse: collapse;
}

.legal .storage th {
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  color: var(--fg);
}

.legal .storage td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.55;
  vertical-align: top;
  color: var(--muted);
}

.legal .storage td:first-child {
  width: 36%;
  overflow-wrap: anywhere;
  color: var(--fg);
}

@media (max-width: 640px) {
  .legal .storage,
  .legal .storage tbody,
  .legal .storage tr,
  .legal .storage td,
  .legal .storage td:first-child {
    display: block;
    width: auto;
  }

  /* Still read out as the table's headings, but not shown above the cards. */
  .legal .storage thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .legal .storage tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .legal .storage td {
    padding: 2px 0;
    border-bottom: 0;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .hero {
    padding-top: 24px;
  }

  .hero .screen {
    margin-top: 32px;
  }

  .feature {
    padding-top: 72px;
  }

  .feature-head {
    margin-bottom: 20px;
  }

  .screen {
    padding: 4px;
  }

  .screen img {
    border-radius: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}

/* Forced colours drop box-shadows, so give the panes a real edge. */
@media (forced-colors: active) {
  .glass {
    border: 1px solid CanvasText;
  }

  /* The picked theme's background is dropped, so mark it in the system's highlight. */
  :root[data-theme='light'] .theme-switch input[value='light'] + svg,
  :root[data-theme='dark'] .theme-switch input[value='dark'] + svg,
  :root[data-theme='system'] .theme-switch input[value='system'] + svg {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}
