:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f1ece4;
  --ink: #1b1a1a;
  --muted: #5f5a52;
  --line: #e4ddd1;
  --gold: #948169;
  --gold-ink: #6f5f49;
  --d1: #b8572f;
  --d2: #2f7f78;
  --accent: #948169;
  --sun: #d9c7a3;
  --ok: #1f9d55;
  --bad: #d64545;
  --shadow: 0 10px 30px rgba(27, 26, 46, .08);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --surface: #1d1b18; --surface-2: #29261f; --ink: #f5f1ea; --muted: #b3ab9e;
    --line: #3a352d; --gold: #b9a587; --gold-ink: #cdbb9c; --d1: #e08a62; --d2: #5fb8b0; --accent: #b9a587; --sun: #8c7a5c;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --surface: #1d1b18; --surface-2: #29261f; --ink: #f5f1ea; --muted: #b3ab9e;
  --line: #3a352d; --gold: #b9a587; --gold-ink: #cdbb9c; --d1: #e08a62; --d2: #5fb8b0; --accent: #b9a587; --sun: #8c7a5c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Inter", system-ui, sans-serif; overflow-x: hidden;
}
h1, h2, h3, .display { font-family: "Space Grotesk", "Inter", sans-serif; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 7vw, 4.2rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-head { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.05rem "Space Grotesk", sans-serif; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand .mark { width: 40px; height: 40px; transition: transform .4s ease; }
.brand:hover .mark { transform: rotate(-8deg) scale(1.08); }
.nav { display: flex; gap: 4px; }
.nav a { white-space: nowrap; padding: 8px 12px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.menu-btn, .theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; height: 40px; min-width: 40px; cursor: pointer; font-size: 1.1rem; }
.menu-btn { display: none; }
@media (max-width: 1020px) {
  .menu-btn { display: block; }
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; padding: 12px 16px 20px; background: var(--bg); border-bottom: 1px solid var(--line); transform: translateY(-120%); transition: transform .3s ease; }
  .nav.open { transform: none; }
  .nav a { padding: 14px 16px; font-size: 1.05rem; }
}

/* Buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink); color: var(--bg); font: 700 1rem "Inter", sans-serif; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; min-height: 44px; }
.btn:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 6px 14px; font-size: .9rem; min-height: 38px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); font-size: .88rem; font-weight: 600; }

/* Hero */
.hero { position: relative; padding: 64px 0 48px; overflow: hidden; }
.hero .kicker { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--gold); color: #fff; font-weight: 700; font-size: .9rem; margin-bottom: 18px; }
.hero h1 .grad { background: linear-gradient(90deg, var(--gold-ink), var(--gold), #c9b58f, var(--gold-ink)); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.hero p.lead { font-size: 1.15rem; max-width: 620px; color: var(--muted); }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.floaters { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.floaters span { border: 1px solid rgba(148, 129, 105, .35); position: absolute; padding: 6px 12px; border-radius: 10px; font: 600 .85rem "Space Grotesk", sans-serif; opacity: .9; animation: float 9s ease-in-out infinite; color: #1b1a2e; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-22px) rotate(3deg); } }
@media (max-width: 700px) { .floaters span:nth-child(n+4) { display: none; } .floaters span { opacity: .35; } }

/* Sections and cards */
section { padding: 40px 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.hover { transition: transform .2s ease, box-shadow .2s ease; }
.card.hover:hover { transform: translateY(-4px) rotate(-.3deg); }
.day-card { position: relative; overflow: hidden; color: inherit; text-decoration: none; display: block; }
.day-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--c); }
.day-card .big { font: 700 3rem "Space Grotesk", sans-serif; color: var(--c); line-height: 1; }
.icon-dot { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: var(--surface-2); margin-bottom: 10px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.pts { display: inline-block; min-width: 46px; text-align: center; padding: 3px 10px; border-radius: 999px; font: 700 .95rem "Space Grotesk", sans-serif; }
.pts.plus { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pts.zero { background: var(--surface-2); }
.pts.minus { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* Journey */
.journey { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; counter-reset: j; }
.stop { position: relative; display: block; padding: 16px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); text-decoration: none; color: inherit; transition: transform .2s, border-color .2s; }
.stop:hover { transform: translateY(-3px); border-color: var(--c); }
.stop .num { font: 700 1.6rem "Space Grotesk", sans-serif; color: var(--c); }
.stop .bar { height: 6px; border-radius: 6px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.stop .bar i { display: block; height: 100%; width: 0; background: var(--c); transition: width .8s ease; }

/* Lab tabs */
.day-hero { padding: 40px 0 16px; }
.day-hero .tag { color: var(--c); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.tabs { position: sticky; top: 64px; z-index: 20; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 16px; font: 700 .95rem "Space Grotesk", sans-serif; cursor: pointer; min-height: 44px; }
.tab[aria-selected="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.tab .done-mark { margin-left: 4px; }

.lab { animation: pop .45s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.lab-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 12px 0 18px; }
.lab-head h2 { margin: 0; }
.lab-head .num { color: var(--c); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.intro { border-left: 4px solid var(--c); padding: 10px 16px; background: var(--surface); border-radius: 0 12px 12px 0; }

@keyframes blink { 50% { opacity: .3; } }

.progress { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; margin: 8px 0 18px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c), var(--sun)); transition: width .5s cubic-bezier(.2, .9, .3, 1.2); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 16px; cursor: pointer; transition: border-color .2s, transform .2s, opacity .2s; }
.step:hover { transform: translateX(4px); }
.step .check { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--c); display: grid; place-items: center; font: 700 1rem "Space Grotesk", sans-serif; color: var(--c); background: transparent; transition: background .2s, transform .3s; flex-shrink: 0; }
.step.done { border-color: var(--c); }
.step.done .body { opacity: .65; }
.step.done .check { background: var(--c); color: #fff; transform: rotate(360deg); }
.step .body p { margin: 0; }
.prompt { display: block; margin-top: 10px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; font-family: ui-monospace, "Cascadia Code", monospace; font-size: .92rem; position: relative; padding-right: 76px; }
.prompt[dir="rtl"] { font-family: "Noto Naskh Arabic", "Segoe UI", sans-serif; font-size: 1.15rem; padding-right: 14px; padding-left: 76px; text-align: right; }
.copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 4px 10px; font: 600 .8rem "Inter", sans-serif; cursor: pointer; }
.prompt[dir="rtl"] .copy { right: auto; left: 8px; }

.callout { display: flex; gap: 14px; padding: 16px 18px; border-radius: 16px; margin-top: 16px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.callout .ic { font-size: 1.5rem; }
.callout p { margin: 0; }

/* Files */
.files { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.file .ext { flex: 0 0 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font: 700 .75rem "Space Grotesk", sans-serif; color: #fff; text-transform: uppercase; }
.ext.docx { background: #2b65d9; } .ext.xlsx { background: #1f8a4c; } .ext.pdf { background: #d64545; } .ext.png { background: #8a4cd9; } .ext.zip { background: #b07a12; }
.file .info { flex: 1; min-width: 140px; }
.file .name { font-weight: 700; font-size: .92rem; overflow-wrap: anywhere; }
.file .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* Forms */
.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .req { color: var(--d1); }
.field input, .field select, .field textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: 16px "Inter", sans-serif; transition: border-color .2s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 110px; resize: vertical; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.field .err { color: var(--bad); font-size: .88rem; margin-top: 4px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 16px; text-align: center; background: var(--surface); }
.drop.has { border-color: var(--ok); }
.notice { padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--sun) 25%, var(--surface)); font-size: .95rem; }
.hp { position: absolute; left: -9999px; }
.success { text-align: center; padding: 30px 10px; animation: pop .5s ease; }
.success .tick { width: 84px; height: 84px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2.6rem; margin: 0 auto 14px; animation: bounce .6s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes bounce { from { transform: scale(0); } }
details.handin { margin-top: 20px; }
details.handin > summary { list-style: none; cursor: pointer; }
details.handin > summary::-webkit-details-marker { display: none; }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 20, .7); display: flex; align-items: center; justify-content: center; padding: 12px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.viewer .box { background: var(--surface); color: var(--ink); width: min(1000px, 100%); height: min(90vh, 100%); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; animation: pop .3s ease; }
.viewer .bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.viewer .bar .title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .content { flex: 1; overflow: auto; background: var(--surface-2); padding: 12px; -webkit-overflow-scrolling: touch; }
.viewer .content img { display: block; margin: 0 auto; }
.viewer .content canvas { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; box-shadow: var(--shadow); background: #fff; }
.viewer .sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.viewer .sheet { background: #fff; color: #111; overflow: auto; }
.viewer .sheet table td, .viewer .sheet table th { border: 1px solid #ddd; padding: 6px 10px; white-space: nowrap; font-size: .9rem; }
.viewer .docx-wrapper { background: transparent !important; padding: 0 !important; }
.viewer .docx-wrapper > section.docx { max-width: 100%; box-shadow: var(--shadow); margin-bottom: 12px !important; }
.viewer .loading { padding: 40px; text-align: center; color: var(--muted); }

/* Footer */
footer { margin-top: 40px; padding: 30px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Confetti */
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 200; pointer-events: none; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* NIGSD logo */
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.hero-logo { width: clamp(180px, 24vw, 300px); height: auto; animation: float 9s ease-in-out infinite; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } .hero-logo { width: 150px; order: -1; } }
.foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.foot p { flex: 1; min-width: 220px; margin: 0; }
.logo-full { width: 120px; height: auto; }
/* Dark mode: turn the black lettering light while keeping the gold close to the original. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.hero-logo, .logo-full) { filter: invert(1) hue-rotate(180deg) brightness(1.15); } }
:root[data-theme="dark"] :is(.hero-logo, .logo-full) { filter: invert(1) hue-rotate(180deg) brightness(1.15); }

/* Teams */
.team-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.code-box { text-align: center; padding: 12px 18px; border-radius: 16px; background: var(--surface-2); border: 2px dashed var(--gold); }
.code { font: 700 2.2rem "Space Grotesk", monospace; letter-spacing: .18em; color: var(--gold-ink); }
.members { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.member { padding: 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; animation: pop .4s ease; }
.member .role { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-ink); font-weight: 700; }
.member.empty strong { color: var(--muted); font-weight: 600; font-style: italic; }
.lab-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-pill { padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); text-decoration: none; color: var(--ink); font: 700 .9rem "Space Grotesk", sans-serif; }
.lab-pill.done { background: var(--gold); border-color: var(--gold); color: #fff; }
.err { color: var(--bad); }

/* Done button */
.done-box { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 20px; padding: 20px; border-radius: 18px; border: 2px dashed var(--gold); background: var(--surface); }
.done-box p { margin: 0; }
.done-box.is-done { border-style: solid; background: color-mix(in srgb, var(--gold) 14%, var(--surface)); animation: pop .45s ease; }
.done-box.is-done > div:nth-child(2) { flex: 1; }
.big-tick { width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-size: 1.8rem; animation: bounce .6s cubic-bezier(.2, .9, .3, 1.5); }
.btn.big { padding: 16px 28px; font-size: 1.1rem; }
.stop.done { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.stop.done::after { content: "✓ Done"; position: absolute; top: 12px; right: 12px; font: 700 .8rem "Space Grotesk", sans-serif; color: #fff; background: var(--gold); padding: 2px 8px; border-radius: 999px; }
.step { cursor: default; }
.step:hover { transform: none; }

.hello { font-size: 1.15rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.linkish { border: 0; background: none; color: var(--gold-ink); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; padding: 0; }
.who { display: flex; flex-wrap: wrap; gap: 8px; }

/* Locked until the student joins a team */
.locked { opacity: .6; }
.nav a.locked { opacity: .55; }
