/* ============================================
   Smart Bio — "Lab" visual direction
   Dark-first (natural state), full light-mode peer.
   Every class name below is unchanged from the previous stylesheet —
   this is a visual reskin only. No selector was renamed, so nothing
   in any page's HTML or JavaScript needed to change.
   ============================================ */

/* Instrument Sans + Instrument Serif are loaded via the standard Google
   Fonts <link> in each page's <head> (same async-loading pattern already
   used site-wide), not hardcoded here — more reliable than pinning
   specific font file URLs by hand. */

/* ============================================
   Design tokens — dark is the default/natural theme now, light is a
   full peer, not an afterthought. Same variable names as before, so
   every existing rule that reads var(--moss) etc. re-themes for free.
   ============================================ */
:root {
  --moss: #C6F24E;           /* bright lime accent — backgrounds, borders, outlines */
  --moss-dark: #C6F24E;      /* readable-as-text variant — same as --moss in dark mode */
  --ochre: #9FE870;
  --paper: #0A0C0B;
  --paper-dim: #111514;
  --ink: #E9EFEA;
  --ink-rgb: 233, 239, 234;
  --stain: #F08A7E;
  --stain-dark: #F08A7E;
  --line: rgba(233, 239, 234, .1);
  --input-bg: #111514;
  --moss-rgb: 198, 242, 78;
  --stain-rgb: 240, 138, 126;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Instrument Sans', -apple-system, sans-serif;
  --font-mono: 'Instrument Sans', -apple-system, sans-serif;

  --radius: 11px;
}

[data-theme="light"] {
  --moss: #C6F24E;
  --moss-dark: #3F6B08;      /* dark green — readable as text on a light background */
  --ochre: #5A8C0A;
  --paper: #F6F8F5;
  --paper-dim: #EEF2EC;
  --ink: #121A15;
  --ink-rgb: 18, 26, 21;
  --stain: #B4382B;
  --stain-dark: #B4382B;
  --line: rgba(18, 26, 21, .12);
  --input-bg: #FFFFFF;
  --moss-rgb: 198, 242, 78;
  --stain-rgb: 180, 56, 43;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -.03em; font-weight: 500; font-family: var(--font-body); }
a { color: inherit; text-decoration: none; }
::selection { background: var(--moss); color: #0A0C0B; }
:focus-visible { outline: 2px solid var(--moss-dark); outline-offset: 2px; }
[dir="rtl"] body { font-family: 'Segoe UI', Tahoma, var(--font-body); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 20px; } }

.eyebrow {
  font-size: 10.5px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), .48); display: inline-block; margin-bottom: 10px;
}
[dir="rtl"] .eyebrow { letter-spacing: 0; }

/* ============================================
   Header
   ============================================ */
