/* ============================================================
   Nordic App Studio — Design System
   "Nordic editorial minimalism": calm, precise, trustworthy.
   Off-white canvas, anthracite ink, deep fjord-teal accent.
   Light + dark mode. Inter at refined medium weights (no faux-bold).
   Shared across every page; page-specific bits stay inline.
   ============================================================ */

/* ---- TOKENS — light (default) -------------------------------- */
:root {
  /* Surfaces */
  --bg:        #FAFAF8;   /* warm off-white paper */
  --bg-2:      #F1F1EC;   /* alternating section */
  --surface:   #FFFFFF;   /* cards */
  --surface-2: #F6F6F2;

  /* Ink */
  --ink:    #15171C;      /* anthracite, ~16:1 on --bg */
  --ink-2:  #40444C;      /* secondary text */
  --ink-3:  #686D76;      /* muted, AA on --bg */
  --ink-4:  #9CA1A9;      /* faint, decorative/large only */

  /* Lines */
  --line:   rgba(21,23,28,0.10);
  --line-2: rgba(21,23,28,0.16);

  /* Studio accent — fjord teal */
  --accent:        #1C6E68;   /* text/line safe on --bg */
  --accent-strong: #165853;   /* button fills (white text passes AA) */
  --accent-soft:   rgba(28,110,104,0.10);
  --accent-ink:    #FFFFFF;    /* text on accent fills */

  /* Per-app accent — overridden on app pages. Defaults to studio teal. */
  --app:        var(--accent);
  --app-strong: var(--accent-strong);
  --app-soft:   var(--accent-soft);
  --app-ink:    var(--accent-ink);

  /* Focus */
  --focus: #1C6E68;

  /* Type */
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --w-body: 400;
  --w-med:  500;        /* heading weight — caps at the font's real top weight */

  /* Fluid type scale */
  --fs-eyebrow: 0.75rem;
  --fs-small:   0.8125rem;
  --fs-body:    clamp(1rem, 0.97rem + 0.16vw, 1.0625rem);
  --fs-lead:    clamp(1.125rem, 1.04rem + 0.42vw, 1.375rem);
  --fs-h3:      clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --fs-h2:      clamp(1.7rem, 1.36rem + 1.5vw, 2.5rem);
  --fs-h1:      clamp(2.35rem, 1.7rem + 2.9vw, 3.9rem);
  --fs-display: clamp(2.9rem, 1.9rem + 4.6vw, 5.25rem);

  /* Space + layout */
  --wrap:        1080px;
  --wrap-narrow: 720px;
  --gutter:      clamp(20px, 5vw, 48px);
  --section-y:   clamp(72px, 9vw, 144px);

  /* Radii */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(21,23,28,0.04);
  --shadow-md: 0 1px 2px rgba(21,23,28,0.04), 0 10px 28px -14px rgba(21,23,28,0.14);
  --shadow-lg: 0 2px 4px rgba(21,23,28,0.05), 0 24px 56px -20px rgba(21,23,28,0.20);

  /* Motion */
  --ease:   cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --t:      0.45s;

  color-scheme: light dark;
}

/* ---- TOKENS — dark ------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0E1014;
    --bg-2:      #14171D;
    --surface:   #171A21;
    --surface-2: #1D212A;

    --ink:    #ECEEF1;
    --ink-2:  #B6BBC3;
    --ink-3:  #898F99;
    --ink-4:  #585E68;

    --line:   rgba(236,238,241,0.12);
    --line-2: rgba(236,238,241,0.20);

    --accent:        #5FBDB3;
    --accent-strong: #74C8BF;
    --accent-soft:   rgba(95,189,179,0.14);
    --accent-ink:    #07110F;

    --focus: #74C8BF;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 1px 2px rgba(0,0,0,0.4), 0 12px 30px -14px rgba(0,0,0,0.6);
    --shadow-lg: 0 2px 6px rgba(0,0,0,0.5), 0 28px 60px -20px rgba(0,0,0,0.7);
  }
}

/* ---- RESET / BASE -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  font-family: var(--sans);
  font-weight: var(--w-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
img { border-radius: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

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

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r-sm);
  font-size: var(--fs-small); font-weight: var(--w-med);
  z-index: 1000; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---- TYPOGRAPHY ---------------------------------------------- */
h1, h2, h3, h4 {
  font-weight: var(--w-med);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.02em; }

p { text-wrap: pretty; }

.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: var(--w-med);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--app);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--ink-2);
}

.muted { color: var(--ink-3); }
.small { font-size: var(--fs-small); }

.serif { font-family: var(--serif); font-weight: 400; }

/* "answer-first" intro paragraph used on every key page */
.answer {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 62ch;
}
.answer strong { font-weight: var(--w-med); color: var(--ink); }

