/* ==========================================================================
   CDAC360 theme — the single source of colour for every page (Next.js and classic).
   Light: warm paper + forest green.  Dark: ink navy + periwinkle.
   The `dark` class on <html> is set before first paint by a small inline script.
   ========================================================================== */
:root {
  /* Surfaces */
  --page: #f4f1ea;
  --surface: #fbfaf7;
  --surface-2: #f6f3ed;
  --bg: var(--page);
  --bg-soft: #f2eee6;
  --line: #e7e1d6;
  --input-border: #c5bcad;

  /* Text */
  --ink: #161513;
  --ink-2: #3f3b35;
  --ink-soft: #5d5850;
  --muted: #6b665d;

  /* Accent */
  --accent: #23402f;
  --accent-hover: #1a3325;
  --accent-ink: #ffffff;
  --accent-soft: #4d6b57;
  --accent-text: #2c4c38;
  --accent-mid: #6f8b67;
  --g1: #1f3a2b;
  --g2: #2b4a37;
  --g3: #557a5e;
  --tint-accent: #eef2ec;
  --tint-accent-2: #e1e8dc;
  --tint-accent-line: #c9d5c2;

  /* Legacy names used by the classic pages */
  --violet: var(--accent-soft);
  --indigo: var(--accent);
  --blue: var(--accent-text);
  --sky: var(--g3);
  --cyan: var(--g3);
  --focus: #4d6b57;
  --grad: linear-gradient(180deg, #2b4a37 0%, #1f3a2b 100%);
  --grad-soft: linear-gradient(135deg, rgba(77, 107, 87, .07), rgba(184, 115, 73, .06));

  /* Status */
  --green: #4f7a52;
  --green-text: #3c6140;
  --tint-green: #ecf2e8;
  --tint-green-line: #c6d8bf;
  --red: #a8473a;
  --red-text: #8e3a2f;
  --tint-red: #f8ebe8;
  --tint-red-line: #e6c3bb;
  --orange: #b87349;
  --amber-text: #7a482c;
  --tint-amber: #f8ecdf;
  --tint-amber-line: #ead2b8;
  --pink: #a8584b;

  /* Deep panels (exam header, dark strips) */
  --ink-panel: #1d2c23;
  --on-panel: #eef2ea;
  --on-panel-muted: #b8c4b5;

  /* Effects */
  --shadow-ink: #3a2f1e;
  --shadow: 0 1px 2px rgba(58, 47, 30, .05), 0 8px 24px rgba(58, 47, 30, .06);
  --shadow-lg: 0 20px 50px rgba(58, 47, 30, .14);
  --glow: 0 1px 2px rgba(40, 32, 20, .05), 0 6px 20px rgba(40, 32, 20, .05);
  --headline-accent: linear-gradient(90deg, #4d6b57, #4d6b57);
  --cta: linear-gradient(180deg, #2b4a37, #1f3a2b);
  --deco-1: rgba(120, 110, 90, .09);
  --deco-2: rgba(120, 110, 90, .05);

  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color-scheme: light;
}

html.dark {
  --page: #0a0c11;
  --surface: #11141b;
  --surface-2: #0f1218;
  --bg-soft: #151922;
  --line: #222836;
  --input-border: #394155;

  --ink: #f4f5f8;
  --ink-2: #d3d7e0;
  --ink-soft: #a3a9b7;
  --muted: #959cac;

  --accent: #6577c8;
  --accent-hover: #7385d3;
  --accent-ink: #ffffff;
  --accent-soft: #8e9fe3;
  --accent-text: #9aabf0;
  --accent-mid: #7d8fd8;
  --g1: #5a6cb8;
  --g2: #6d7fd1;
  --g3: #8e9fe3;
  --tint-accent: #161c2e;
  --tint-accent-2: #1d2540;
  --tint-accent-line: #2d3866;

  --focus: #8e9fe3;
  --grad: linear-gradient(180deg, #7d8fd8 0%, #5a6cb8 100%);
  --grad-soft: linear-gradient(135deg, rgba(125, 143, 216, .10), rgba(125, 143, 216, .03));

  --green: #3fa374;
  --green-text: #7dd8aa;
  --tint-green: #11201a;
  --tint-green-line: #1f4433;
  --red: #d4566f;
  --red-text: #f0a3b4;
  --tint-red: #231419;
  --tint-red-line: #4c2633;
  --orange: #e0a443;
  --amber-text: #f2c26b;
  --tint-amber: #211a10;
  --tint-amber-line: #4a3a1e;
  --pink: #e98aa0;

  --ink-panel: #0d1017;
  --on-panel: #e3e7f3;
  --on-panel-muted: #9aa2b5;

  --shadow-ink: #000000;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  --glow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --headline-accent: linear-gradient(90deg, #9aabf0, #6d7fd1);
  --cta: linear-gradient(180deg, #7d8fd8, #5a6cb8);
  --deco-1: rgba(160, 175, 230, .10);
  --deco-2: rgba(160, 175, 230, .05);
  color-scheme: dark;
}

html { background: var(--page); }

/* Colour change animates only while the theme toggle is pressed (class removed right after). */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, fill .25s ease, stroke .25s ease !important;
}

/* ---------- Shared pieces used by both page families ---------- */
.headline-accent { background: var(--headline-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn-cta { background: var(--cta); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -8px rgba(31, 58, 43, .55); }
html.dark .btn-cta { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 30px -10px rgba(110, 128, 210, .7); border: 1px solid rgba(190, 200, 250, .35); }
.btn-cta:hover { filter: brightness(1.06); }

/* Wordmark (classic pages render the same markup as the React <Wordmark/>). */
.wordmark { position: relative; display: inline-flex; align-items: baseline; line-height: 1; letter-spacing: -0.045em; font-family: var(--font); font-size: 30px; color: var(--ink); text-decoration: none !important; }
.wordmark b { font-weight: 800; }
.wordmark .wm-360 { position: relative; font-weight: 300; color: var(--accent-soft); }
.wordmark svg { position: absolute; left: -18%; top: -34%; width: 132%; height: 164%; overflow: visible; color: var(--accent-soft); opacity: .8; pointer-events: none; max-width: none; }

/* Theme toggle (classic header uses the same look as the React one). */
.theme-toggle { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none; padding: 0; }
.theme-toggle:hover { color: var(--ink); border-color: var(--input-border); }
.theme-toggle svg { position: absolute; width: 18px; height: 18px; transition: transform .3s ease, opacity .3s ease; }
.theme-toggle .tt-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
html.dark .theme-toggle .tt-sun { opacity: 1; transform: none; }
html.dark .theme-toggle .tt-moon { opacity: 0; transform: rotate(90deg) scale(.5); }

html.dark input, html.dark select, html.dark textarea { color-scheme: dark; }
html.dark img.invert-dark { filter: invert(1) hue-rotate(180deg); }

/* Card on the page background (home sections, etc.). */
.card-surface { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--glow); }
