/* NDU / Espresso & bronze. Shared public-site palette, loaded after page styles. */
:root,
:root[data-scheme="standard"],
:root[data-scheme="grayscale"] {
  --warm-canvas: #F7F2EB;
  --warm-panel: #FFFDF9;
  --warm-panel-soft: #E9DED1;
  --warm-panel-hover: #F1E6D9;
  --warm-text: #44382F;
  --warm-muted: #705F52;
  --warm-accent: #895B34;
  --warm-accent-soft: #A87950;
  --warm-line: #CDBBA8;
  --warm-shadow: #44382F14;
  --warm-overlay: #44382F;
  --warm-on-dark: #FFF9F1;
  --ndu-c-canvas: 247 242 235;
  --ndu-c-band: 233 222 209;
  --ndu-c-raised: 255 253 249;
  --ndu-c-surface-1: 255 253 249;
  --ndu-c-surface-2: 241 230 217;
  --ndu-c-surface-3: 233 222 209;
  --ndu-c-line-subtle: 218 204 188;
  --ndu-c-line-strong: 185 160 138;
  --ndu-c-line-control: 143 119 100;
  --ndu-c-fg: 68 56 47;
  --ndu-c-fg-secondary: 112 95 82;
  --ndu-c-fg-inverse: 255 253 249;
  --ndu-c-gold: 137 91 52;
  --ndu-c-gold-deep: 119 76 40;
  --ndu-c-gold-bright: 108 65 32;
  --ndu-c-focus: 119 76 40;
  --ndu-c-success: 51 103 68;
  --ndu-c-warning: 132 89 24;
  --ndu-c-danger: 164 49 42;
  --ndu-c-info: 76 83 92;
  --ndu-c-scrim: 68 56 47;
  color-scheme: light;
}

:root[data-scheme="light"] {
  --warm-canvas: #FFFDF9;
  --warm-panel: #FFFFFF;
  --warm-panel-soft: #F3EBE1;
  --warm-panel-hover: #F8F1E8;
  --warm-text: #44382F;
  --warm-muted: #705F52;
  --warm-accent: #895B34;
  --warm-accent-soft: #A87950;
  --warm-line: #CDBBA8;
  --warm-shadow: #44382F14;
  --warm-overlay: #44382F;
  --warm-on-dark: #FFF9F1;
  --ndu-c-canvas: 255 253 249;
  --ndu-c-band: 243 235 225;
  --ndu-c-raised: 255 255 255;
  --ndu-c-surface-1: 255 255 255;
  --ndu-c-surface-2: 248 241 232;
  --ndu-c-surface-3: 243 235 225;
  --ndu-c-line-subtle: 218 204 188;
  --ndu-c-line-strong: 185 160 138;
  --ndu-c-line-control: 143 119 100;
  --ndu-c-fg: 68 56 47;
  --ndu-c-fg-secondary: 112 95 82;
  --ndu-c-fg-inverse: 255 255 255;
  --ndu-c-gold: 137 91 52;
  --ndu-c-gold-deep: 119 76 40;
  --ndu-c-gold-bright: 108 65 32;
  --ndu-c-focus: 119 76 40;
  --ndu-c-success: 51 103 68;
  --ndu-c-warning: 132 89 24;
  --ndu-c-danger: 164 49 42;
  --ndu-c-info: 76 83 92;
  --ndu-c-scrim: 68 56 47;
  color-scheme: light;
}

html, body {
  background-color: var(--warm-canvas);
  color: var(--warm-text);
}

::selection { background: #D9BEA2; color: #382A20; }

/* A narrow espresso masthead anchors the otherwise light editorial pages. */
body > header,
body > footer {
  --ndu-c-canvas: 68 56 47;
  --ndu-c-band: 68 56 47;
  --ndu-c-raised: 81 66 55;
  --ndu-c-surface-1: 81 66 55;
  --ndu-c-surface-2: 94 76 63;
  --ndu-c-surface-3: 104 84 69;
  --ndu-c-line-subtle: 108 90 74;
  --ndu-c-line-strong: 140 114 91;
  --ndu-c-line-control: 174 147 122;
  --ndu-c-fg: 255 249 241;
  --ndu-c-fg-secondary: 228 212 195;
  --ndu-c-fg-inverse: 68 56 47;
  --ndu-c-gold: 230 194 155;
  --ndu-c-gold-deep: 230 194 155;
  --ndu-c-gold-bright: 255 226 195;
  --ndu-c-focus: 255 226 195;
  background: #44382F !important;
  color: #FFF9F1;
  border-color: #6C5A4A;
  color-scheme: dark;
}

body > header { box-shadow: 0 2px 14px #44382F12; }
body > header .h-header { min-height: 76px; }
body > header img { filter: none !important; }
body > footer { margin-top: 0; }
body > footer .ndu-link { color: #E6C29B; }

/* Navigation overlays and accessibility controls keep the paper palette. */
#ndu-mega,
#ndu-mob {
  --ndu-c-canvas: 247 242 235;
  --ndu-c-band: 233 222 209;
  --ndu-c-raised: 255 253 249;
  --ndu-c-surface-1: 255 253 249;
  --ndu-c-surface-2: 241 230 217;
  --ndu-c-surface-3: 233 222 209;
  --ndu-c-line-subtle: 218 204 188;
  --ndu-c-line-strong: 185 160 138;
  --ndu-c-line-control: 143 119 100;
  --ndu-c-fg: 68 56 47;
  --ndu-c-fg-secondary: 112 95 82;
  --ndu-c-fg-inverse: 255 253 249;
  --ndu-c-gold: 137 91 52;
  --ndu-c-gold-deep: 119 76 40;
  --ndu-c-gold-bright: 108 65 32;
  --ndu-c-focus: 119 76 40;
  background: var(--warm-panel);
  color: var(--warm-text);
  color-scheme: light;
}

#ndu-mega { box-shadow: 0 16px 36px #44382F1C; }
#ndu-mob { background: var(--warm-canvas); }
#ndu-mob summary:hover,
#ndu-mob a:hover { background: var(--warm-panel-hover); }
.ndu-mobile-languages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 16px;
  border-top: 1px solid var(--warm-line);
}
.ndu-mobile-languages a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--warm-line);
  border-radius: 5px;
  color: var(--warm-text);
  font-size: 13px;
  font-weight: 600;
}
.ndu-mobile-languages a[aria-current="page"] {
  background: var(--warm-text);
  border-color: var(--warm-text);
  color: var(--warm-on-dark);
}
#a11y-pn { box-shadow: -12px 0 40px #44382F20; }

