/* ───────────────────────────────────────────────────────────────────────────
   Padum Lessons hub — lesson.padum-diving.com

   Palette and layout follow padum_playground_web's hub (itself lifted from the
   production padum-diving.com theme): deep-ocean gradient, glass panel, coral
   accent. Type follows the lesson apps instead — Barlow Condensed over
   Poppins, Noto Sans Thai for Thai — self-hosted like the apps are, so the
   hub and the courses it opens read as one product and nothing loads from a
   third party.
   ─────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Barlow Condensed";
  font-weight: 600;
  font-display: swap;
  src: url(./fonts/barlow-condensed-600.woff2) format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/poppins-400.woff2) format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-weight: 500;
  font-display: swap;
  src: url(./fonts/poppins-500.woff2) format("woff2");
}
@font-face {
  font-family: "Noto Sans Thai";
  font-weight: 400 900;
  font-display: swap;
  src: url(./fonts/noto-sans-thai.woff2) format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

:root {
  color-scheme: dark;

  --padum-sea:    #346B8F;
  --padum-lagoon: #539DB8;
  --padum-sky:    #95D1EB;
  --padum-coral:  #D2564E;
  --padum-sun:    #FAC669;

  --surface-page-top:  #14375A;
  --surface-page-mid:  #0E2740;
  --surface-page-deep: #0A1E33;
  --surface-card: linear-gradient(180deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.045) 100%);

  --ink:       #FFFFFF;
  --ink-2:     #D3D6DA;
  --ink-muted: #A2AAB2;
  --hairline:  rgba(255,255,255,.14);

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-ui: "Poppins", "Noto Sans Thai", system-ui, sans-serif;
  --font-th: "Noto Sans Thai", "Poppins", system-ui, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 22px 46px rgba(4,14,26,.5), inset 0 1px 0 rgba(255,255,255,.16);
  --ring-focus: 0 0 0 3px rgba(83,157,184,.55);
  --ease-swell: cubic-bezier(.22,.61,.36,1);
  --dur-base: 200ms;
  --pad-x: clamp(18px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--surface-page-deep);
  background-image: linear-gradient(180deg,
    var(--surface-page-top) 0%,
    var(--surface-page-mid) 45%,
    var(--surface-page-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--padum-sky); text-decoration: none; }
a:hover { color: var(--ink); }
a:focus-visible { outline: none; box-shadow: var(--ring-focus); border-radius: var(--radius-sm); }

/* Thai stacks vowels and tone marks above and below the line: more leading,
   no wide tracking, no uppercase. */
[lang="th"] { font-family: var(--font-th); line-height: 1.75; letter-spacing: normal; text-transform: none; }

/* ─────────────────────────── masthead ─────────────────────────── */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 36px var(--pad-x) 24px;
  border-bottom: 1px solid var(--hairline);
}
.masthead__id { display: flex; align-items: flex-start; gap: 18px; }
/* The lesson apps' logo file is the mark on a white square; shown as a round
   badge, as the apps themselves show it. */
.brand { width: 72px; height: 72px; flex-shrink: 0; display: block; border-radius: 50%; }
.rule {
  display: block;
  width: 62px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--padum-coral);
  margin-bottom: 14px;
}
.masthead h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
}
.masthead h1 em { font-style: normal; color: var(--padum-coral); }
.masthead__sub { margin-top: 12px; max-width: 62ch; color: var(--ink-muted); font-size: 14px; }
.masthead__sub[lang="th"] { margin-top: 2px; }

.host-chip {
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink);
  background: var(--padum-sea);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

/* ─────────────────────────── layout ─────────────────────────── */

.shell {
  flex: 1;
  width: 100%;
  padding: 24px var(--pad-x) 48px;
}

.panel {
  background: var(--surface-card);
  backdrop-filter: saturate(130%) blur(14px);
  -webkit-backdrop-filter: saturate(130%) blur(14px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 20px;
}
.panel__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
}
.panel__title [lang="th"] { font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.panel__num {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  background: var(--padum-sea);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
}

/* ─────────────────────────── course card ─────────────────────────── */

.course {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 22px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color var(--dur-base) var(--ease-swell),
              background var(--dur-base) var(--ease-swell);
}
.course:hover { border-color: var(--padum-lagoon); background: rgba(83,157,184,.12); }

.course__cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0b3b57;
}
.course__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms var(--ease-swell);
}
.course:hover .course__cover img { transform: scale(1.03); }

.course__body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.course__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.course__name {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
}
.course__name a { color: inherit; }
.course__path { font-size: 12.5px; color: var(--padum-coral); }
.course__blurb { font-size: 14px; color: var(--ink-2); max-width: 70ch; }
.course__blurb[lang="th"] { color: var(--ink-muted); font-size: 13.5px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.status .dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--padum-sun); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

/* Chapter deep links: the lesson app routes on #/chN/slide. */
.chapters {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}
.chapters a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.3;
  transition: border-color var(--dur-base) var(--ease-swell), background var(--dur-base) var(--ease-swell);
}
.chapters a:hover { border-color: var(--padum-lagoon); background: rgba(83,157,184,.16); color: var(--ink); }
.chapters b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--padum-coral);
  min-width: 1ch;
}