header.site {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 15px 32px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.brand .mark { height: 30px; width: auto; }

nav.main { display: flex; gap: 2px; }
nav.main a {
  color: rgba(var(--ink-rgb), .66); font-size: 14px; padding: 8px 13px; border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
nav.main a:hover { color: var(--ink); background: rgba(var(--ink-rgb), .06); }

.global-controls { display: flex; align-items: center; gap: 8px; margin-inline-end: 8px; padding-inline-end: 8px; border-inline-end: 1px solid var(--line); }
.control-btn {
  font: 500 13px/1 var(--font-body); color: rgba(var(--ink-rgb), .7);
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.control-btn:hover { border-color: var(--moss); color: var(--moss-dark); }
#theme-toggle { font-size: .9rem; padding: 8px 10px; }

#nav-auth-slot { display: flex; gap: 10px; align-items: center; }

/* mobile nav */
.mobile-nav-toggle {
  display: none; background: transparent; border: 1px solid var(--line); border-radius: 8px;
  width: 38px; height: 38px; align-items: center; justify-content: center; cursor: pointer; color: var(--ink);
  margin-inline-end: 4px;
}
@media (max-width: 860px) {
  header.site .wrap { padding: 14px 20px; }
  nav.main { display: none; }
  nav.main.mobile-open {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: 4px 20px 12px; gap: 0;
    z-index: 49; box-shadow: 0 18px 44px rgba(0,0,0,.5);
  }
  nav.main.mobile-open a { padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 1rem; }
  nav.main.mobile-open a:last-child { border-bottom: none; }
  nav.main.mobile-open .mobile-nav-divider { border-top: 1px solid var(--line); margin: 8px 0; }
  nav.main.mobile-open .global-controls { display: flex; gap: 8px; padding: 10px 4px; margin: 0; border: none; }
  nav.main.mobile-open #nav-auth-slot { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 4px 4px; }
  .mobile-nav-toggle { display: inline-flex !important; }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  font: 500 14px/1 var(--font-body); padding: 12px 20px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--moss); color: #0A0C0B; }
.btn-primary:hover { background: var(--ochre); color: #0A0C0B; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: rgba(var(--ink-rgb), .06); border-color: var(--moss); }
.btn-block { width: 100%; }
[data-theme="light"] .btn-primary { color: #0F1A08; }

/* ============================================
   Cards / grids
   ============================================ */
.specimen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; min-height: 240px; }
.specimen-card {
  background: var(--paper-dim); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-decoration: none; color: inherit; display: block;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
a.specimen-card:hover { border-color: rgba(var(--moss-rgb), .3); transform: translateY(-2px); }
.specimen-diagram { position: relative; }
.specimen-tag {
  display: flex; justify-content: space-between; padding: 10px 14px; font-size: 10.5px;
  font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: rgba(var(--ink-rgb), .5);
  border-bottom: 1px solid var(--line);
}
.specimen-body { padding: 16px 16px 18px; }
.specimen-body h3 { font-size: 17px; line-height: 1.3; margin-bottom: 6px; }
.specimen-body p { margin: 0; font-size: 13.5px; color: rgba(var(--ink-rgb), .58); line-height: 1.5; }
.specimen-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.status-ready { color: var(--moss-dark); font-size: 12.5px; font-weight: 600; }
.status-locked { color: rgba(var(--ink-rgb), .4); font-size: 12.5px; font-weight: 600; }

.diagram-frame { border-radius: 18px; border: 1px solid var(--line); }
.diagram-caption {
  display: flex; flex-direction: column; gap: 2px; margin-top: 12px; font-size: 12px;
  color: rgba(var(--ink-rgb), .55); letter-spacing: .04em;
}
.diagram-caption span:first-child { color: var(--ink); font-weight: 600; font-size: 14px; letter-spacing: 0; }

/* ============================================
   Stats
   ============================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; min-height: 92px; }
.stat-card {
  background: var(--paper-dim); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; text-decoration: none; color: inherit; display: block;
  transition: border-color .15s ease, transform .15s ease;
}
a.stat-card:hover { border-color: rgba(var(--moss-rgb), .3); transform: translateY(-2px); }
.stat-card .num { font-family: var(--font-display); font-weight: 400; font-size: 33px; line-height: 1; letter-spacing: -.01em; margin-bottom: 7px; color: var(--ink); }
.stat-card .label { font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: rgba(var(--ink-rgb), .48); }

/* ============================================
   Sections
   ============================================ */
section { padding: 46px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { font-size: 27px; line-height: 1.1; }
section.alt { background: var(--paper-dim); }

/* ============================================
   Tabs
   ============================================ */
.lang-tabs { display: inline-flex; gap: 5px; background: rgba(var(--ink-rgb), .06); padding: 4px; border-radius: var(--radius); margin-bottom: 20px; }
.lang-tab {
  font: 500 13px/1 var(--font-body); padding: 9px 16px; border: none; border-radius: 8px;
  background: none; color: rgba(var(--ink-rgb), .55); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.lang-tab:hover { color: var(--ink); }
.lang-tab.active { background: var(--moss); color: #0A0C0B; box-shadow: 0 1px 2px rgba(0,0,0,.15); }

/* ============================================
   Forms
   ============================================ */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: rgba(var(--ink-rgb), .7); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); font: 400 14.5px/1.4 var(--font-body); color: var(--ink);
  transition: border-color .15s ease;
}
.field input::placeholder { color: rgba(var(--ink-rgb), .35); }
.field input:focus, .field select:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px rgba(var(--moss-rgb), .15); }
.search-input {
  width: 100%; max-width: 340px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); font: 400 14px/1.4 var(--font-body); color: var(--ink);
}
.search-input:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px rgba(var(--moss-rgb), .15); }

.form-msg { font-size: 13.5px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: rgba(var(--stain-rgb), .1); border-color: var(--stain); color: var(--stain-dark); }
.form-msg.success { background: rgba(var(--moss-rgb), .1); border-color: var(--moss); color: var(--moss-dark); }

.auth-shell { min-height: calc(100vh - 68px); display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--paper-dim); border: 1px solid var(--line); border-radius: 18px; padding: 36px 32px; }
@media (max-width: 420px) { .auth-card { padding: 28px 20px; } }
.auth-card h1 { font-size: 27px; margin-bottom: 6px; }
.auth-card .sub { color: rgba(var(--ink-rgb), .58); font-size: 14.5px; margin: 0 0 26px; }
.auth-switch { margin: 20px 0 0; font-size: 13.5px; text-align: center; color: rgba(var(--ink-rgb), .58); }
.auth-switch a { color: var(--moss-dark); font-weight: 600; text-decoration: none; }

/* ============================================
   Tables
   ============================================ */
.data-table { width: 100%; border-collapse: collapse; background: var(--paper-dim); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.data-table th {
  text-align: start; font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), .48); background: rgba(var(--ink-rgb), .04); padding: 13px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(var(--ink-rgb), .03); }
.data-table td:last-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.badge { font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.badge-active { color: var(--moss-dark); border: 1px solid rgba(var(--moss-rgb), .3); background: rgba(var(--moss-rgb), .1); }
.badge-expired { color: rgba(var(--ink-rgb), .4); border: 1px solid var(--line); background: transparent; }
.badge-cancelled { color: var(--stain-dark); border: 1px solid rgba(var(--stain-rgb), .3); background: rgba(var(--stain-rgb), .1); }
.badge-public { color: var(--moss-dark); border: 1px solid rgba(var(--moss-rgb), .3); background: rgba(var(--moss-rgb), .1); }
.badge-locked { color: var(--stain-dark); border: 1px solid rgba(var(--stain-rgb), .3); background: rgba(var(--stain-rgb), .1); }

.action-btn {
  font-family: var(--font-body); font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; min-height: 32px; transition: background .15s ease, border-color .15s ease;
}
.action-btn:hover { border-color: var(--moss); background: rgba(var(--moss-rgb), .08); }
.action-btn.danger { color: var(--stain-dark); }
.action-btn.danger:hover { border-color: var(--stain); background: rgba(var(--stain-rgb), .08); }

.upload-form { background: var(--paper-dim); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.upload-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .upload-form .field-row { grid-template-columns: 1fr; } }

/* ============================================
   Player
   ============================================ */
/* .player-shell is just a layout wrapper (spacing above the meta text
   below it) — it should NOT have its own background, or the lesson
   title/description/back-button end up sitting on a black backdrop
   regardless of site theme, which looked broken especially in light
   mode. The black box treatment belongs only to .player-frame, the
   actual video area. */
.player-shell { border-radius: 14px; }
.player-frame {
  position: relative; aspect-ratio: 16/9; background: #050706;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
}
.player-frame video { width: 100%; height: 100%; }
/* When the frame itself goes fullscreen (not just the <video>, so the
   watermark and our custom fullscreen button come along with it), the
   fixed 16/9 aspect-ratio needs to drop — otherwise the browser boxes
   the frame into a 16:9 rectangle inside the real (often differently
   shaped, especially on a phone) fullscreen viewport, cutting off part
   of the screen instead of filling it. */
.player-frame:fullscreen,
.player-frame:-webkit-full-screen {
  aspect-ratio: unset;
  width: 100vw;
  height: 100vh;
}
.player-meta { padding: 20px 4px 0; }
.player-fullscreen-btn {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 34px; height: 34px; border-radius: 8px;
  border: none; background: rgba(6,8,7,.6); color: #E9EFEA; cursor: pointer; font-size: 14px;
  z-index: 5;
}
/* Explicit z-index — without this, some browsers render the <video>
   element's own compositing layer above sibling positioned elements
   regardless of DOM order, hiding the watermark behind the video. */
.watermark {
  position: absolute; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(233,239,234,.55); pointer-events: none; z-index: 5;
  background: rgba(0,0,0,.28); padding: 5px 9px; border-radius: 5px; line-height: 1.5;
}

/* ============================================
   Modals
   ============================================ */
.access-modal-overlay { position: fixed; inset: 0; background: rgba(4,6,5,.72); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; backdrop-filter: blur(3px); }
.access-modal { background: var(--paper-dim); border: 1px solid var(--line); border-radius: 18px; padding: 26px; max-width: 460px; width: 100%; max-height: 84vh; overflow-y: auto; box-shadow: 0 18px 44px rgba(0,0,0,.5); }
.access-modal h3 { font-size: 19px; margin: 0 0 18px; }

/* ============================================
   Misc
   ============================================ */
.empty-state { padding: 46px 22px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; color: rgba(var(--ink-rgb), .48); font-size: 14px; }
footer.site { border-top: 1px solid var(--line); padding: 26px 0; margin-top: 20px; }
.material-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--paper-dim); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 9px; }
.material-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(var(--moss-rgb), .1); color: var(--moss-dark); display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600; flex: none; }
.footer-mark { height: 30px; width: auto; }
[data-theme="dark"] .footer-mark { height: 20px; width: 20px; border-radius: 6px; }

/* ============================================
   Hero
   ============================================ */
.hero { padding: 64px 0 44px; }
.hero .grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: 56px; align-items: center; }
.hero h1 { font-size: 50px; line-height: 1.08; letter-spacing: -.035em; margin: 14px 0 20px; }
.hero .lede { font-size: 17px; line-height: 1.55; color: rgba(var(--ink-rgb), .62); max-width: 44ch; margin: 0 0 28px; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 940px) { .hero .grid { grid-template-columns: 1fr; gap: 32px; } .hero h1 { font-size: 38px; } }

/* ============================================
   RTL
   ============================================ */
[dir="rtl"] .specimen-tag, [dir="rtl"] .section-head, [dir="rtl"] .player-meta, [dir="rtl"] .material-row { direction: rtl; }
