/* ============ Site theme ============
   One look for every page. Loaded after style.css and after each page's own
   <style> rules in spirit: selectors start with `html body` so they win over
   page-level rules without !important. Pages keep their own layout; this file
   sets the shared surface: background, widths, cards, titles, buttons, focus,
   header and footer. */

:root {
  --th-bg: #f5f6fa;
  --th-surface: #ffffff;
  --th-border: #e6e8ef;
  --th-line: #eef0f4;
  --th-text: #0f172a;
  --th-body: #334155;
  --th-muted: #64748b;
  --th-primary: #4f46e5;
  --th-primary-dark: #4338ca;
  --th-primary-soft: #eef2ff;
  --th-accent: #06b6d4;
  --th-radius: 14px;
  --th-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --th-shadow-lift: 0 10px 28px rgba(15, 23, 42, .09);
  --th-page: 1200px;
}

/* ---- Surface ---- */
html body {
  background-color: var(--th-bg);
  color: var(--th-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
html body.app {
  background-image: radial-gradient(1100px 380px at 50% -160px, rgba(79, 70, 229, .07), transparent 70%);
  background-repeat: no-repeat;
}
html body.lp { background-color: #fff; }
::selection { background: #c7d2fe; color: #1e1b4b; }
html { scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: #cbd5e1; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- One page width and rhythm ---- */
html body .db, html body .vd, html body .sm, html body .tp, html body .lg, html body .pv, html body .fd, html body .sv,
html body .up-page, html body .container.st-skin, html body .th-page {
  width: auto; max-width: var(--th-page); margin: 28px auto 56px; padding-left: 20px; padding-right: 20px; box-sizing: border-box;
}
html body .lg, html body .container.st-skin { padding-top: 0; padding-bottom: 0; }
html body header.hd .hd-in { max-width: var(--th-page); padding: 0 20px; }

/* ---- Page titles ---- */
html body .db-hero h1, html body .vd-head h1, html body .sm-head h1, html body .tp-head h1, html body .lg-head h1,
html body .up-head h1, html body .st-skin .st-title h1, html body .pv-head h1, html body .fd-head h1, html body .sv-head h1, html body .th-page h1 {
  color: var(--th-text); font-size: 1.5rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.25;
}
html body .vd-head p, html body .sm-head p, html body .tp-head p, html body .lg-head p, html body .up-head p,
html body .st-skin .st-title p, html body .pv-head p, html body .fd-head p, html body .sv-head p {
  color: var(--th-muted); font-size: .9rem;
}

/* ---- Cards ---- */
html body .db-card, html body .db-hero, html body .vd-card, html body .sm-card, html body .lg-card, html body .sv-card,
html body .st-skin .ft-card, html body .st-skin .left-inner-tab-panel, html body .st-skin fieldset, html body .up-plan, html body .th-card {
  border-color: var(--th-border); border-radius: var(--th-radius); box-shadow: var(--th-shadow);
}
html body .st-skin fieldset fieldset { box-shadow: none; }
html body .db-hero {
  background: linear-gradient(120deg, #fff 55%, #f5f3ff 100%);
}
html body .db-bucket, html body .db-stage { border-color: var(--th-border); }
html body .db-bucket:hover, html body .db-stage:hover { box-shadow: var(--th-shadow-lift); }

/* ---- Buttons ---- */
html body .db-btn.light, html body .lp-btn-primary, html body .vd-btn.primary, html body .sm-btn.primary, html body .tp-btn.primary,
html body .fd-btn.primary, html body .sv-btn.primary, html body .pv-btn.primary, html body .ax-btn-primary, html body .th-btn {
  border-color: transparent;
  background: linear-gradient(180deg, #5b54ec 0%, var(--th-primary) 100%);
  box-shadow: 0 1px 2px rgba(49, 46, 129, .25), inset 0 1px 0 rgba(255, 255, 255, .14);
  color: #fff;
  transition: filter .15s ease, box-shadow .15s ease, transform .05s ease;
}
html body .db-btn.light:hover, html body .lp-btn-primary:hover, html body .vd-btn.primary:hover, html body .sm-btn.primary:hover,
html body .tp-btn.primary:hover, html body .fd-btn.primary:hover, html body .sv-btn.primary:hover, html body .pv-btn.primary:hover,
html body .ax-btn-primary:hover, html body .th-btn:hover {
  background: linear-gradient(180deg, #5b54ec 0%, var(--th-primary) 100%);
  filter: brightness(1.07);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .28), inset 0 1px 0 rgba(255, 255, 255, .14);
}
html body .db-btn.light:active, html body .lp-btn-primary:active, html body .th-btn:active { transform: translateY(1px); }
.th-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border: 1px solid transparent;
          border-radius: 9px; font: inherit; font-size: .86rem; font-weight: 500; text-decoration: none; cursor: pointer; }

/* ---- Focus: one visible ring everywhere ---- */
html body a:focus-visible, html body button:focus-visible, html body [role="tab"]:focus-visible, html body summary:focus-visible {
  outline: 2px solid var(--th-primary); outline-offset: 2px; border-radius: 6px;
}
html body input:focus-visible, html body select:focus-visible, html body textarea:focus-visible {
  outline: 2px solid var(--th-primary-soft); border-color: var(--th-primary);
}

/* ---- Header ---- */
html body header.hd {
  border-bottom: 1px solid rgba(15, 23, 42, .07);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02), 0 6px 24px -18px rgba(15, 23, 42, .35);
}
html body header.hd .hd-link { font-weight: 500; letter-spacing: -.005em; }
html body header.hd .hd-link.active { background: var(--th-primary-soft); color: var(--th-primary); box-shadow: inset 0 0 0 1px #e0e7ff; }
html body header.hd .hd-menu, html body .notification-panel { border-color: var(--th-border); border-radius: var(--th-radius); box-shadow: 0 18px 40px rgba(15, 23, 42, .14); }
html body .notification-panel { overflow: hidden; }
html body .notification-panel-header { background: #fff; }

/* ---- Footer ---- */
html body.app:has(> .th-foot) { position: relative; min-height: 100vh; padding-bottom: 76px; box-sizing: border-box; }
.th-foot { border-top: 1px solid var(--th-border); background: rgba(255, 255, 255, .7); color: var(--th-muted); font-family: 'Poppins', system-ui, sans-serif; font-size: .82rem; }
body.app > .th-foot { position: absolute; left: 0; right: 0; bottom: 0; }
.th-foot-in { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; max-width: var(--th-page); min-height: 56px; margin: 0 auto; padding: 10px 20px; box-sizing: border-box; }
.th-foot-brand { display: inline; }
.th-foot-brand b { color: var(--th-text); font-weight: 600; }
.th-foot-links { display: inline-flex; gap: 20px; flex-wrap: wrap; }
.th-foot-links a { color: var(--th-muted); text-decoration: none; }
.th-foot-links a:hover { color: var(--th-primary); }
@media (max-width: 640px) {
  html body.app:has(> .th-foot) { padding-bottom: 104px; }
  .th-foot-in { flex-direction: column; justify-content: center; text-align: center; }
  html body .db, html body .vd, html body .sm, html body .tp, html body .lg, html body .pv, html body .fd, html body .sv,
  html body .up-page, html body .container.st-skin, html body .th-page { margin-top: 18px; padding-left: 14px; padding-right: 14px; }
}
/* Sign-in pages and public pages: the footer simply follows the content. */
body.ax .th-foot { width: 100%; margin-top: 28px; border-top: 0; background: none; }
body.ax .th-foot-in { justify-content: center; }
body.lp .th-foot { background: #fff; }

/* ---- Thumbnail templates page (templates/thumbs/selection.html) ---- */
.th-page .th-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.th-page .th-head h1 { margin: 0 0 2px; }
.th-page .th-head p { margin: 0; color: var(--th-muted); font-size: .9rem; }
.th-page .headline-text { margin: 26px 0 12px; padding: 0; border: 0; color: var(--th-text); font-size: 1rem; font-weight: 600; }
.th-page .thumb-selection-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.th-page .thumb-selection-card { width: auto; margin: 0; overflow: hidden; border: 1px solid var(--th-border); border-radius: var(--th-radius); background: #fff; box-shadow: var(--th-shadow); transition: box-shadow .15s ease, transform .15s ease; }
.th-page .thumb-selection-card:hover { transform: translateY(-2px); box-shadow: var(--th-shadow-lift); }
.th-page .thumb-selection-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #f1f5f9; }
.th-page .thumb-selection-info { padding: 10px 14px 4px; }
.th-page .thumb-selection-name { color: var(--th-text); font-size: .9rem; font-weight: 600; }
.th-page .thumb-selection-bottom { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 14px 14px; }
.th-page .thumb-selection-bottom > * { padding: 6px 12px; border: 1px solid var(--th-border); border-radius: 8px; background: #fff; color: var(--th-text); font-size: .8rem; font-weight: 500; text-decoration: none; cursor: pointer; }
.th-page .thumb-selection-bottom > *:hover { border-color: var(--th-primary); color: var(--th-primary); }
.th-page .thumb-selection-bottom .thumb-delete-button:hover { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.th-page .no-templates-message { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--th-border); border-radius: var(--th-radius); background: #fff; color: var(--th-muted); font-size: .9rem; text-align: center; }
.th-page .no-templates-message span { padding: 0; background: none; }

@media (prefers-reduced-motion: reduce) { html body * { scroll-behavior: auto; } }
