/* ==========================================================================
   BAKR — core: design tokens, base elements, buttons, typography, scroll-reveal.
   Loaded on every page, first.
   (Split out of the old inline <style> in home.blade.php; rule order preserved.)
   ========================================================================== */

/* BAKR theme tokens, resets, typography, and shared layout primitives. */
/* ==========================================================================
   BAKR — shared internal stylesheet

   Home, scholarship, and student-finder styles are consolidated here so this
   document can run as a self-contained page without an external CSS file.
   ========================================================================== */
:root {
  /* ------------------------------------------------------------------
     HERO IMAGE (home page)  <<< change this one line to swap in your photo >>>
     ------------------------------------------------------------------ */
  --hero-image: url("../images/img/dnsc_campus.jpg");
  --hero-focus: center;

  /* Shared palette — taken from scholarships-bakr.css (the navbar's
     palette), used everywhere now for one consistent look */
  --vanilla: #fdfbf8;
  --surface: #ffffff;
  --vanilla-deep: #faf7f2;
  /* Role colours (dark mode redefines these in bakr-dark.css; light values are unchanged). */
  --text-strong: var(--green-900);
  --text-accent: var(--green-700);
  --page-bg: var(--vanilla);
  --page-bg-deep: var(--vanilla-deep);
  --green-900: #143a2b;
  --green-700: #1f4d3a;
  --green-600: #2a6147;
  --green-500: #3d7a58;
  --sage: #8fa898;
  --sage-tint: #e7efe9;
  --gold: #b8912f;
  --gold-light: #f6dfa0;
  --gold-tint: #fbf1dc;
  --ink: #2b2925;
  --ink-soft: #635e57;         /* 5.4:1+ on every cream/sage surface */
  --gold-text: #7d5f17;        /* gold used AS text on light surfaces (5:1+) */
  --gold-fill: #c9a443;        /* gold behind green-900 text (5.3:1) */
  --border: #eeece8;
  --amber-warn: #a65b2a;
  --amber-tint: #fbeada;
  --danger: #b42318;
  --danger-tint: #fde8e7;

  /* Government sector accent — echoes the DNSC seal's teal */
  --teal-800: #1d4750;
  --teal-600: #2c6470;
  --teal-tint: #e6f0f1;

  /* Fonts + layout (used by the home.css sections below) */
  --font-display: 'Poppins', sans-serif;
  --font-body: 'Poppins', sans-serif;
  --font-serif: 'Source Serif 4', serif;
  --page-max: 100%;
  --radius-card: 14px;
  --radius-modal: 18px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
}

/* --page-max mirrors Bootstrap's .container widths so the hero and footer stay aligned with it (same as scp) */@media (min-width: 576px) {
  :root { --page-max: 540px; }
}

@media (min-width: 768px) {
  :root { --page-max: 720px; }
}

@media (min-width: 992px) {
  :root { --page-max: 960px; }
}

@media (min-width: 1200px) {
  :root { --page-max: 1140px; }
}

@media (min-width: 1400px) {
  :root { --page-max: 1320px; }
}

html { scroll-behavior: smooth; scroll-padding-top: 104px; -webkit-tap-highlight-color: transparent; height: 100%; }

/* Sticky-footer layout, shared by every page: header/footer keep their
   natural size, and the main content area (main, or .sf-page on the
   Scholarship Finder) takes whatever space is left, so the footer sits
   pinned to the bottom of the viewport on short pages. Note: body gets
   ONLY min-height here, never a definite height — giving a flex
   container (body) a definite height that's smaller than its content
   lets the flex algorithm shrink children whose overflow isn't
   "visible" (e.g. .page-hero, .nx-hero) down to fit, and since those
   sections clip with overflow:hidden, that shrinking was cropping
   their headings. min-height doesn't create that pressure. */
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main { flex: 1 0 auto; }

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

a { text-decoration: none; }

a:focus-visible,
button:focus-visible,
.form-control:focus-visible {
  outline: 3px solid var(--gold-text);
  outline-offset: 2px;
}

/* .container: uses Bootstrap's default widths (same as scp) — no custom cap. */
.nx-section { padding: 88px 0; }

