/* =========================================================================
   Forma – designtokens
   Merkevarefargene (--brand-*) overstyres fra innstillingspanelet:
   serveren skriver en style-blokk med :root{--brand-primary:…} i head.
   Alt annet utledes fra disse, så ingen farger er hardkodet i komponentene.
   ========================================================================= */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* --- Merkevare (redigerbar) --- */
  --brand-primary: #2B3035;   /* antrasitt */
  --brand-accent:  #5E8566;   /* dempet grønn */
  --brand-accent-strong: #476B4F; /* grønn for tekst/knapper – AA-kontrast på hvitt */

  /* --- Nøytrale (lys modus) --- */
  --color-bg: #F4F5F6;
  --color-surface: #FFFFFF;
  --color-surface-2: #F0F2F3;
  --color-border: #E1E4E7;
  --color-border-strong: #C9CED3;
  --color-text: #1E2226;
  --color-text-muted: #5B636B;
  --color-text-subtle: #646C75;

  /* --- Semantiske --- */
  --color-primary: var(--brand-primary);
  --color-on-primary: #FFFFFF;
  --color-accent: var(--brand-accent);
  --color-accent-strong: var(--brand-accent-strong);
  --color-on-accent: #FFFFFF;
  --color-accent-soft: color-mix(in srgb, var(--brand-accent) 14%, transparent);
  --color-success: #346641;
  --color-success-soft: #E3F0E6;
  --color-warning: #835B00;
  --color-warning-soft: #FBF0D5;
  --color-danger: #B3412F;
  --color-danger-soft: #F8E3DF;
  --color-info: #2F6690;
  --color-info-soft: #E1ECF5;
  --color-focus: color-mix(in srgb, var(--brand-accent) 55%, #1E2226);

  /* Navigasjon (mørk sidemeny i begge moduser) */
  --nav-bg: var(--brand-primary);
  --nav-text: #C9CED3;
  --nav-text-active: #FFFFFF;
  --nav-active-bg: color-mix(in srgb, #FFFFFF 9%, transparent);

  /* --- Typografi --- */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-num: "Inter", system-ui, sans-serif;
  --fs-xs: .75rem;   /* 12 */
  --fs-sm: .875rem;  /* 14 */
  --fs-md: 1rem;     /* 16 – minste skrift i skjema (hindrer zoom på iPhone) */
  --fs-lg: 1.125rem; /* 18 */
  --fs-xl: 1.375rem; /* 22 */
  --fs-2xl: 1.75rem; /* 28 */
  --fs-3xl: 2.25rem; /* 36 */
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* --- Avstand (4 px-grid) --- */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem; --sp-12: 3rem;

  /* --- Form --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(16 20 24 / .06);
  --shadow-md: 0 2px 8px rgb(16 20 24 / .08), 0 1px 2px rgb(16 20 24 / .05);
  --shadow-lg: 0 12px 32px rgb(16 20 24 / .14);

  /* --- Størrelser --- */
  --touch: 44px;          /* minste berøringsflate */
  --touch-lg: 56px;       /* primærknapper i treningsmodus */
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --bottomnav-h: 64px;
  --content-max: 1280px;

  /* --- Bevegelse --- */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: 120ms;
  --dur: 200ms;

  color-scheme: light;
}

/* ---------- Mørk modus: følger enheten, kan overstyres med data-theme ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #121518;
    --color-surface: #1B1F23;
    --color-surface-2: #23282D;
    --color-border: #2E3439;
    --color-border-strong: #404850;
    --color-text: #EDEFF1;
    --color-text-muted: #A9B1B8;
    --color-text-subtle: #8A939B;
    --color-accent: color-mix(in srgb, var(--brand-accent) 70%, #FFFFFF);
    --color-accent-strong: color-mix(in srgb, var(--brand-accent) 55%, #FFFFFF);
    --color-on-accent: #10140F;
    --color-accent-soft: color-mix(in srgb, var(--brand-accent) 22%, transparent);
    --color-primary: #E8EAEC;
    --color-on-primary: #16191C;
    --color-success: #7DBE8B; --color-success-soft: #1E3024;
    --color-warning: #E0B652; --color-warning-soft: #352B12;
    --color-danger: #EE8A78;  --color-danger-soft: #3A1E1A;
    --color-info: #8EBBE0;    --color-info-soft: #172A3A;
    --nav-bg: #0D1012;
    --shadow-md: 0 2px 8px rgb(0 0 0 / .4);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #121518;
  --color-surface: #1B1F23;
  --color-surface-2: #23282D;
  --color-border: #2E3439;
  --color-border-strong: #404850;
  --color-text: #EDEFF1;
  --color-text-muted: #A9B1B8;
  --color-text-subtle: #8A939B;
  --color-accent: color-mix(in srgb, var(--brand-accent) 70%, #FFFFFF);
  --color-accent-strong: color-mix(in srgb, var(--brand-accent) 55%, #FFFFFF);
  --color-on-accent: #10140F;
  --color-accent-soft: color-mix(in srgb, var(--brand-accent) 22%, transparent);
  --color-primary: #E8EAEC;
  --color-on-primary: #16191C;
  --color-success: #7DBE8B; --color-success-soft: #1E3024;
  --color-warning: #E0B652; --color-warning-soft: #352B12;
  --color-danger: #EE8A78;  --color-danger-soft: #3A1E1A;
  --color-info: #8EBBE0;    --color-info-soft: #172A3A;
  --nav-bg: #0D1012;
  --shadow-md: 0 2px 8px rgb(0 0 0 / .4);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / .5);
}