/* A few legacy pages append these rules in the body after the shared sheets. */
.journal-cover {
  background: var(--warm-panel-soft) !important;
  border-color: var(--warm-line) !important;
  box-shadow: 0 8px 24px var(--warm-shadow) !important;
}
.procurement-page .projects-count a { color: var(--warm-accent) !important; }
.fac-top h2 { color: var(--warm-accent) !important; }
.science-page .science-direction svg { color: var(--warm-on-dark); }
.faculty-number { opacity: 1; }

/* Home: taupe hero, true-to-life campus photography, bronze metric band. */
.home-motion #main { background: var(--warm-canvas); }
.home-hero {
  --ndu-c-canvas: 233 222 209;
  --ndu-c-fg: 68 56 47;
  --ndu-c-fg-secondary: 96 77 62;
  --ndu-c-gold: 137 91 52;
  --ndu-c-gold-bright: 108 65 32;
  background: var(--warm-panel-soft);
  border-color: var(--warm-line) !important;
}
.home-hero .ndu-tactical-grid { opacity: .16; }
:root[data-scheme="light"] .home-hero { --ndu-c-canvas: 243 235 225; }
.home-hero h1 {
  font-size: clamp(40px, 4.25vw, 68px);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-transform: none;
  color: var(--warm-text);
}
.home-motion #top h1 .text-gold {
  background: none;
  color: var(--warm-text);
  -webkit-text-fill-color: currentColor;
  animation: none;
}
.home-hero [data-reveal] {
  min-height: min(68vh, 600px);
  gap: 22px;
  padding-top: 48px;
  padding-bottom: 48px;
}
.home-hero [data-reveal] > p:last-of-type {
  color: var(--warm-muted);
  font-size: 16px;
  line-height: 1.75;
}
.home-hero [data-reveal] > div:last-child a { border-radius: 6px; }

