/* ==========================================================================
   OTG — On The Ground 2.0
   Design system. Dark blue / gray / white / black. Sharp, crisp, engineered.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Brand */
  --ink:        #06101F;  /* near-black, the deepest surface            */
  --navy-900:   #071B33;
  --navy-800:   #0A2340;
  --navy-700:   #0E2F54;
  --navy-600:   #14406F;
  --navy-500:   #1B5590;
  --blue:       #2C7BE5;  /* signal blue — links, focus, key actions    */
  --blue-soft:  #E8F1FD;

  /* Neutrals */
  --white:      #FFFFFF;
  --paper:      #F7F8FA;
  --gray-100:   #EDEFF3;
  --gray-200:   #DDE1E8;
  --gray-300:   #C3C9D4;
  --gray-400:   #9AA3B2;
  --gray-500:   #6C7688;
  --gray-600:   #4A5365;
  --gray-700:   #2E3646;

  /* Semantic */
  --bg:         var(--white);
  --fg:         var(--ink);
  --muted:      var(--gray-500);
  --rule:       var(--gray-200);
  --ok:         #147D5B;
  --warn:       #A56410;
  --bad:        #B3261E;

  /* Type */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* Rhythm */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --maxw: 1200px;
  --radius: 3px;
  --radius-lg: 5px;

  --shadow-sm: 0 1px 2px rgba(6, 16, 31, .06), 0 1px 3px rgba(6, 16, 31, .04);
  --shadow-md: 0 2px 4px rgba(6, 16, 31, .05), 0 8px 24px rgba(6, 16, 31, .07);
  --shadow-lg: 0 4px 8px rgba(6, 16, 31, .06), 0 24px 56px rgba(6, 16, 31, .12);
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 640; letter-spacing: -0.022em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--navy-700); color: #fff; }

/* --- Layout primitives ---------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: 760px; }
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.section-tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
/* Two-column grids declare their ratio inline; below this width they stack. */
@media (max-width: 880px) {
  .grid.split { grid-template-columns: minmax(0, 1fr) !important; }
}
.between { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; }
.center { text-align: center; }
.mt0 { margin-top: 0 !important; }