.nx-h2 {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.14;
  color: var(--text-strong);
  margin: 0 0 14px;
}

.nx-lead { color: var(--ink-soft); font-size: var(--text-md); line-height: 1.72; max-width: 60ch; margin: 0; }

/* ---------- Buttons ---------- */
.nx-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, filter .18s ease;
}

.nx-btn-gold {
  color: var(--green-900);
  background: linear-gradient(160deg, var(--gold-light) 0%, var(--gold-fill, #c9a443) 100%);
  border-color: rgba(20, 58, 43, .08);
  box-shadow: 0 14px 26px -16px rgba(20, 58, 43, .5);
}

.nx-btn-gold:hover { box-shadow: 0 18px 30px -16px rgba(20, 58, 43, .6); filter: brightness(1.04); }

.nx-btn-green { color: var(--vanilla); background: var(--green-700); }

.nx-btn-green:hover { color: var(--vanilla); background: var(--green-900); }

.nx-step:focus-within { transform: translateY(-3px); box-shadow: 0 22px 42px -26px rgba(20, 58, 43, .28); }

.nx-step:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 575.98px) {
  .nx-section { padding: 48px 0; }
  .nx-lead { line-height: 1.6; }
}

/* ==========================================================================
   ADMIN-PORTAL ALIGNMENT OVERRIDES (chrome: navbar, hero, buttons, cards)
   ========================================================================== */
:root { --radius: 12px; --radius-sm: 8px; }

.nx-h2 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em;
}

/* Buttons: admin radius + shadow language */
.nx-btn { border-radius: 10px; box-shadow: none; }

/* Steps section breathing room, admin spacing */
.nx-section { padding: 72px 0; }

@media (max-width: 575.98px) {
  .nx-section { padding: 56px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-btn { transition: none !important; }
}

/* ---------- Buttons: one gold-foil shine on load, softer premium cut.
   The sweep plays once (animation, not :hover) and stays gone — hovering
   afterwards only does the plain lift/shadow below, no repeat shine. ---------- */
.nx-btn {
  position: relative; overflow: hidden;
  border-radius: 14px 4px 14px 4px;
}

.nx-btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 48%, transparent 66%);
  transform: translateX(-140%);
  animation: nxSweepOnce 1s ease-out .5s 1 forwards;
  pointer-events: none;
}

