/* ==========================================================================
   Alterity.pl (Microsoft 365) — design tokens
   Light is default. Dark is opt-in via [data-theme="dark"] on <html>.
   Shadcn-aligned variable names + legacy aliases for backward compatibility.

   BRAND ADAPTATION — "Palette Option B" (same family, Microsoft context):
     • Base navy comes from the actual Alterity logo/brochure: #0C0D47.
     • The teal `\` slash stays the family signature (decorative --accent).
     • The INTERACTIVE colour (buttons, links, focus) shifts from the
       cyberalterity dark-teal to a Microsoft-adjacent azure (#1466B8),
       so the site reads "Microsoft ecosystem" while remaining unmistakably
       part of the Alterity family it shares with cyberalterity.pl.
   Every interactive colour below was re-measured for WCAG AA (≥4.5:1 text).
   ========================================================================== */

/* ---------- Self-hosted Manrope (variable font, weights 200–800) ---------- */

@font-face {
  font-family: "Manrope";
  font-style:  normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Manrope";
  font-style:  normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope/manrope-latin.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* =================================================================
     LIGHT MODE (default)
     White-base, navy text, teal slash accent, azure interactive.
     ================================================================= */

  /* Surfaces */
  --background:    #FFFFFF;          /* page canvas */
  --card:          #FFFFFF;          /* cards (drop shadow elevates from muted) */
  --muted:         #F5F8FC;          /* section backgrounds, large surfaces (very light azure-grey) */
  --secondary:     #EFF6FB;          /* azure-tinted surface for accent regions */
  --popover:       #FFFFFF;

  /* Text on each surface */
  --foreground:           #1A2D5C;   /* navy — primary body text; AA huge on white (12.9:1) */
  --card-foreground:      #1A2D5C;
  --muted-foreground:     #5A6678;   /* mid-slate — captions; AA on white (5.83) + on --muted (5.6) */
  --secondary-foreground: #1A2D5C;
  --popover-foreground:   #1A2D5C;

  /* Interactive — Microsoft-adjacent azure (AA on white: 5.8:1) */
  --primary:              #1466B8;   /* azure — buttons, links, focused state */
  --primary-foreground:   #FFFFFF;
  --primary-hover:        #10559C;
  --primary-active:       #0C4680;
  --primary-soft:         rgba(20, 102, 184, 0.10);

  /* Accent (decorative — brand teal as-is, the `\` slash colour; non-text) */
  --accent:               #1FB6C1;   /* brand teal — family signature */
  --accent-foreground:    #06373B;

  /* Status */
  --destructive:          #E25555;
  --destructive-foreground: #FFFFFF;
  --warning:              #8B4F0F;   /* deep amber — AA on white (6.6), --muted, --secondary */
  --success:              #1E8A5F;

  /* Borders + form inputs */
  --border:               #E4EAF2;   /* subtle separators (decorative — no WCAG floor) */
  --input:                #CFD8E3;   /* legacy form-border alias; retained for decorative use */
  --border-input:         #7E8FA2;   /* form-input border. slate-blue, navy-family.
                                        WCAG 1.4.11 (UI components) — measured:
                                          vs --background (#FFFFFF)          3.31 : 1  ✅
                                          vs --secondary  (#EFF6FB)          3.14 : 1  ✅
                                        3:1 is the floor; re-verify if --secondary darkens. */
  --ring:                 #1466B8;   /* focus ring — azure interactive (5.8:1 on white, ≥3:1 floor) */

  /* Brand identity (raw, unmodulated values) */
  --brand-navy:           #0C0D47;   /* logo/brochure navy — deep indigo (Option B base) */
  --brand-azure:          #1466B8;   /* Microsoft-adjacent interactive azure */
  --brand-teal:           #1FB6C1;   /* the `\` motif decoration */
  --brand-mint:           #5EEAD4;   /* gradient terminal stop */

  /* ---------- Typography ---------- */
  /* Manrope is self-hosted and used for BOTH display and body (closes the
     reference's Inter-not-bundled gap). Inter kept as an optional future
     body face; system-ui is the final fallback. */
  --font-display: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --text-xs:      0.75rem;
  --text-sm:      0.875rem;
  --text-base:    1rem;
  --text-lg:      1.125rem;
  --text-xl:      1.25rem;
  --text-2xl:     1.5rem;
  --text-3xl:     clamp(1.75rem, 3.5vw, 2.125rem);
  --text-4xl:     clamp(2.125rem, 4.5vw, 2.75rem);
  --text-5xl:     clamp(2.5rem, 5.5vw, 3.5rem);
  --text-display: clamp(2.75rem, 6.5vw, 4.5rem);

  /* ---------- Spacing scale ---------- */
  --space-1: 0.25rem;  --space-2:  0.5rem;   --space-3:  0.75rem;
  --space-4: 1rem;     --space-5:  1.25rem;  --space-6:  1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem;   --space-12: 3rem;
  --space-16: 4rem;    --space-20: 5rem;     --space-24: 6rem;
  --space-32: 8rem;

  /* ---------- Layout ---------- */
  --container-max:    1280px;
  --container-text:   720px;
  --container-narrow: 960px;

  /* ---------- Header ---------- */
  --header-h: 73px;

  /* ---------- Home hero responsive sizing ---------- */
  --hero-pad-min:         1.5rem;
  --hero-pad-fluid:       8vh;
  --hero-pad-max:         8rem;
  --hero-min-vh:          100dvh;
  --hero-failsafe-pad-min:   0.75rem;
  --hero-failsafe-pad-fluid: 3vh;
  --hero-failsafe-pad-max:   1.5rem;

  /* ---------- Section padding (3 named emphasis tiers) ---------- */
  --section-pad-compact:   clamp(var(--space-12), 8vw,  var(--space-20));
  --section-pad-standard:  clamp(var(--space-16), 10vw, var(--space-24));
  --section-pad-featured:  clamp(var(--space-20), 12vw, var(--space-32));

  /* ---------- Radius (Shadcn convention) ---------- */
  --radius-sm:  0.25rem;
  --radius-md:  0.5rem;
  --radius:     0.75rem;       /* base radius */
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-2xl: 1.5rem;

  /* ---------- Shadow (light-mode tuned, navy-tinted) ---------- */
  --shadow-soft:     0 1px 2px rgba(12, 13, 71, 0.06), 0 4px 12px rgba(12, 13, 71, 0.06);
  --shadow-elevated: 0 4px 12px rgba(12, 13, 71, 0.10), 0 12px 32px rgba(12, 13, 71, 0.10);
  --shadow-accent:   0 0 0 1px rgba(20, 102, 184, 0.20), 0 8px 24px rgba(20, 102, 184, 0.18);

  /* ---------- Motion ---------- */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:  150ms;
  --dur:       250ms;
  --dur-slow:  400ms;

  /* ---------- Z-index ---------- */
  --z-base:     0;
  --z-elevated: 10;
  --z-sticky:   100;
  --z-modal:    1000;
  --z-toast:    2000;

  /* ==========================================================
     LEGACY ALIASES — old names map onto the canonical vocabulary.
     ========================================================== */
  --bg-primary:     var(--background);
  --bg-elevated:    var(--muted);
  --bg-card:        var(--card);
  --bg-inset:       var(--secondary);
  --text-primary:   var(--foreground);
  --text-secondary: #3B475E;
  --text-muted:     var(--muted-foreground);
  --text-inverse:   var(--primary-foreground);
  --accent-hover:   var(--primary-hover);
  --accent-pressed: var(--primary-active);
  --accent-soft:    var(--primary-soft);
  --accent-on:      var(--primary-foreground);
  --border-subtle:  var(--border);
  --border-default: var(--input);
  --border-strong:  var(--foreground);
  --error:          var(--destructive);
}

/* =================================================================
   DARK MODE (toggle — opt-in)
   Navy-based dark (not near-black) so it reads as the same product.
   ================================================================= */

[data-theme="dark"] {
  --background:    #0F1A36;
  --card:          #1C2B57;
  --muted:         #16234A;
  --secondary:     #16234A;
  --popover:       #1C2B57;

  --foreground:           #F5F7FA;
  --card-foreground:      #F5F7FA;
  --muted-foreground:     #98A4B6;
  --secondary-foreground: #F5F7FA;
  --popover-foreground:   #F5F7FA;

  --primary:            #4FA8F0;     /* brighter azure — AA on navy (7.2:1) */
  --primary-foreground: #0F1A36;
  --primary-hover:      #6FB8F4;
  --primary-active:     #3F98E0;
  --primary-soft:       rgba(79, 168, 240, 0.14);

  --accent:             #2DD4BF;     /* teal signature stays vivid in dark */
  --accent-foreground:  #0F1A36;

  --destructive:        #F87171;
  --destructive-foreground: #FFFFFF;
  --warning:            #FBBF24;
  --success:            #34D399;

  --border:             #2A3C66;
  --input:              #2A3C66;
  --border-input:       #748AB0;     /* WCAG 1.4.11 measured:
                                          vs --background (#0F1A36)          4.92 : 1  ✅
                                          vs --secondary  (#16234A)          4.37 : 1  ✅ */
  --ring:               #4FA8F0;

  --shadow-soft:     0 1px 2px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.30);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,0.55), 0 12px 32px rgba(0,0,0,0.40);
  --shadow-accent:   0 0 0 1px rgba(79, 168, 240, 0.28), 0 8px 24px rgba(79, 168, 240, 0.22);

  --text-secondary: #B5C2D2;
}

/* =================================================================
   prefers-color-scheme sync — honor OS dark mode until the visitor
   clicks the toggle (which stamps an explicit data-theme on <html>).
   ================================================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background:    #0F1A36;
    --card:          #1C2B57;
    --muted:         #16234A;
    --secondary:     #16234A;
    --popover:       #1C2B57;

    --foreground:           #F5F7FA;
    --card-foreground:      #F5F7FA;
    --muted-foreground:     #98A4B6;
    --secondary-foreground: #F5F7FA;
    --popover-foreground:   #F5F7FA;

    --primary:            #4FA8F0;
    --primary-foreground: #0F1A36;
    --primary-hover:      #6FB8F4;
    --primary-active:     #3F98E0;
    --primary-soft:       rgba(79, 168, 240, 0.14);

    --accent:             #2DD4BF;
    --accent-foreground:  #0F1A36;

    --destructive:        #F87171;
    --destructive-foreground: #FFFFFF;
    --warning:            #FBBF24;
    --success:            #34D399;

    --border:             #2A3C66;
    --input:              #2A3C66;
    --border-input:       #748AB0;
    --ring:               #4FA8F0;

    --shadow-soft:     0 1px 2px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.30);
    --shadow-elevated: 0 4px 12px rgba(0,0,0,0.55), 0 12px 32px rgba(0,0,0,0.40);
    --shadow-accent:   0 0 0 1px rgba(79, 168, 240, 0.28), 0 8px 24px rgba(79, 168, 240, 0.22);

    --text-secondary: #B5C2D2;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* =================================================================
   BASE RESET + BODY
   ================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* ---------- Accessibility ---------- */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
  height: 1px; width: 1px;
  margin: -1px; overflow: hidden;
  padding: 0; position: absolute !important; word-wrap: normal !important;
}

.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: var(--z-toast);
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Typography baseline ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 var(--space-4);
  color: var(--foreground);
  letter-spacing: -0.015em;
}
h1 { font-size: var(--text-display); letter-spacing: -0.025em; }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); font-weight: 700; }
h4 { font-size: var(--text-2xl); font-weight: 700; }
h5 { font-size: var(--text-xl);  font-weight: 700; }
h6 { font-size: var(--text-lg);  font-weight: 700; }

