/* ============ AI Basics — learn.gmora.dev shared styles ============ */
:root {
  --bg: #0b1020;
  --bg-soft: #10172c;
  --panel: #151d36;
  --panel-2: #1b2444;
  --line: #2a3560;
  --text: #e8ecf8;
  --muted: #9aa7cc;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --grad: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Noto Sans Sinhala', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, canvas { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Sinhala needs a touch more line-height to avoid clipped diacritics */
html[data-lang="si"] body { line-height: 1.85; }

/* ---- language visibility ---- */
html[data-lang="en"] .lang-si { display: none !important; }
html[data-lang="si"] .lang-en { display: none !important; }

/* ---------------- header / nav ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 16, 32, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: .65rem 1rem;
  display: flex; align-items: center; gap: .75rem;
}
.brand {
  font-weight: 800; font-size: 1.05rem; letter-spacing: .02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.main-nav a {
  color: var(--muted); font-size: .92rem; font-weight: 600;
  padding: .35rem .65rem; border-radius: 999px;
}
.main-nav a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.main-nav a.active { color: #06121a; background: var(--cyan); }
.lang-toggle {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-family: var(--font); font-weight: 700; font-size: .85rem;
  padding: .35rem .8rem; border-radius: 999px; cursor: pointer;
  transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--cyan); }

/* hamburger on small screens */
.nav-burger { display: none; margin-left: auto; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; padding: .25rem .5rem; }
@media (max-width: 720px) {
  .nav-burger { display: block; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .7rem .65rem; border-radius: 10px; }
  .main-nav .lang-toggle { margin-top: .5rem; }
}

/* ---------------- layout ---------------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.section { padding: 3rem 0; }
.section-tight { padding: 1.75rem 0; }

h1 { font-size: clamp(1.7rem, 5vw, 2.8rem); font-weight: 800; line-height: 1.25; }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.9rem); font-weight: 800; margin-bottom: 1rem; }
h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: .5rem; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); }

.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: .5rem;
}

/* ---------------- cards ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow);
}
.card-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .card-grid.cols-2 { grid-template-columns: 1fr 1fr; } .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.nav-card { transition: transform .2s, border-color .2s; position: relative; overflow: hidden; }
.nav-card:hover { transform: translateY(-4px); border-color: var(--cyan); text-decoration: none; }
.nav-card .emoji { font-size: 2rem; margin-bottom: .5rem; }
.nav-card h3 { color: var(--text); }
.nav-card p { color: var(--muted); font-size: .92rem; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-block; font-weight: 700; font-family: var(--font); font-size: .95rem;
  padding: .7rem 1.4rem; border-radius: 999px; border: 0; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary { background: var(--grad); color: #0b1020; box-shadow: 0 6px 20px rgba(34, 211, 238, .3); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--cyan); }

/* ---------------- tables ---------------- */
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .93rem; }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel-2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .02); }

/* ---------------- misc components ---------------- */
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 800; letter-spacing: .03em;
}
.badge-good { background: rgba(52, 211, 153, .15); color: var(--green); }
.badge-bad { background: rgba(251, 113, 133, .15); color: var(--red); }
.badge-cyan { background: rgba(34, 211, 238, .15); color: var(--cyan); }
.badge-violet { background: rgba(167, 139, 250, .18); color: var(--violet); }
.badge-amber { background: rgba(251, 191, 36, .15); color: var(--amber); }

.callout {
  border-left: 4px solid var(--cyan); background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.2rem; margin: 1.2rem 0;
}
.callout.violet { border-left-color: var(--violet); }
.callout.amber { border-left-color: var(--amber); }
.callout.green { border-left-color: var(--green); }

.checklist { list-style: none; }
.checklist li { padding-left: 1.8rem; position: relative; margin: .45rem 0; }
.checklist li::before { content: "✅"; position: absolute; left: 0; }
.checklist.crosses li::before { content: "❌"; }

details.acc { border: 1px solid var(--line); border-radius: 12px; margin: .6rem 0; background: var(--panel); overflow: hidden; }
details.acc summary { cursor: pointer; font-weight: 700; padding: .9rem 1.1rem; list-style: none; position: relative; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "＋"; position: absolute; right: 1rem; color: var(--cyan); font-weight: 800; }
details.acc[open] summary::after { content: "－"; }
details.acc .acc-body { padding: 0 1.1rem 1.1rem; }

/* form-like worksheet fields */
.field-label { font-weight: 700; font-size: .9rem; margin: 1rem 0 .3rem; display: block; }
.field-box {
  width: 100%; min-height: 70px; background: var(--bg-soft); color: var(--text);
  border: 1px dashed var(--line); border-radius: 10px; padding: .7rem .9rem;
  font-family: var(--font); font-size: .95rem; resize: vertical;
}
.field-box:focus { outline: 2px solid var(--cyan); border-style: solid; }

/* 3D scene containers */
.scene-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.scene-hint {
  position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%);
  font-size: .75rem; color: var(--muted); background: rgba(11, 16, 32, .7);
  padding: .2rem .8rem; border-radius: 999px; pointer-events: none; white-space: nowrap;
}

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 3rem; margin-top: 3rem; color: var(--muted); font-size: .88rem; text-align: center; }

/* util */
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 2rem; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover, .nav-card:hover { transform: none; }
}