.nx-btn-gold {
  background-image: linear-gradient(160deg, var(--gold-light) 0%, var(--gold-fill, #c9a443) 45%, var(--gold-light) 100%);
  transition: transform .18s ease, box-shadow .18s ease;
}

.nx-btn-gold:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(20, 58, 43, .55); }

@media (prefers-reduced-motion: reduce) {
  .nx-btn::after {
      animation: none !important; transition: none !important;
      opacity: 1 !important; transform: none !important; left: -60% !important;
    }
  .nx-btn::after { display: none !important; }
}

/* ==========================================================================
   BAKR DESIGN SYSTEM OVERRIDES
   ========================================================================== */
:root {
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --motion-standard: 200ms ease-in-out;
  --primary: var(--green-900);
  --accent: var(--gold);
  --neutral: var(--vanilla);
  /* Legacy aliases collapse into the streamlined pine / gold / neutral palette. */
  --teal-800: var(--green-900);
  --teal-600: var(--green-700);
  --teal-tint: var(--sage-tint);
  --amber-warn: #8f6d22;
  --amber-tint: var(--gold-tint);
}

/* Consistent interactive focus treatment across native and custom controls. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Final checklist: rem typography and an 8px spacing grid. */
:root {
  --space-0: 0;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  /* Type scale (shared by every page; also declared in bakr-dashboard.css and student-auth.css).
     xs 12 labels, eyebrows, badges (the smallest text) · caption 13 meta, hints, timestamps ·
     sm 14 secondary body, table cells · md 16 body, item titles, leads · title 18 card titles ·
     lg 20 section titles · xl/2xl display. Headings above 22px keep their own clamp() sizes.
     Fluid (2026-11-21): md and up shrink smoothly to a step smaller on a 360px phone (md 15 · title 16.5 ·
     lg 18 · xl 20 · 2xl 25) and reach the sizes above from 1200px. xs / caption / sm never shrink (min 12px). */
  --text-xs: 0.75rem;
  --text-caption: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: clamp(0.9375rem, 0.9107rem + 0.119vw, 1rem);
  --text-title: clamp(1.03125rem, 0.991rem + 0.179vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.071rem + 0.238vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.143rem + 0.476vw, 1.5rem);
  --text-2xl: clamp(1.5625rem, 1.375rem + 0.833vw, 2rem);
}

html { font-size: 100%; }

body { font-size: var(--text-md); }

.nx-btn {
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Navigation and component consolidation safeguards. */
:root {
  --radius-container: 16px;
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-pill: 999px;
}

@media (max-width: 991.98px) {
  html { scroll-padding-top: 72px; }
}

/* All custom interactive focus rings use one high-contrast treatment. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* =====================================================================
   BAKR premium reference-inspired homepage treatment
   ===================================================================== */
:root { --page-max: 1240px; }

/* html too (2026-11-21): on phones a stray wide element otherwise lets the page zoom out. */
html { overflow-x: clip; }
body { overflow-x: clip; background: var(--page-bg); }

.nx-section { padding-top: clamp(48px,5vw,72px); padding-bottom: clamp(48px,5vw,72px); }

.container { width: min(calc(100% - 48px), 1240px); max-width: 1240px; }

.bakr-eyebrow { display:inline-flex; align-items:center; gap:8px; margin-bottom:13px; color: var(--text-accent); font-size: var(--text-xs); font-weight:800; letter-spacing:.16em; }

.bakr-intro-inner .nx-btn { box-shadow:0 10px 20px -12px rgba(20,58,43,.55); }

@media (max-width:767.98px) {
  .container { width:min(calc(100% - 32px),1240px); }
  .nx-section { padding-top:46px; padding-bottom:46px; }
}

@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
}

.bakr-dnsc-card:focus-within {
  transform: translateY(-5px); border-color: var(--gold);
  box-shadow: 0 22px 42px rgba(20,58,43,.13), 0 0 0 3px rgba(184,145,47,.09);
}

.bakr-dnsc-details:focus-visible {
  color: var(--vanilla); background: var(--green-900); border-color: var(--green-900); transform: translateY(-1px);
}

.bakr-dnsc-details:focus-visible i { color: var(--gold-light); }

/* BAKR NAVBAR FINAL OVERRIDE — consistent across Home, Scholarships, and Scholarship Finder */
html { scroll-padding-top: 124px !important; }

@media (max-width: 991.98px) {
  html { scroll-padding-top:82px !important; }
}

.nx-section:not(.nx-steps) {
  position: relative;
  isolation: isolate;
}

.nx-section:not(.nx-steps)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(253,251,248,.94), rgba(253,251,248,.91)),
    url("../images/img/dnsc_campus.jpg") center / cover no-repeat;
  background-attachment: scroll;
}

/* BAKR premium refinement: restrained gold details for the scholarship preview and About panel. */
#scholarships.nx-section {
  position: relative;
  background:
    radial-gradient(ellipse at 8% 8%, rgba(184,145,47,.055), transparent 34%),
    linear-gradient(180deg, #fdfbf8 0%, #ffffff 56%, #fdfbf8 100%);
}

#scholarships .nx-h2 {
  color: #143a2b;
  letter-spacing: -.035em;
  text-wrap: balance;
}

#scholarships .nx-lead {
  max-width: 720px;
}

#scholarships .nx-btn-green {
  box-shadow: 0 6px 16px rgba(20,58,43,.12);
  border: 1px solid rgba(184,145,47,.58);
}

#scholarships .nx-btn-green:hover {
  box-shadow: 0 10px 22px rgba(20,58,43,.17), 0 0 0 3px rgba(184,145,47,.09);
}

#about .nx-h2 {
  text-wrap: balance;
  letter-spacing: -.03em;
}

/* ===== BAKR LOGO BADGE — taken from the scholar dashboard (.brand-mark.brand-badge) =====
   Sage→green gradient badge, leaf-cut corners, logo image contained inside.
   Sizes follow Bootstrap breakpoints: base (<576) / sm ≥576 / md ≥768 / lg ≥992 */