/* --- Type ----------------------------------------------------------------- */
.display { font-size: clamp(2.35rem, 6.2vw, 4.25rem); line-height: 1.04; letter-spacing: -0.035em; font-weight: 680; }
.h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -0.03em; }
.h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); letter-spacing: -0.028em; }
.h3 { font-size: clamp(1.15rem, 1.8vw, 1.35rem); letter-spacing: -0.018em; }
.h4 { font-size: 1.0625rem; letter-spacing: -0.012em; }
.lede { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.55; color: var(--gray-600); }
.small { font-size: .875rem; }
.tiny { font-size: .8125rem; }
.muted { color: var(--muted); }
.eyebrow {
  font-size: .6875rem; font-weight: 650; letter-spacing: .14em;
  text-transform: uppercase; color: var(--blue);
  display: inline-flex; align-items: center; gap: .55rem;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.25rem; border-radius: var(--radius);
  font-size: .9375rem; font-weight: 570; letter-spacing: -.005em;
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1E68CC; }
.btn-ghost { border-color: var(--gray-300); color: var(--fg); background: transparent; }
.btn-ghost:hover { border-color: var(--navy-800); background: var(--paper); }
.btn-quiet { padding-inline: 0; color: var(--blue); font-weight: 570; }
.btn-quiet:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.on-dark .btn-ghost { border-color: rgba(255,255,255,.28); color: #fff; }
.on-dark .btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.on-dark .btn-primary { background: #fff; color: var(--navy-900); }
.on-dark .btn-primary:hover { background: var(--gray-100); }

.arrow::after { content: "→"; transition: transform .16s ease; }
a:hover > .arrow::after, .btn:hover .arrow::after, .arrow:hover::after { transform: translateX(3px); }

/* --- Surfaces ------------------------------------------------------------- */
.on-dark { background: var(--navy-900); color: #fff; }
.on-dark .lede, .on-dark .muted { color: rgba(255,255,255,.68); }
.on-dark .eyebrow { color: #7FB2F2; }
.on-dark hr, .on-dark .rule { border-color: rgba(255,255,255,.14); }
.on-ink { background: var(--ink); color: #fff; }
.on-paper { background: var(--paper); }

.card {
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.2vw, 1.75rem);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.card-link:hover { border-color: var(--navy-600); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.on-dark .card { background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.12); }
.on-dark .card-link:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.075); }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 560;
  background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200);
}
.badge-blue { background: var(--blue-soft); color: #1A5DBF; border-color: #CFE1FA; }
.badge-ok   { background: #E6F4EF; color: var(--ok); border-color: #C7E7DB; }
.badge-warn { background: #FDF3E3; color: var(--warn); border-color: #F3E0BE; }
.badge-bad  { background: #FCEBEA; color: var(--bad); border-color: #F5D2CF; }
.on-dark .badge { background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.18); }

/* --- Header --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.site-header .bar { display: flex; align-items: center; gap: 1.5rem; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .625rem; font-weight: 680; letter-spacing: -.03em; font-size: 1.15rem; }
.brand-mark {
  width: 26px; height: 26px; flex: none; border-radius: 3px;
  background: var(--navy-800); color: #fff;
  display: grid; place-items: center; font-size: .68rem; font-weight: 750; letter-spacing: -.02em;
}
.brand small { display: block; font-size: .625rem; font-weight: 520; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: -2px; }
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav a {
  padding: .5rem .7rem; border-radius: var(--radius); font-size: .9rem; font-weight: 520; color: var(--gray-600);
  transition: color .14s ease, background-color .14s ease;
}
.nav a:hover { color: var(--fg); background: var(--gray-100); }
.nav a[aria-current="page"] { color: var(--navy-800); font-weight: 600; }
.nav-cta { margin-left: .5rem; }
/* .nav a sets a grey colour that would otherwise beat .btn-primary on specificity. */
.nav a.btn-primary { color: #fff; }
.nav a.btn-primary:hover { color: #fff; background: var(--navy-600); }
.burger { display: none; margin-left: auto; background: none; border: 1px solid var(--gray-300); border-radius: var(--radius); padding: .5rem .6rem; cursor: pointer; }
.burger span { display: block; width: 17px; height: 1.5px; background: var(--fg); }
.burger span + span { margin-top: 4px; }
@media (max-width: 900px) {
  .nav { display: none; }
  .burger { display: block; }
  .site-header[data-open="true"] .nav {
    display: flex; position: absolute; left: 0; right: 0; top: 68px; flex-direction: column;
    align-items: stretch; gap: 0; background: #fff; border-bottom: 1px solid var(--rule);
    padding: .5rem var(--gutter) 1rem; box-shadow: var(--shadow-md);
  }
  .site-header[data-open="true"] .nav a { padding: .8rem .25rem; border-bottom: 1px solid var(--gray-100); }
  .nav-cta { margin: .75rem 0 0; }
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 82% -12%, rgba(44,123,229,.30), transparent 62%),
    radial-gradient(700px 420px at 8% 108%, rgba(27,85,144,.35), transparent 60%),
    var(--navy-900);
  color: #fff;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 20%, transparent 78%);
}
.hero .wrap { position: relative; z-index: 1; }
.hero-inner { padding-block: clamp(4rem, 11vw, 8.5rem); max-width: 900px; }
.hero .display { color: #fff; }
.hero .lede { color: rgba(255,255,255,.74); max-width: 620px; margin-top: 1.5rem; }

/* --- Feature / pillar list ------------------------------------------------ */
.pillar { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start; }
.pillar-num {
  font-family: var(--mono); font-size: .75rem; font-weight: 600; color: var(--blue);
  border: 1px solid var(--gray-200); border-radius: 3px; padding: .2rem .45rem; line-height: 1;
  padding-top: .3rem;
}
.on-dark .pillar-num { border-color: rgba(255,255,255,.2); color: #7FB2F2; }

.ticks li { position: relative; padding-left: 1.6rem; color: var(--gray-600); }
.ticks li + li { margin-top: .5rem; }
.ticks li::before {
  content: ""; position: absolute; left: .1rem; top: .62em;
  width: 8px; height: 8px; border-radius: 1px; background: var(--blue);
}
.on-dark .ticks li { color: rgba(255,255,255,.72); }

.steps { counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding-left: 3.25rem; }
.steps > li + li { margin-top: 1.75rem; }
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font-family: var(--mono); font-size: .8125rem; font-weight: 600; color: var(--blue);
  border-left: 2px solid var(--blue); padding-left: .75rem; line-height: 1.5;
}

.metric { border-left: 2px solid var(--blue); padding-left: 1rem; }
.metric .val { font-size: clamp(1.75rem, 3.4vw, 2.5rem); font-weight: 680; letter-spacing: -.035em; line-height: 1; }

/* --- Logo strip ----------------------------------------------------------- */
.strip { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; align-items: center; }
.strip span { font-weight: 620; letter-spacing: -.02em; color: var(--gray-400); font-size: 1.0625rem; }

/* --- Tables --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 620; background: var(--paper);
}
table.data tr:last-child td { border-bottom: 0; }

/* --- Forms ---------------------------------------------------------------- */
.field { display: block; }
.field + .field, .field + .row, .row + .field { margin-top: 1.1rem; }
.field > label, .label {
  display: block; font-size: .8125rem; font-weight: 570; margin-bottom: .4rem; color: var(--gray-700);
}
.field .req { color: var(--bad); }
.input, .select, .textarea {
  width: 100%; padding: .68rem .8rem; background: #fff;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .9375rem; transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(44,123,229,.15);
}
.textarea { min-height: 130px; resize: vertical; }
.hint { font-size: .8125rem; color: var(--muted); margin-top: .35rem; }
.form-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .field + .field { margin-top: 0; }

.notice { padding: .8rem 1rem; border-radius: var(--radius); font-size: .9rem; border: 1px solid; }
.notice-ok  { background: #E6F4EF; border-color: #C7E7DB; color: #0E5C43; }
.notice-bad { background: #FCEBEA; border-color: #F5D2CF; color: #8C1D18; }
.notice-info{ background: var(--blue-soft); border-color: #CFE1FA; color: #17508F; }
[hidden] { display: none !important; }

/* --- Footer --------------------------------------------------------------- */
.site-footer { background: var(--ink); color: rgba(255,255,255,.66); font-size: .9rem; }
.site-footer a { color: rgba(255,255,255,.66); }
.site-footer a:hover { color: #fff; }
.site-footer h4 {
  color: #fff; font-size: .6875rem; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 620; margin-bottom: .9rem;
}
.site-footer li + li { margin-top: .5rem; }
.footer-grid { display: grid; gap: 2.5rem; grid-template-columns: 1.6fr 1fr 1fr 1fr; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12); margin-top: 3rem; padding-top: 1.5rem;
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; font-size: .8125rem;
}

/* --- App shell (portal / academy) ----------------------------------------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 68px); }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } }
.side {
  border-right: 1px solid var(--rule); background: var(--paper);
  padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: .15rem;
}
@media (max-width: 860px) {
  .side { border-right: 0; border-bottom: 1px solid var(--rule); flex-direction: row; overflow-x: auto; padding: .5rem var(--gutter); }
}
.side h5 {
  font-size: .625rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gray-400);
  font-weight: 620; margin: 1rem 0 .5rem .7rem;
}
@media (max-width: 860px) { .side h5 { display: none; } }
.side a {
  padding: .5rem .7rem; border-radius: var(--radius); font-size: .9rem; font-weight: 520;
  color: var(--gray-600); white-space: nowrap;
}
.side a:hover { background: var(--gray-100); color: var(--fg); }
.side a[aria-current="page"] { background: var(--navy-800); color: #fff; font-weight: 570; }
.main { padding: clamp(1.5rem, 3.5vw, 2.75rem) var(--gutter); min-width: 0; }
.main-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; justify-content: space-between; margin-bottom: 1.75rem; }

.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; background: #fff; }
.stat .k { font-size: .6875rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 620; }
.stat .v { font-size: 1.9rem; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; margin-top: .35rem; }

.bar { height: 6px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 999px; transition: width .3s ease; }

.empty { border: 1px dashed var(--gray-300); border-radius: var(--radius-lg); padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }

.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%); background-size: 400% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: var(--radius); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --- Auth card ------------------------------------------------------------ */
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 3rem var(--gutter); background: var(--paper); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.25rem); box-shadow: var(--shadow-md); }

/* --- Course player -------------------------------------------------------- */
.player { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
@media (max-width: 900px) { .player { grid-template-columns: 1fr; } }
.module-list li { border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: .5rem; }
.module-list button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: .7rem .85rem; display: flex; gap: .7rem; align-items: center; font-size: .9rem;
}
.module-list li[data-active="true"] { border-color: var(--navy-800); background: var(--blue-soft); }
.module-list .dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--gray-300); flex: none; display: grid; place-items: center; font-size: 10px; color: #fff; }
.module-list li[data-done="true"] .dot { background: var(--ok); border-color: var(--ok); }

.prose { max-width: 68ch; }
.prose h2 { margin-top: 2.5rem; font-size: 1.5rem; }
.prose h3 { margin-top: 2rem; }
.prose p, .prose ul, .prose ol { margin-top: 1rem; color: var(--gray-700); }
.prose ul { list-style: disc; padding-left: 1.25rem; }
.prose ol { list-style: decimal; padding-left: 1.25rem; }
.prose li + li { margin-top: .35rem; }
.prose a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }

/* --- Certificate ---------------------------------------------------------- */
.cert {
  background: #fff; border: 1px solid var(--gray-300); padding: clamp(2rem, 6vw, 4rem);
  position: relative; box-shadow: var(--shadow-lg); max-width: 860px; margin-inline: auto;
}
.cert::before { content: ""; position: absolute; inset: 12px; border: 1px solid var(--gray-200); pointer-events: none; }
.cert-name { font-size: clamp(1.75rem, 4.5vw, 2.75rem); font-weight: 680; letter-spacing: -.03em; }
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  .cert { box-shadow: none; border-color: #999; }
  body { background: #fff; }
}

/* --- Utilities ------------------------------------------------------------ */
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--navy-800); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }
.divider { border-top: 1px solid var(--rule); margin-block: clamp(2rem, 5vw, 3.5rem); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