/* ---- LAYOUT -------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: var(--wrap-narrow); }

.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-2); }
.section--tight { padding-block: clamp(48px, 6vw, 88px); }

.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }

.section-head { max-width: 60ch; margin-bottom: clamp(40px, 5vw, 64px); }
.section-head .eyebrow { display: block; margin-bottom: 14px; }
.section-head h2 + p { margin-top: 16px; color: var(--ink-3); font-size: var(--fs-lead); line-height: 1.5; }
.section-head--center { margin-inline: auto; text-align: center; }

/* ---- NAV ----------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: var(--w-med); font-size: 0.95rem; letter-spacing: -0.01em;
  color: var(--ink);
}
.nav__brand:hover { text-decoration: none; }
.nav__mark { width: 22px; height: 22px; border-radius: 6px; }
.nav__links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.nav__links a {
  font-size: 0.875rem; color: var(--ink-3); font-weight: var(--w-body);
  transition: color 0.25s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); text-decoration: none; }
.nav__links a.is-active { color: var(--app); }
@media (max-width: 620px) {
  .nav__links { gap: 16px; }
  .nav__links a.nav-hide-sm { display: none; }
}

/* ---- BUTTONS ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 0.9375rem; font-weight: var(--w-med);
  line-height: 1; padding: 13px 22px; border-radius: var(--r-pill);
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--app-strong); color: var(--app-ink); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--app); color: var(--app); }
.btn__arrow { transition: transform 0.3s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* link with moving arrow */
.arrow-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: var(--w-med); font-size: 0.9375rem; color: var(--app);
}
.arrow-link:hover { text-decoration: none; }
.arrow-link span { transition: transform 0.3s var(--ease); }
.arrow-link:hover span { transform: translateX(4px); }

/* ---- APP STORE BADGE (official lockup, inline SVG) ----------- */
.appstore-badge { display: inline-block; line-height: 0; transition: transform 0.2s var(--ease), opacity 0.2s var(--ease); }
.appstore-badge:hover { transform: translateY(-2px); text-decoration: none; opacity: 0.92; }
.appstore-badge svg { height: 52px; width: auto; border-radius: 9px; }
.appstore-badge:focus-visible { outline-offset: 4px; }

/* ---- PLATFORM / META BADGES ---------------------------------- */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: var(--w-med); letter-spacing: 0.01em;
  color: var(--ink-2);
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface);
}
.badge--accent { color: var(--app); border-color: color-mix(in srgb, var(--app) 36%, transparent); background: var(--app-soft); }
.badge--solid { color: var(--app-ink); background: var(--app-strong); border-color: transparent; }