.home-stats {
  --ndu-c-canvas: 137 91 52;
  --ndu-c-fg: 255 249 241;
  --ndu-c-fg-secondary: 249 233 215;
  --ndu-c-gold: 255 241 220;
  --ndu-c-gold-bright: 255 249 241;
  --ndu-c-line-control: 222 185 150;
  background: #895B34;
  border-color: #895B34 !important;
  color: #FFF9F1;
}
.home-stats > .ndu-container {
  padding-top: 34px;
  padding-bottom: 34px;
  gap: 28px;
}
.home-stats dl { gap: 0; }
.home-stats dl > div {
  min-width: 0;
  padding: 16px 20px;
  border: 0;
  border-left: 1px solid #FFF9F14D;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.home-stats dl > div:first-child { border-left: 0; }
.home-stats dd { color: #FFF9F1; }
.home-stats dt {
  color: #F9E9D7;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: .035em;
  overflow-wrap: normal;
  word-break: normal;
}
.home-stats h2 { font-size: clamp(26px, 2.25vw, 34px); color: #FFF9F1; }
.home-stats > .ndu-container > div:first-child { gap: 14px; }
.home-stats figure { border-radius: 6px; }
.home-stats .ndu-duotone { filter: none; }
.home-stats figcaption { color: #FFF9F1; }

.home-education li,
.home-science li,
.home-events article,
.home-news .news-card {
  background: var(--warm-panel);
  border-color: var(--warm-line) !important;
  border-radius: 8px;
  box-shadow: 0 4px 16px #44382F06;
}
.home-education li:hover,
.home-science li:hover {
  border-color: var(--warm-accent-soft) !important;
  box-shadow: 0 10px 24px #44382F0E;
}
.home-events time { color: var(--warm-accent); }
.home-news .news-home-title > a { color: var(--warm-accent); border-color: var(--warm-line); }
.home-news time { color: var(--warm-accent); }
.home-news .news-card-copy h2 { color: var(--warm-text); }

/* Five directions form two generous lead cards and three supporting cards. */
@media (min-width: 1024px) {
  .home-motion #main .home-education ul,
  .home-motion #main .home-science ul { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .home-motion #main .home-education li,
  .home-motion #main .home-science li { grid-column: span 2 !important; }
  .home-motion #main .home-education li:nth-child(-n+2),
  .home-motion #main .home-science li:nth-child(-n+2) { grid-column: span 3 !important; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .home-motion #main .home-education ul,
  .home-motion #main .home-science ul { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .home-motion #main .home-education li:first-child,
  .home-motion #main .home-science li:first-child { grid-column: 1 / -1 !important; }
}

/* Keep long Kazakh words and labels readable in narrow control columns. */
.home-events time { min-width: 82px; }
.home-events time span { overflow-wrap: normal; word-break: normal; }
input, select, textarea { accent-color: #895B34; }
input::placeholder, textarea::placeholder { color: var(--warm-muted); opacity: .8; }

@media (min-width: 1024px) {
  .home-stats > .ndu-container { grid-template-columns: 1fr 1.8fr 1fr; }
  .home-stats > .ndu-container > * { grid-column: auto; }
  .home-hero .ndu-hero-media {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28%, #000);
    mask-image: linear-gradient(90deg, transparent 0, #000 28%, #000);
  }
}

@media (max-width: 767px) {
  .home-hero > .relative:not(.ndu-container) { height: 190px; min-height: 0; }
  .home-hero [data-reveal] { min-height: 0; padding-top: 26px; padding-bottom: 30px; gap: 18px; }
  .home-hero h1 { font-size: clamp(34px, 8.8vw, 46px); }
  .home-hero [data-reveal] > p:last-of-type { font-size: 15px; line-height: 1.65; }
  .home-hero [data-reveal] > div:last-child { gap: 10px; }
  .home-hero [data-reveal] > div:last-child a { padding-inline: 18px; font-size: 11px; letter-spacing: .06em; }
  .home-stats > .ndu-container { padding-top: 28px; padding-bottom: 28px; gap: 28px; }
  .home-stats dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-stats dl > div { padding: 12px 10px; gap: 12px; }
  .home-stats dt { font-size: 10px; letter-spacing: .015em; }
  .home-stats dd { font-size: 42px; }
  .home-stats > .ndu-container > figure { max-width: 480px; width: 100%; }
}

/* High contrast is a functional option, not a bronze recolor. */
:root[data-contrast="high"],
:root[data-scheme][data-contrast="high"] {
  --warm-canvas: #FFFFFF;
  --warm-panel: #FFFFFF;
  --warm-panel-soft: #F4F4F4;
  --warm-panel-hover: #EAEAEA;
  --warm-text: #111111;
  --warm-muted: #333333;
  --warm-accent: #57300E;
  --warm-accent-soft: #57300E;
  --warm-line: #555555;
  --warm-shadow: #00000014;
  --warm-overlay: #000000;
  --warm-on-dark: #FFFFFF;
  --ndu-c-canvas: 255 255 255;
  --ndu-c-band: 244 244 244;
  --ndu-c-raised: 255 255 255;
  --ndu-c-surface-1: 255 255 255;
  --ndu-c-surface-2: 244 244 244;
  --ndu-c-surface-3: 234 234 234;
  --ndu-c-line-subtle: 85 85 85;
  --ndu-c-line-strong: 51 51 51;
  --ndu-c-line-control: 51 51 51;
  --ndu-c-fg: 17 17 17;
  --ndu-c-fg-secondary: 51 51 51;
  --ndu-c-fg-inverse: 255 255 255;
  --ndu-c-gold: 87 48 14;
  --ndu-c-gold-deep: 87 48 14;
  --ndu-c-gold-bright: 55 29 5;
  --ndu-c-focus: 0 0 0;
  color-scheme: light;
}
:root[data-contrast="high"] body > header,
:root[data-contrast="high"] body > footer,
:root[data-contrast="high"] .home-stats {
  --ndu-c-canvas: 0 0 0;
  --ndu-c-band: 0 0 0;
  --ndu-c-fg: 255 255 255;
  --ndu-c-fg-secondary: 255 255 255;
  --ndu-c-gold: 255 233 176;
  --ndu-c-gold-deep: 255 233 176;
  --ndu-c-gold-bright: 255 255 255;
  background: #000000 !important;
  color: #FFFFFF;
}
:root[data-contrast="high"] #ndu-mega,
:root[data-contrast="high"] #ndu-mob {
  --ndu-c-canvas: 255 255 255;
  --ndu-c-raised: 255 255 255;
  --ndu-c-fg: 17 17 17;
  --ndu-c-fg-secondary: 51 51 51;
  --ndu-c-gold: 87 48 14;
  --ndu-c-gold-deep: 87 48 14;
  --ndu-c-gold-bright: 55 29 5;
}