:root { --bk-badge-size: 32px; --bk-badge-pad: 42px; --bk-badge-sage: #7e9c86; --bk-badge-green: #29553b; }

@media (min-width: 576px) {
  :root { --bk-badge-size: 36px; --bk-badge-pad: 46px; }
}

@media (min-width: 992px) {
  :root { --bk-badge-size: 40px; --bk-badge-pad: 50px; }
}

/* ==========================================================================
   LATEST UPDATES (appended last so they override earlier rules)
   ========================================================================== */
/* Section scroll alignment (single source of truth) */
:root { --nav-offset: 84px; }

@media (max-width: 991.98px) {
  :root { --nav-offset: 68px; }
}

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-offset) !important; }

main section[id],
main [id] { scroll-margin-top: 0; }

main section:focus,
main:focus { outline: none; }

/* direction variants (set with data-reveal="left | right | zoom") */
[data-reveal="left"] { --reveal-from: translateX(-52px); }

[data-reveal="right"] { --reveal-from: translateX(52px); }

[data-reveal="zoom"] { --reveal-from: scale(.9) translateY(22px); }

/* waiting state */
.js-reveal .nx-reveal:not(.is-visible),
.js-reveal .nx-reveal-stagger:not(.is-visible) > * { opacity: 0; }

/* play once when the section scrolls into view; "backwards" keeps hover effects working afterwards */
.js-reveal .nx-reveal.is-visible {
  animation: nxRevealIn .85s cubic-bezier(.2, .7, .3, 1) backwards;
}

.js-reveal .nx-reveal-stagger.is-visible > * {
  animation: nxRevealIn .75s cubic-bezier(.2, .7, .3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 110ms);          /* children arrive one after another */
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal .nx-reveal:not(.is-visible),
  .js-reveal .nx-reveal-stagger:not(.is-visible) > * { opacity: 1 !important; }
  .js-reveal .nx-reveal.is-visible,
  .js-reveal .nx-reveal-stagger.is-visible > * { animation: none !important; }
}

#about .container { max-width: 1240px; }

#about .nx-h2 {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-weight: 600; font-size: clamp(2rem, 3.1vw, 3.1rem); line-height: 1.12;
  letter-spacing: -.01em; color: var(--vanilla); margin: 0; text-wrap: balance;
}

#about .nx-h2 em { font-style: italic; font-weight: 600; color: var(--gold-light); }

/* One-shot sweeps: play a single time, then sit still until reload. */
@keyframes nxSweepOnce {
  0%   { transform: translateX(-140%); }
  100% { transform: translateX(140%); }
}

/* ==========================================================================
   SCROLL ANIMATIONS: every section eases in as it enters the screen
   (hidden state only applies when JS is running; see the "js-reveal" flag in <head>)
   ========================================================================== */
@keyframes nxRevealIn {
  from { opacity: 0; transform: var(--reveal-from, translateY(34px)); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Legibility floor (audit 2026-11-09): no functional label under ~11.5px ---------- */
.bakr-eyebrow { font-size: var(--text-xs); }

/* ==========================================================================
   Smooth page changes (2026-11-13). Every BAKR page opts in to the browser's
   cross-document view transitions, so clicking a link cross-fades to the next
   page instead of blanking and repainting. The sidebar and the top navbar keep
   their place (no fade), so only the content changes. Browsers without support
   simply load the page as before. Same block in bakr-core.css,
   bakr-dashboard.css and student-auth.css: both pages must opt in.
   ========================================================================== */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; animation-timing-function: ease-out; }
.dash .dash-side { view-transition-name: bakr-side; }
.bk-navbar { view-transition-name: bakr-nav; }
::view-transition-group(bakr-side), ::view-transition-group(bakr-nav) { animation-duration: 0s; }
::view-transition-old(bakr-side), ::view-transition-old(bakr-nav) { display: none; }
::view-transition-new(bakr-side), ::view-transition-new(bakr-nav) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
/* Reserve the scrollbar's space so pages of different lengths don't shift sideways. */
html { scrollbar-gutter: stable; }