/* ---- CARDS --------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(24px, 3vw, 34px);
  box-shadow: var(--shadow-sm);
}

.app-grid {
  display: grid; gap: clamp(16px, 2vw, 22px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.app-card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); color: inherit;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 32px);
  overflow: hidden; isolation: isolate;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.app-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--app); transform: scaleX(0); transform-origin: left;
  transition: transform var(--t) var(--ease);
}
.app-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); text-decoration: none; }
.app-card:hover::before { transform: scaleX(1); }
.app-card__top { display: flex; align-items: center; gap: 16px; }
.app-card__icon { width: 60px; height: 60px; border-radius: 14px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.app-card__name { font-size: 1.3rem; font-weight: var(--w-med); letter-spacing: -0.02em; color: var(--ink); }
.app-card__name a { color: inherit; text-decoration: none; transition: color 0.25s var(--ease); }
.app-card:hover .app-card__name a { color: var(--app); }
.app-card__cat { font-size: var(--fs-small); color: var(--ink-3); margin-top: 2px; }
.app-card__desc { color: var(--ink-2); line-height: 1.55; }
.app-card .badges { margin-top: 2px; }
.app-card__cta { margin-top: auto; padding-top: 6px; }

/* ---- FEATURE LIST -------------------------------------------- */
.features { display: grid; gap: clamp(18px, 2.4vw, 28px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.feature { display: flex; gap: 14px; }
.feature__mark {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--app-soft); color: var(--app);
}
.feature__mark svg { width: 16px; height: 16px; }
.feature h3 { font-size: 1.0625rem; margin-bottom: 4px; }
.feature p { color: var(--ink-3); font-size: 0.9375rem; line-height: 1.55; }

/* ---- COMPARISON TABLE ---------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 0.9375rem; min-width: 520px; }
table.cmp caption { text-align: left; color: var(--ink-3); font-size: var(--fs-small); padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.cmp th, table.cmp td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cmp thead th { font-weight: var(--w-med); color: var(--ink); background: var(--surface-2); position: sticky; top: 0; }
table.cmp tbody th { font-weight: var(--w-body); color: var(--ink-2); }
table.cmp tbody tr:last-child th, table.cmp tbody tr:last-child td { border-bottom: 0; }
table.cmp td.yes { color: var(--accent); font-weight: var(--w-med); }
table.cmp .col-own { background: var(--app-soft); }
table.cmp tbody tr:hover td, table.cmp tbody tr:hover th { background: color-mix(in srgb, var(--ink) 3%, transparent); }
table.cmp .col-own:hover { background: var(--app-soft); }

/* ---- FAQ ----------------------------------------------------- */
.faq { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 4px; cursor: pointer; list-style: none;
  font-size: var(--fs-h3); font-weight: var(--w-med); color: var(--ink);
  letter-spacing: -0.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex-shrink: 0; width: 11px; height: 11px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform 0.3s var(--ease); margin-top: -4px;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: 2px; }
.faq summary:hover { color: var(--app); }
.faq__a { padding: 0 4px 24px; color: var(--ink-2); line-height: 1.6; max-width: 68ch; }
.faq__a > * + * { margin-top: 0.75rem; }

/* ---- FOOTER -------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding-block: clamp(40px, 5vw, 64px); background: var(--bg-2); }
.site-footer .wrap { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .site-footer .wrap { grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; } }
.site-footer h4 { font-size: var(--fs-small); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); font-weight: var(--w-med); margin-bottom: 14px; }
.site-footer a { color: var(--ink-2); font-size: 0.9375rem; }
.site-footer a:hover { color: var(--ink); }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-brand__name { font-weight: var(--w-med); color: var(--ink); font-size: 1.05rem; }
.footer-brand p { color: var(--ink-3); font-size: 0.9375rem; margin-top: 8px; max-width: 36ch; }
.footer-legal { margin-top: 18px; color: var(--ink-4); font-size: var(--fs-small); }

/* ---- PROSE (legal / guides body) ----------------------------- */
.prose { max-width: 70ch; color: var(--ink-2); }
.prose > * + * { margin-top: 1.05rem; }
.prose h2 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem); margin-top: 2.4rem; }
.prose h3 { font-size: var(--fs-h3); margin-top: 1.8rem; color: var(--ink); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p, .prose li { line-height: 1.7; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45rem; }
.prose strong { color: var(--ink); font-weight: var(--w-med); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2rem; }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

/* ---- SCROLL REVEAL ------------------------------------------- */
/* No-JS safe: reveal content is fully visible by default. Animation is opt-in,
   gated on .js-anim (added to <html> by the page script). With JS off, nothing
   is ever hidden. */
.r { opacity: 1; transform: none; }
.js-anim .r { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js-anim .r.v { opacity: 1; transform: none; }

/* ---- UPDATED STAMP ------------------------------------------- */
.updated { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-small); color: var(--ink-3); }
.updated::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---- BREADCRUMB ---------------------------------------------- */
.crumbs { font-size: var(--fs-small); color: var(--ink-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--app); }
.crumbs span[aria-current] { color: var(--ink-2); }

/* ---- UTILITIES ----------------------------------------------- */
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
.divider { height: 1px; background: var(--line); border: 0; }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-atmos {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.hero-atmos::before {
  content: ""; position: absolute; top: -30%; left: 50%; width: 120vw; height: 80vh;
  transform: translateX(-50%);
  background: radial-gradient(60% 60% at 50% 0%, var(--app-soft) 0%, transparent 70%);
  opacity: 0.9;
}

/* ---- STRETCHED LINK (whole-card clickable, one target) ------- */
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* ---- PER-APP ACCENT PALETTES (set data-app on body or card) --- */
[data-app="foc"]     { --app: #3E7A3E; --app-strong: #356A35; --app-soft: rgba(107,154,107,0.14); --app-ink: #fff; }
[data-app="klug"]    { --app: #B0552F; --app-strong: #9A4A29; --app-soft: rgba(212,120,90,0.15);  --app-ink: #fff; }
[data-app="sunholm"] { --app: #11796F; --app-strong: #0E6B64; --app-soft: rgba(78,205,196,0.16);  --app-ink: #fff; }
[data-app="editme"]  { --app: #4E648C; --app-strong: #445877; --app-soft: rgba(122,139,174,0.16); --app-ink: #fff; }
[data-app="carol"]    { --app: #35558F; --app-strong: #2C4879; --app-soft: rgba(95,135,176,0.15);  --app-ink: #fff; }
@media (prefers-color-scheme: dark) {
  [data-app="foc"]     { --app: #8FC98F; --app-strong: #A6D6A6; --app-soft: rgba(143,201,143,0.16); --app-ink: #08110A; }
  [data-app="klug"]    { --app: #E8A084; --app-strong: #EFAF95; --app-soft: rgba(232,160,132,0.16); --app-ink: #1C0F08; }
  [data-app="sunholm"] { --app: #6FD8CF; --app-strong: #86E0D8; --app-soft: rgba(111,216,207,0.16); --app-ink: #06120F; }
  [data-app="editme"]  { --app: #9DB0D6; --app-strong: #B2C2E0; --app-soft: rgba(157,176,214,0.18); --app-ink: #0A0F1A; }
  [data-app="carol"]    { --app: #93AEDC; --app-strong: #A8BFE4; --app-soft: rgba(147,174,220,0.16); --app-ink: #0A0F1A; }
}

/* ---- REDUCED MOTION ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js-anim .r { opacity: 1; transform: none; }
}
