/* YYLearn shared base styles — ported verbatim from yylearn-template/project/YYLearn.html.
   Theme tokens are overridden per-theme by components/themes.jsx via applyTheme(). */

:root {
  /* Base tokens — overridden by themes in themes.jsx */
  --bg: #f6f2ea;
  --bg-alt: #efe8dc;
  --surface: #fbf8f2;
  --ink: #1f1b16;
  --ink-2: #3a332a;
  --ink-3: #6c6258;
  --ink-4: #a89e90;
  --line: #e3dccf;
  --line-2: #cfc6b6;
  --accent: #8a1919;    /* cinnabar — seal red */
  --accent-2: #c9a86a;  /* gold */
  --accent-soft: #f3ead6;
  --ok: #3d7a4f;
  --warn: #b8740f;
  --err: #a42c2c;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 18px;
  --font-serif: 'Noto Serif SC', 'Noto Serif JP', 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', 'Noto Sans SC', 'Noto Sans KR', 'Noto Sans Thai', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* shared primitives */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  font-weight: 500; font-size: 14px;
  transition: all 0.15s ease;
  cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-2); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--bg-alt); border-color: var(--ink-3); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-alt); color: var(--ink-2);
  border: 1px solid var(--line);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}

/* Seal red stamp */
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: var(--accent);
  color: #fff7ea;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  border-radius: 4px;
  letter-spacing: -1px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  position: relative;
}
.seal::after {
  content: ''; position: absolute; inset: 3px;
  border: 1.5px solid rgba(255,247,234,0.3);
  border-radius: 2px;
}

/* Placeholder image (striped) */
.ph {
  position: relative; overflow: hidden;
  background: repeating-linear-gradient(
    45deg,
    var(--bg-alt), var(--bg-alt) 8px,
    var(--surface) 8px, var(--surface) 16px
  );
  color: var(--ink-4);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* Channel hero — hide the webkit scrollbar on the cover-thumbnail
   filmstrip so the strip looks clean even when it overflows horizontally
   on narrow viewports. (Firefox handles this with `scrollbar-width: none`
   set inline.) */
.ch-hero-strip::-webkit-scrollbar { display: none; }

/* ---------- Header / Primary Nav layout ----------------------------------
   Long English channel labels used to wrap onto a second row, breaking the
   header. Force the nav to a single row, but DO NOT clip overflow on the
   <nav> itself — that would hide the language / theme dropdown panels which
   render as absolute-positioned children of the nav. Only the channel-button
   strip needs its own horizontal scroll.                                   */
nav {
  flex-wrap: nowrap !important;
  min-width: 0;
  max-width: 100vw;
  /* No overflow:hidden here — would clip dropdown menus from LangThemeMenu. */
}
nav > div { min-width: 0; }
.nav-links {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: visible; /* let any nested popovers escape vertically */
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
  flex: 1 1 0;
  white-space: nowrap;
  scroll-behavior: smooth;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links button { white-space: nowrap; flex-shrink: 0; }
.nav-links > div { flex-shrink: 0; }

/* Right-side controls — keep on one row, give the search box room to
   shrink before language/auth buttons start fighting for space. */
.nav-right {
  flex-wrap: nowrap !important;
  flex-shrink: 0;
  min-width: 0;
}
.nav-search {
  flex-shrink: 1;
  min-width: 0;
  max-width: 240px;
}
.nav-search-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1180px) {
  .nav-search-key { display: none; }
}
@media (max-width: 980px) {
  .nav-search-text { display: none; }
}
@media (max-width: 760px) {
  .nav-search { display: none !important; }
}
