/*
 * Klinq – the public site. One stylesheet, no JavaScript, no build step.
 *
 * The values below are the app's tokens (apps/mobile/src/theme/tokens.ts, DESIGN_BRIEF §8),
 * copied by hand because a static site cannot import TypeScript. They are the only hex values
 * in this folder: every rule below reads a variable, so the site and the app can only drift in
 * one place. If a token changes in the app, change it here too.
 *
 * DESIGN_BRIEF §4: the signal gradient appears on exactly one element per page – the wordmark.
 * Nothing else on this site carries a gradient.
 */

:root {
  /* Light – Indigo (default) */
  --surface: #f7f4fc;
  --surface-raised: #ffffff;
  --surface-sunken: #f0eafa;
  --accent: #5b3fa8;
  --accent-deep: #442e80;
  --accent-soft: #ede6ff;
  --text-primary: #2a1a50;
  --text-secondary: #6f5fa0;
  --text-tertiary: #8e80b8;
  --border: #e3daf7;
  --card-shadow: 0 4px 16px rgba(42, 26, 80, 0.08);

  /* The one gradient (§6.0): identical in both modes. 95° is the wordmark's angle (§10). */
  --signal-gradient: linear-gradient(95deg, #f5a623 0%, #f0563f 50%, #ee3d6b 100%);

  /* Spacing and radii from the brief (4 8 12 16 24 32 48; 12 20 28, pill). */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;
  --sp-xxxl: 48px;
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;

  --measure: 34rem;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark – Indigo */
    --surface: #211546;
    --surface-raised: #2a1a50;
    --surface-sunken: #180c3a;
    --accent: #b9a0f0;
    --accent-deep: #9b7be0;
    --accent-soft: rgba(185, 160, 240, 0.14);
    --text-primary: #ffffff;
    --text-secondary: #b7a8e0;
    --text-tertiary: #9f8fc9;
    --border: rgba(255, 255, 255, 0.12);
    /* No shadow in dark mode (§6.1): depth is a light-mode device. */
    --card-shadow: none;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font);
  /* Body is 17/400 in the app; 1.0625rem is the same size but still scales with the browser. */
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
}

/* ---------------------------------------------------------------------------
 * The wordmark. A pure word in the warm gradient (§10), weight 600, tight.
 * The colour is set first so a browser without background-clip still shows a word.
 * ------------------------------------------------------------------------- */
.wordmark {
  display: inline-block;
  font-weight: 600;
  letter-spacing: -1px;
  color: var(--text-primary);
  text-decoration: none;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .wordmark {
    background-image: var(--signal-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.wordmark--small {
  font-size: 1.5rem;
}

.wordmark--hero {
  font-size: clamp(3rem, 14vw, 4.5rem);
  line-height: 1.05;
}

/* ---------------------------------------------------------------------------
 * Frame
 * ------------------------------------------------------------------------- */
.site-header,
.site-main,
.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-md);
  padding-top: var(--sp-xl);
  padding-bottom: var(--sp-xl);
}

/* The landing page carries the wordmark as its hero, so its header holds only the switch. */
.site-header--hero {
  justify-content: flex-end;
  padding-bottom: 0;
}

.site-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-lg);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current='page'] {
  color: var(--accent);
}

.site-main {
  padding-bottom: var(--sp-xxxl);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-xl);
  padding-bottom: var(--sp-xxxl);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.site-footer p {
  margin: 0 0 var(--sp-xs);
}

.site-footer a {
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
 * Type
 * ------------------------------------------------------------------------- */
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.5px;
  font-weight: 600;
  margin: 0 0 var(--sp-md);
}

/* The app's h2 is 17/600. On a page this wide that does not separate a section from the
 * sub-headings under it, so section headings get one step more size and more air above. */
h2 {
  font-size: 1.1875rem;
  line-height: 1.3;
  font-weight: 600;
  margin: var(--sp-xxxl) 0 var(--sp-sm);
}

h3 {
  font-size: 1.0625rem;
  font-weight: 500;
  margin: var(--sp-xl) 0 var(--sp-xs);
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--sp-md);
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin-bottom: var(--sp-xs);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus-visible {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--sp-xs);
}

strong {
  font-weight: 600;
}

.lede {
  font-size: 1.1875rem;
  color: var(--text-secondary);
}

.meta {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  margin-bottom: var(--sp-xl);
}

/* ---------------------------------------------------------------------------
 * Language
 *
 * Both languages are in every page. English is what a reader gets unless they have chosen
 * Swedish here before — never the browser's guess. The script on each page sets `data-lang` on
 * <html> before the first paint, and these two rules do the rest.
 *
 * With JavaScript off there is no `data-lang`, so nothing is hidden: the page simply shows
 * English and then Swedish, one after the other, and the switch stays out of the way.
 * ------------------------------------------------------------------------- */
[data-lang='en'] .lang-sv,
[data-lang='sv'] .lang-en {
  display: none;
}

.lang-switch {
  display: none;
  align-items: baseline;
  gap: var(--sp-xs);
  font-size: 0.8125rem;
}

[data-lang] .lang-switch {
  display: flex;
}

.lang-sep {
  color: var(--border);
}

.lang-btn {
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: none;
  border: 0;
  border-radius: var(--sp-xs);
  padding: var(--sp-xs) var(--sp-sm);
  margin: 0;
  color: var(--text-tertiary);
  cursor: pointer;
}

.lang-btn:hover {
  color: var(--accent);
}

.lang-btn[aria-pressed='true'] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------------------------------------------------------------------------
 * Blocks
 * ------------------------------------------------------------------------- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--card-shadow);
  padding: var(--sp-lg) var(--sp-lg) var(--sp-sm);
  margin: 0 0 var(--sp-lg);
}

.note {
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding: var(--sp-md) var(--sp-lg);
  margin: 0 0 var(--sp-lg);
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.note p:last-child,
.card p:last-child {
  margin-bottom: var(--sp-sm);
}

/* A heading that opens a card brings its section margin with it; inside the card it is padding. */
.card > :first-child,
.note > :first-child {
  margin-top: 0;
}

/* The App Store badge is Apple's artwork and is added at launch from their marketing tools
 * (CLAUDE.md rule 9 – nothing of anyone else's is reproduced here). Until then: a frame. */
.badge-placeholder {
  display: inline-block;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-md) var(--sp-xl);
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
  margin: var(--sp-xl) 0 0;
  padding: 0;
  list-style: none;
}

.link-row li {
  margin: 0;
}

/* Retention and processor tables: two columns, plain, allowed to scroll if a phone is narrow. */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--sp-lg);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--sp-sm) var(--sp-md) var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------------
 * The landing page only
 * ------------------------------------------------------------------------- */
.hero {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(var(--sp-xxl), 12vh, 7rem) var(--sp-lg) var(--sp-xxl);
  text-align: center;
}

.hero p {
  margin-left: auto;
  margin-right: auto;
  max-width: 28rem;
}

.hero .lede {
  margin-top: var(--sp-lg);
}

.hero .link-row {
  justify-content: center;
}

.hero .badge-placeholder {
  margin-top: var(--sp-xl);
  line-height: 1.5;
}

/* The landing page has no header bar, so its footer follows the centred column. */
.site-footer--center {
  text-align: center;
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .site-nav,
  .lang-switch {
    display: none;
  }

  /* On paper, print the language that is on screen and leave the other out. */
  [data-lang='en'] .lang-sv,
  [data-lang='sv'] .lang-en {
    display: none;
  }
}