p { margin: 0 0 var(--space-4); max-width: 70ch; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover, a:focus-visible { color: var(--primary-hover); }

::selection { background: var(--primary-soft); color: var(--foreground); }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--foreground);
}
code, kbd {
  background: var(--secondary);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------- Site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-block: var(--space-3);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--foreground);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-logo__slash {
  color: var(--accent);
  font-weight: 800;
  display: inline-block;
  transform: skewX(-12deg);
  margin-right: 0.12em;
}
.site-logo:hover { color: var(--primary); }

/* WordPress header logo (img variant) */
.site-title { margin: 0; font-size: var(--text-xl); line-height: 1; }
.site-title a { display: inline-flex; align-items: center; text-decoration: none; }
.site-logo-img { height: 48px; width: auto; display: block; }

.main-navigation ul {
  list-style: none; margin: 0; padding: 0;
  /* align-items:center is load-bearing: the KONTAKT button (.nav-cta) is taller
     than the text links, and without it flex's default `stretch` pinned the
     links to the TOP of the row instead of centering them on the button's line. */
  display: flex; align-items: center; gap: var(--space-4);
}
.main-navigation a {
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
.main-navigation a:hover { color: var(--foreground); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-md);
  color: var(--foreground);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background  var(--dur-fast) var(--ease),
              color       var(--dur-fast) var(--ease);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.site-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

/* Hamburger holds until the 8-link inline nav genuinely fits (~1024px+),
   preventing the horizontal-overflow dead zone at iPad-portrait/tablet widths. */
@media (max-width: 1023px) {
  .main-navigation { display: none; }
}

/* ---------- Site footer ---------- */
.site-footer {
  /* No top margin — a margin here exposes a raw page-background band between
     the last section and the footer (glaring in dark mode). The border +
     section padding provide the separation. */
  margin-top: 0;
  padding-block: var(--space-10);
  border-top: 1px solid var(--border);
  background: var(--muted);
}
.site-footer__inner {
  display: grid;
  gap: var(--space-6);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}
.site-footer__name { color: var(--foreground); font-size: var(--text-lg); margin-bottom: 0; }
.site-footer__legal, .site-footer__copy { margin: 0; }
.site-footer a { color: var(--muted-foreground); }
.site-footer a:hover { color: var(--primary); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
