/* Shared shell: tokens, header, footer, buttons, cards. Every page extends templates/base.html. */
:root {
  --bg: #f3f7ff;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, #dbe8ff 0%, transparent 60%),
             radial-gradient(900px 400px at -10% 10%, #e6efff 0%, transparent 55%);
  --fg: #0f1b33;
  --card: #ffffff;
  --muted: #5b6b86;
  --line: #dbe4f3;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #e8f0ff;
  --accent-fg: #ffffff;
  --hero-1: #1e3a8a;
  --hero-2: #2563eb;
  --hero-3: #38bdf8;
  --ok: #0f9d58;
  --ok-soft: #e3f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 8px 24px rgba(37, 99, 235, .08);
  --shadow-hover: 0 2px 4px rgba(15, 27, 51, .06), 0 16px 40px rgba(37, 99, 235, .16);
}
/* Theme: js/theme.js sets data-theme="light"|"dark" on <html> when the visitor picks one; with "system" (or no JS) the OS preference decides. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1224;
    --bg-grad: radial-gradient(1200px 500px at 85% -10%, #13275a 0%, transparent 60%),
               radial-gradient(900px 400px at -10% 10%, #0f1f47 0%, transparent 55%);
    --fg: #e6edfb;
    --card: #111c33;
    --muted: #93a3c2;
    --line: #1f2d4d;
    --accent: #60a5fa;
    --accent-strong: #93c5fd;
    --accent-soft: #15284f;
    --accent-fg: #0a1224;
    --hero-1: #0b1d4d;
    --hero-2: #1d4ed8;
    --hero-3: #0ea5e9;
    --ok: #4ade80;
    --ok-soft: #0f2e22;
    --warn: #fbbf24;
    --warn-soft: #33260b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(37, 99, 235, .25);
  }
}
:root[data-theme="dark"] {
  --bg: #0a1224;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, #13275a 0%, transparent 60%),
             radial-gradient(900px 400px at -10% 10%, #0f1f47 0%, transparent 55%);
  --fg: #e6edfb;
  --card: #111c33;
  --muted: #93a3c2;
  --line: #1f2d4d;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #15284f;
  --accent-fg: #0a1224;
  --hero-1: #0b1d4d;
  --hero-2: #1d4ed8;
  --hero-3: #0ea5e9;
  --ok: #4ade80;
  --ok-soft: #0f2e22;
  --warn: #fbbf24;
  --warn-soft: #33260b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(37, 99, 235, .25);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--fg); text-decoration: none; font-size: 1.05rem; }
.logo { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--card), 0 4px 14px rgba(56, 189, 248, .45); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-size: .7rem; font-weight: 600; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--card) 70%, transparent); }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer-inner h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .8rem; }
.footer-inner p { margin: .5rem 0 0; font-size: .92rem; }
.footer-inner ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: .92rem; }
.footer-inner ul a { color: var(--fg); text-decoration: none; }
.footer-inner ul a:hover { color: var(--accent); }
.socials { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.social {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  color: var(--muted); background: var(--card); border: 1px solid var(--line); transition: color .15s, border-color .15s, transform .15s;
}
.social:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; }
.footer-bottom { max-width: 1400px; margin: 0 auto; padding: 1rem 1.25rem 2rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .85rem; color: var(--muted); }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; } }
.who { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted); }
.top-nav { display: flex; gap: .4rem; align-items: center; }
/* Account menu: a <details> dropdown, so it works without JavaScript (js/menu.js only adds closing it). */
.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .3rem; padding: .2rem .45rem .2rem .2rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); position: relative; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover, .acct[open] > summary { border-color: var(--accent); }
.acct > summary svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.acct[open] > summary svg { transform: rotate(180deg); }
.acct .dot { position: absolute; top: 2px; left: 26px; width: 9px; height: 9px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 2px var(--card); }
.acct-menu { position: absolute; right: 0; top: calc(100% + .45rem); z-index: 50; width: min(260px, calc(100vw - 1.5rem));
  display: grid; gap: .1rem; padding: .4rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16); }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; box-sizing: border-box; text-align: left;
  padding: .55rem .7rem; border-radius: 9px; border: 0; background: none; color: var(--fg); font: inherit; font-size: .95rem;
  text-decoration: none; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.acct-who { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; display: grid; }
