/* ReSurge Academy tokens. Single source for colour, type, space, radius, shadow, motion, layers. */
:root {
  color-scheme: light;

  /* fields */
  --bg:            #FAF6EF;
  --bg-tint:       #F5EEE3;
  --bg-tint-2:     #EDE2D1;
  --surface:       #FFFDF8;
  --surface-raised:#FFFFFF;
  --scrim:         rgba(28, 20, 12, 0.55);

  /* text */
  --ink:           #1B1A17;
  --ink-2:         #4A443B;
  --ink-3:         #675F54;

  /* lines */
  --line:          #E4D8C6;
  --line-strong:   #958A79;

  /* brand */
  --brand:         #C93831;
  --brand-hover:   #A82C26;
  --brand-active:  #8E241F;
  --brand-ink:     #A82C26;
  --on-brand:      #FFFFFF;
  --accent:        #DD463F;
  --on-accent:     #1B1A17;
  --brand-gradient: linear-gradient(135deg, #C93831 0%, #DD463F 100%);

  /* the navy field */
  --deep:          #1F1B17;
  --on-deep:       #FFFFFF;
  --on-deep-2:     #D9CFC1;
  --deep-accent:   #F08A7E;
  --deep-line:     rgba(255, 255, 255, 0.18);

  /* status */
  --ok:            #0B7A47;   --ok-tint:     #E6F5EC;
  --warn:          #8A5200;   --warn-tint:   #FFF3DC;
  --danger:        #B4261D;   --danger-tint: #FDECEA;
  --on-danger:     #FFFFFF;

  /* strands and chart marks */
  --strand-off:    #958A79;
  --strand-on:     #C93831;
  --strand-locked: #E4D8C6;
  --mark-fill:     #C93831;
  --mark-soft:     #EDE2D1;
  --mark-empty:    #E4D8C6;

  /* browser surfaces */
  --focus:         #C93831;
  --selection-bg:  #F5D3CE;
  --selection-ink: #1B1A17;
  --stage:         #0F0D0B;

  /* type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-17: 1.0625rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-30: 1.875rem;
  --fs-40: 2.5rem;
  --fs-56: 3.5rem;
  --fs-72: 4.5rem;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  --lh-display: 1.04;
  --lh-heading: 1.18;
  --lh-ui:      1.45;
  --lh-prose:   1.65;

  --tr-display: -0.03em;
  --tr-h1:      -0.022em;
  --tr-h2:      -0.016em;
  --tr-h3:      -0.01em;
  --tr-body:    0;
  --tr-label:   0.04em;

  --measure: 68ch;

  /* 4px grid */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5: 1.25rem;  --sp-6: 1.5rem;   --sp-8: 2rem;     --sp-10: 2.5rem;
  --sp-12: 3rem;    --sp-16: 4rem;    --sp-20: 5rem;    --sp-24: 6rem;

  --tap: 2.75rem;
  --rail-w: 14.5rem;
  --topbar-h: 3.5rem;
  --tabbar-h: 3.75rem;
  --page-max: 70rem;
  --margin-col: 18.75rem;

  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 12px;
  --r-5: 16px;
  --r-round: 50%;

  --sh-1: 0 1px 2px rgba(45, 30, 18, 0.06), 0 1px 1px rgba(45, 30, 18, 0.04);
  --sh-2: 0 4px 12px -2px rgba(45, 30, 18, 0.10), 0 2px 4px rgba(45, 30, 18, 0.06);
  --sh-3: 0 18px 44px -10px rgba(45, 30, 18, 0.24), 0 4px 12px rgba(45, 30, 18, 0.08);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);

  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 600ms;
  --dur-5: 900ms;
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --z-rail: 20; --z-bar: 30; --z-action: 35; --z-pop: 50; --z-sheet: 60; --z-dialog: 70; --z-toast: 80;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #14110E;
  --bg-tint:       #1A1713;
  --bg-tint-2:     #28221C;
  --surface:       #1C1915;
  --surface-raised:#24201A;
  --scrim:         rgba(8, 6, 4, 0.7);

  --ink:           #F3EDE4;
  --ink-2:         #D2C8BA;
  --ink-3:         #A89E90;

  --line:          #342D25;
  --line-strong:   #7F7466;

  --brand:         #F0705F;
  --brand-hover:   #F48A7C;
  --brand-active:  #E25A49;
  --brand-ink:     #F48A7C;
  --on-brand:      #1A0B09;
  --accent:        #DD463F;
  --on-accent:     #1A0B09;
  --brand-gradient: linear-gradient(135deg, #C93831 0%, #DD463F 100%);

  --deep:          #0C0A08;
  --on-deep:       #FFFFFF;
  --on-deep-2:     #D9CFC1;
  --deep-accent:   #F08A7E;
  --deep-line:     rgba(255, 255, 255, 0.14);

  --ok:            #4CC38A;   --ok-tint:     #0E2A20;
  --warn:          #F2B84B;   --warn-tint:   #2B2110;
  --danger:        #FF8A80;   --danger-tint: #301614;
  --on-danger:     #1A0504;

  --strand-off:    #7F7466;
  --strand-on:     #F0705F;
  --strand-locked: #342D25;
  --mark-fill:     #F0705F;
  --mark-soft:     #28221C;
  --mark-empty:    #342D25;

  --focus:         #F48A7C;
  --selection-bg:  #5A231E;
  --selection-ink: #FFFFFF;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --sh-2: 0 6px 16px -4px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
  --sh-3: 0 22px 48px -12px rgba(0, 0, 0, 0.75), 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* System preference when the learner has not chosen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            #14110E;
    --bg-tint:       #1A1713;
    --bg-tint-2:     #28221C;
    --surface:       #1C1915;
    --surface-raised:#24201A;
    --scrim:         rgba(8, 6, 4, 0.7);

    --ink:           #F3EDE4;
    --ink-2:         #D2C8BA;
    --ink-3:         #A89E90;

    --line:          #342D25;
    --line-strong:   #7F7466;

    --brand:         #F0705F;
    --brand-hover:   #F48A7C;
    --brand-active:  #E25A49;
    --brand-ink:     #F48A7C;
    --on-brand:      #1A0B09;
    --accent:        #DD463F;
    --on-accent:     #1A0B09;
    --brand-gradient: linear-gradient(135deg, #C93831 0%, #DD463F 100%);

    --deep:          #0C0A08;
    --on-deep:       #FFFFFF;
    --on-deep-2:     #D9CFC1;
    --deep-accent:   #F08A7E;
    --deep-line:     rgba(255, 255, 255, 0.14);

    --ok:            #4CC38A;   --ok-tint:     #0E2A20;
    --warn:          #F2B84B;   --warn-tint:   #2B2110;
    --danger:        #FF8A80;   --danger-tint: #301614;
    --on-danger:     #1A0504;

    --strand-off:    #7F7466;
    --strand-on:     #F0705F;
    --strand-locked: #342D25;
    --mark-fill:     #F0705F;
    --mark-soft:     #28221C;
    --mark-empty:    #342D25;

    --focus:         #F48A7C;
    --selection-bg:  #5A231E;
    --selection-ink: #FFFFFF;

    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --sh-2: 0 6px 16px -4px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
    --sh-3: 0 22px 48px -12px rgba(0, 0, 0, 0.75), 0 4px 12px rgba(0, 0, 0, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; --dur-4: 1ms; --dur-5: 1ms; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}