.course__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 6px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--padum-coral);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: background var(--dur-base) var(--ease-swell);
}
.btn:hover { background: #BC463F; color: var(--ink); }
.btn [lang="th"] { font-size: 12.5px; opacity: .85; }

.more { margin-top: 16px; font-size: 13px; color: var(--ink-muted); }

/* ─────────────────────────── footer ─────────────────────────── */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 18px var(--pad-x) 26px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-muted);
}
.foot__id { display: inline-flex; align-items: center; gap: 10px; letter-spacing: .08em; text-transform: uppercase; }
.foot__id img { border-radius: 50%; }
.foot__ssi { display: inline-flex; align-items: center; gap: 10px; }
.foot__ssi img { height: 22px; width: auto; background: #fff; border-radius: 4px; padding: 3px 6px; }

/* ═══════════════════════════════════════════════════════════════════════
   Sign-in and staff console
   ═══════════════════════════════════════════════════════════════════════ */

[hidden] { display: none !important; }
small { font-size: .85em; color: var(--ink-muted); font-weight: 400; }

.shell > * + *,
section > .panel + .panel { margin-top: 16px; }

.page-narrow .shell { max-width: 560px; margin: 0 auto; }
.panel--narrow { max-width: 520px; }

/* compact masthead for inner pages */
.masthead--compact { padding-top: 18px; padding-bottom: 16px; align-items: center; }
.masthead--compact .masthead__id { align-items: center; gap: 14px; color: inherit; }
.masthead--compact .brand { width: 48px; height: 48px; }
.masthead__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
}
.masthead__title em { font-style: normal; color: var(--padum-coral); }

.masthead__nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.masthead__nav .who { font-size: 13px; color: var(--ink-2); }

.whoami { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }

.role-pill {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--padum-sea);
  color: var(--ink);
}
.role-pill--admin { background: var(--padum-coral); }

/* tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 var(--pad-x);
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
}
.tabs button {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 14px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--ink); border-bottom-color: var(--padum-coral); }
.tabs button:focus-visible { outline: none; box-shadow: var(--ring-focus); }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form--inline { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 14px; }
.form--inline .btn { margin-bottom: 1px; }
.field--wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span:first-child, .field > legend { font-size: 13px; color: var(--ink-2); padding: 0; }

input, select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(4, 14, 26, .45);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
  width: 100%;
}
select { padding-right: 28px; }
select option { background: #102A44; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--padum-lagoon); box-shadow: var(--ring-focus); }
input[type="date"] { color-scheme: dark; }
input[type="checkbox"] { width: auto; accent-color: var(--padum-coral); }
.form--inline .field { min-width: 200px; }

.input-code { font-size: 20px; letter-spacing: .12em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.input-row { display: flex; gap: 8px; align-items: center; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }

/* buttons (base .btn above) */
button.btn { border: 0; cursor: pointer; font-family: inherit; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--ghost { background: transparent; border: 1px solid rgba(255,255,255,.28) !important; color: var(--ink-2); }
.btn--ghost:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.btn--small { padding: 5px 12px; font-size: 11.5px; }
.btn--danger { background: transparent; border: 1px solid rgba(210,86,78,.7) !important; color: #F2A39D; }
.btn--danger:hover { background: rgba(210,86,78,.18); color: var(--ink); }

/* messages */
.notice { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid var(--hairline); }
.notice--error { background: rgba(210,86,78,.16); border-color: rgba(210,86,78,.5); color: #FFD3CF; }
.notice--info { background: rgba(83,157,184,.14); border-color: rgba(83,157,184,.45); color: var(--ink); }
.notice--success { background: rgba(12,163,12,.14); border-color: rgba(12,163,12,.45); color: #CFF5CF; }
.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.empty { margin: 12px 0 0; color: var(--ink-muted); font-size: 13.5px; }
.muted { color: var(--ink-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }

/* sign-in page */
.signin { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.signin__title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
}
.signin__lead { color: var(--ink-2); }
.signin__lead [lang="th"] { display: block; color: var(--ink-muted); font-size: 13.5px; }
.signin__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.signin .btn { align-self: flex-start; }
.staff-signin { border-top: 1px solid var(--hairline); padding-top: 14px; }
.staff-signin summary { cursor: pointer; font-size: 13.5px; color: var(--padum-sky); }
.staff-signin summary:hover { color: var(--ink); }
.staff-signin[open] summary { margin-bottom: 14px; }

/* generated code */
.codebox {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(250,198,105,.55);
  background: rgba(250,198,105,.08);
}
.codebox__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--padum-sun);
  user-select: all;
}
.codebox__meta { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--ink-2); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: middle; color: var(--ink-2); }
.table tr:hover td { background: rgba(255,255,255,.03); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn { margin-left: 6px; }
.table tr.is-muted td { color: var(--ink-muted); }
.table tr.is-problem td:nth-child(2) { color: #F2A39D; }
.table--log td { font-size: 13px; }
.who-kind { font-size: 11px; color: var(--ink-muted); }
.you { color: var(--ink-muted); font-family: var(--font-ui); }

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill--active { color: #9BE59B; border-color: rgba(12,163,12,.5); }
.pill--expired { color: var(--ink-muted); }
.pill--revoked { color: #F2A39D; border-color: rgba(210,86,78,.5); }

/* dialog */
.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  color: var(--ink-2);
  background: #102A44;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.dialog::backdrop { background: rgba(4, 14, 26, .7); }
.dialog__title { font-size: 17px; color: var(--ink); font-weight: 500; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* hub: courses need a code */
.course__lock { font-size: 12.5px; color: var(--ink-muted); }
.course__lock [lang="th"] { display: block; }

/* ─────────────────────────── small screens ─────────────────────────── */

@media (max-width: 720px) {
  .course { grid-template-columns: 1fr; }
  .masthead { align-items: flex-start; }
  .brand { width: 56px; height: 56px; }
  .masthead--compact { flex-wrap: wrap; }
  .masthead--compact .brand { width: 40px; height: 40px; }
  .table th, .table td { padding: 8px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