.acct-who strong { color: var(--fg); }
.acct-who span { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu .sep { height: 1px; background: var(--line); margin: .25rem .3rem; }
.acct-menu .badge { margin-left: auto; min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: #dc2626; color: #fff;
  font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.25rem; }

/* Theme picker: a <details class="acct"> so menu.js closes it like the other header menus. */
.theme-pick > summary { padding: .2rem; width: 34px; height: 34px; justify-content: center; }
.theme-pick > summary svg { width: 18px; height: 18px; transform: none !important; color: var(--fg); }
.theme-pick .ico { display: none; }
:root[data-theme-pref="light"] .theme-pick .ico-light,
:root[data-theme-pref="dark"] .theme-pick .ico-dark,
:root:not([data-theme-pref="light"]):not([data-theme-pref="dark"]) .theme-pick .ico-system { display: block; }
.theme-pick .acct-menu { width: 170px; }
.theme-pick .acct-menu button svg { width: 16px; height: 16px; color: var(--muted); }
.theme-pick .acct-menu button[aria-pressed="true"] { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.theme-pick .acct-menu button[aria-pressed="true"] svg { color: var(--accent); }
.acct-nav { display: none; }
.acct-menu a[data-ico]::before { content: attr(data-ico); }  /* emoji for the menu; the header pills show none */
.burger { width: 18px; height: 18px; transform: none !important; }
.acct.guest { display: none; }
.acct.guest > summary { padding: .35rem .6rem; }
.pill-link.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
@media (max-width: 1100px) {
  .top-nav { display: none; }                  /* the links move into the menu */
  .acct-nav { display: grid; gap: .1rem; }
  .acct.guest { display: block; }
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.who .email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-link {
  white-space: nowrap;
  color: var(--fg); text-decoration: none; font-weight: 500;
  padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}
.pill-link:hover { border-color: var(--accent); color: var(--accent); }
.pill-link .badge { display: inline-block; min-width: 1.25rem; margin-left: .3rem; padding: 0 .35rem; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.25rem; }

main { max-width: 1400px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-fg); border: 0; border-radius: 10px; padding: .7rem 1.2rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .3); transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37, 99, 235, .35); }
.btn:focus-visible, .pill-link:focus-visible, .course:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--fg); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.muted { color: var(--muted); }
.msg {
  padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
form.inline { display: inline; margin: 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow); }
.narrow { max-width: 440px; margin: 3rem auto; text-align: center; }
.icon-badge {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.icon-badge.warn { background: var(--warn-soft); color: var(--warn); }

@media (max-width: 560px) {
  main { padding-top: 1.25rem; }
  .topbar-inner { padding: .6rem .9rem; gap: .5rem; }
  .brand-text small { display: none; }
}

/* "Notify me when the next batch opens" form (templates/courses/_notify_form.html) */
.notify { display: grid; gap: .5rem; margin: .25rem 0 .5rem; }
.notify input[type=email] { width: 100%; font: inherit; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.notify-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tamil text: mark it lang="ta" and add this class so it uses a Tamil font. */
.ta { font-family: "Noto Sans Tamil", Inter, system-ui, sans-serif; }

/* Small layout helpers used by templates instead of inline style attributes. */
.m0 { margin: 0; }
.mt0 { margin-top: 0; }
.mt-04 { margin-top: .4rem; }
.mt-05 { margin-top: .5rem; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.jc-center { justify-content: center; }
.w-6 { width: 6rem; }
.w-46 { max-width: 46rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }  /* spam-trap field, hidden from people */
