/*
 * global.css — JessicaAI Visual Identity
 *
 * Design language: Late-90s / early-2000s visual novel golden age,
 * updated to modern dark-mode sensibilities. Deep midnight-blue
 * backgrounds, icy cyan-blue accents, decorative serif headings —
 * the cold luminous quality of a winter VN title screen.
 *
 * USAGE: Link this file FIRST in every <head> so page-specific
 * <style> blocks can layer on top without fighting specificity.
 *
 * To retheme the entire site, edit the :root block below only.
 */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* — Backgrounds — */
  --c-bg:         #060a12;   /* Near-black with midnight-blue tint     */
  --c-surface:    #0c1624;   /* Base surface (cards, sidebars)         */
  --c-raised:     #131f35;   /* Raised panels, modals                  */
  --c-elevated:   #1b2b47;   /* Hover / active surface lift            */
  --c-overlay:    rgba(4, 7, 14, 0.88);  /* Modal backdrop             */

  /* — Borders — */
  --c-border:      #1e3252;  /* Subtle blue divider                    */
  --c-border-hi:   #2e4f80;  /* Highlighted border (focus, hover)      */
  --c-border-glow: #38bdf840; /* Ice-blue glow for active states       */

  /* — Accent — icy blue / frost — */
  --c-accent:      #38bdf8;  /* Primary interactive colour             */
  --c-accent-hi:   #7dd3fc;  /* Hover / lighter frost variant          */
  --c-accent-dk:   #0284c7;  /* Pressed / deeper ocean variant         */
  --c-accent-soft: #38bdf815; /* Translucent accent for badges, tags  */

  /* — Text — */
  --c-text:        #dbeafe;  /* Primary body copy — pale icy white     */
  --c-text-muted:  #6b9ac4;  /* Secondary / metadata                   */
  --c-text-faint:  #334d6e;  /* Placeholder, disabled                  */
  --c-text-inv:    #060a12;  /* Text on accent backgrounds             */

  /* — Status — */
  --c-error:       #f87171;
  --c-error-bg:    #2a1010;
  --c-error-border: #7a2020;
  --c-success:     #4ade80;
  --c-warn:        #fbbf24;

  /* — Typography — */
  --font-body:     'Inter', system-ui, -apple-system, sans-serif;
  --font-display:  Georgia, 'Palatino Linotype', Palatino, serif;
  --font-mono:     ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

  /* — Radius — */
  --r-sm:  4px;
  --r:     7px;
  --r-lg:  12px;
  --r-xl:  18px;
  --r-pill: 999px;

  /* — Transitions — */
  --t-fast: 0.12s ease;
  --t:      0.2s ease;

  /* — Shadows — */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.5);
  --shadow:     0 4px 16px rgba(0,0,0,0.55);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.7);
  --shadow-accent: 0 0 18px rgba(56, 189, 248, 0.28);
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  text-align: center;
  padding: 1.5rem 0 2rem;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.page-number-set {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 2.35rem;
  min-height: 2.35rem;
  padding: 0 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: var(--c-raised);
  color: var(--c-text-muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--c-elevated);
  border-color: var(--c-border-hi);
  color: var(--c-text);
}

.page-btn.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-text-inv);
  font-weight: 700;
}

.page-btn:disabled {
  cursor: default;
  opacity: 0.52;
}

.page-edge {
  min-width: 4.6rem;
}

.page-ellipsis {
  min-width: 1.2rem;
  color: var(--c-text-faint);
  text-align: center;
}

.pagination-info {
  color: var(--c-text-faint);
  font-size: 0.8rem;
  margin: 0.55rem 0 0;
}

@media (max-width: 560px) {
  .pagination-controls {
    gap: 0.3rem;
  }

  .page-edge {
    min-width: 3.8rem;
  }

  .page-btn {
    min-width: 2.15rem;
    min-height: 2.15rem;
    padding: 0 0.55rem;
    font-size: 0.8rem;
  }
}

/* ============================================================
   RESETS & BASE
   ============================================================ */

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

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--c-accent-hi);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--c-accent);
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
  margin: 0 0 0.5em;
}

img { max-width: 100%; }

pre, code, kbd {
  font-family: var(--font-mono);
}

::selection {
  background: var(--c-accent);
  color: var(--c-text-inv);
}

/* ============================================================
   FORM ELEMENTS — shared input / select / textarea baseline
   ============================================================ */

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-border-glow);
}

input::placeholder,
textarea::placeholder {
  color: var(--c-text-faint);
}

/* ============================================================
   SHARED BUTTON CLASSES
   Pages that reference .btn, .btn-primary, .btn-ghost will
   pick up the VN palette automatically.
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.48rem 1.15rem;
  border-radius: var(--r);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  white-space: nowrap;
}

.btn:hover  { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: none; }

.btn-primary {
  background: var(--c-accent);
  color: #fff;
  border: none;
}
.btn-primary:hover {
  background: var(--c-accent-hi);
  box-shadow: var(--shadow-accent);
}
.btn-primary:active { background: var(--c-accent-dk); }

.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover {
  color: var(--c-text);
  border-color: var(--c-border-hi);
  background: var(--c-elevated);
}

.btn-danger {
  background: transparent;
  color: var(--c-error);
  border: 1px solid var(--c-error-border);
}
.btn-danger:hover {
  background: var(--c-error-bg);
}

/* ============================================================
   TAG PILLS
   ============================================================ */

.tag-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  background: var(--c-accent-soft);
  color: var(--c-accent-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.tag-pill:hover {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.tag-pill.active {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.tag-count {
  font-size: 0.72rem;
  opacity: 0.75;
}

/* ============================================================
   CONTENT TIER BADGES
   ============================================================ */

.tier-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tier-sfw      { background: #1a3a1a; color: #4ade80; }
.tier-nsfw     { background: #3a2a10; color: #fbbf24; }
.tier-explicit { background: #3a1010; color: #f87171; }

/* ============================================================
   CARDS — shared card shell
   ============================================================ */

.card {
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card:hover {
  border-color: var(--c-border-hi);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* ============================================================
   NAV TOPBAR
   Used by most browse/editor pages via nav.js injection.
   ============================================================ */

.vn-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(6, 10, 18, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.vn-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.vn-brand:hover { color: var(--c-accent-hi); text-decoration: none; }
.vn-brand span  { color: var(--c-accent); }

/* ============================================================
   ALERT BOXES
   ============================================================ */

.alert-error {
  background: var(--c-error-bg);
  border: 1px solid var(--c-error-border);
  border-radius: var(--r);
  color: var(--c-error);
  padding: 0.5rem 0.8rem;
  font-size: 0.875rem;
}

/* ============================================================
   SCROLLBAR (webkit)
   ============================================================ */

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--c-surface); }
::-webkit-scrollbar-thumb {
  background: var(--c-border-hi);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-accent); }

/* ============================================================
   UTILITY
   ============================================================ */

.text-muted    { color: var(--c-text-muted); }
.text-faint    { color: var(--c-text-faint); }
.text-accent   { color: var(--c-accent); }
.text-error    { color: var(--c-error); }
.text-success  { color: var(--c-success); }
.text-mono     { font-family: var(--font-mono); }

.divider {
  height: 1px;
  background: var(--c-border);
  margin: 0.5rem 0;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
