/* ===== FONT FACES ===== */
@font-face {
  font-family: 'BebasNeue';
  src: url('/fonts/BebasNeue.woff2') format('woff2');
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter.woff2') format('woff2');
  font-display: swap;
  font-weight: 400 700;
}

/* ===== DARK MODE (default) ===== */
:root {
  --bg:          #0D0D0D;
  --bg2:         #161616;
  --bg3:         #1E1E1E;
  --surface:     #242424;
  --border:      #2E2E2E;
  --text:        #F5F0E8;
  --text2:       #C8C3BB;
  --muted:       #8A8680;
  --accent:      #7C3AED;
  --accent2:     #9F67FF;
  --accent-text: #ffffff;
  --gold:        #C9A84C;
  --gold2:       #E8C86A;
  --shadow:      0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);

  /* Ad */
  --ad-bg:       #161616;
  --ad-border:   #2E2E2E;
  --ad-label:    #8A8680;
}

/* ===== LIGHT MODE — full inversion of color scheme ===== */
:root[data-theme="light"] {
  --bg:          #F5F0E8;   /* dark bg → warm white */
  --bg2:         #EDE8DF;   /* dark card → light card */
  --bg3:         #E4DED4;
  --surface:     #D8D1C6;
  --border:      #C5BDB0;
  --text:        #0D0D0D;   /* light text → dark text */
  --text2:       #2A2825;
  --muted:       #6B6560;
  --accent:      #6D28D9;   /* slightly deeper for light bg contrast */
  --accent2:     #7C3AED;
  --accent-text: #ffffff;
  --gold:        #A0721E;
  --gold2:       #B8891F;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);

  --ad-bg:       #EDE8DF;
  --ad-border:   #C5BDB0;
  --ad-label:    #6B6560;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

img, svg { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--accent); color: #fff;
  padding: .5rem 1rem; border-radius: 8px;
  font-size: .875rem; z-index: 9999;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

/* ===== SR ONLY ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}

/* ===== NAV ===== */
nav.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.nav-logo {
  font-family: 'BebasNeue', 'Arial Narrow', sans-serif;
  font-size: 1.5rem;
  letter-spacing: .06em;
  color: var(--text);
  transition: color 0.25s ease;
}
.nav-logo span { color: var(--accent2); }

.nav-right {
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-links {
  display: none; gap: 1.5rem; list-style: none;
  font-size: .875rem; color: var(--muted);
}
.nav-links a { transition: color .15s; }
.nav-links a:hover { color: var(--text); }
@media(min-width: 640px) { .nav-links { display: flex; } }

/* Theme toggle button */
.theme-toggle {
  width: 38px; height: 22px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.25s ease;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), background 0.25s ease;
}
:root[data-theme="light"] .theme-toggle {
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-theme="light"] .theme-toggle::after {
  transform: translateX(16px);
  background: #fff;
}
.theme-toggle-wrap {
  display: flex; align-items: center; gap: .5rem;
  font-size: .75rem; color: var(--muted);
  white-space: nowrap;
}
.theme-icon { font-size: .9rem; line-height: 1; }

/* ===== HERO ===== */
.hero {
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 70%);
  pointer-events: none;
  transition: background 0.3s ease;
}

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .75rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  padding: .35rem .9rem; border-radius: 999px;
  margin-bottom: 1.25rem;
  transition: color 0.25s, border-color 0.25s;
}
.hero-eyebrow::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: var(--gold);
  flex-shrink: 0; transition: background 0.25s;
}

.hero-title {
  font-family: 'BebasNeue', 'Arial Narrow', sans-serif;
  font-size: clamp(3rem, 10vw, 8rem);
  line-height: .9;
  letter-spacing: -.01em;
  margin-bottom: 1rem;
  color: var(--text);
  transition: color 0.25s;
}
.hero-title .line2 { color: var(--accent2); }

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  transition: color 0.25s;
}

/* ===== INPUT ===== */
.input-wrap {
  position: relative;
  max-width: 660px;
  margin: 0 auto 1rem;
}
#user-input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 1.4rem;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background 0.25s, color 0.25s;
}
#user-input::placeholder { color: var(--muted); }
#user-input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.input-clear {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1.2rem; line-height: 1;
  transition: color .15s;
  display: none;
}
.input-clear.visible { display: block; }
.input-clear:hover { color: var(--text); }

/* ===== FILTER CHIPS ===== */
.filter-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center;
  max-width: 760px; margin: 0 auto 2.5rem;
}
.chip {
  padding: .35rem .9rem; border-radius: 999px;
  font-size: .8rem;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  transition: all .15s;
  white-space: nowrap;
}
.chip:hover, .chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== STATS ===== */
.stats-bar {
  display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap;
  margin-bottom: 2rem;
}
.stat { text-align: center; }
.stat-num {
  font-family: 'BebasNeue', 'Arial Narrow', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--accent2);
  display: block; line-height: 1;
  transition: color 0.25s;
}
.stat-label {
  font-size: .75rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  transition: color 0.25s;
}

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: .75rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1rem;
  display: flex; align-items: center; gap: .75rem;
  transition: color 0.25s;
}
.section-label::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border); transition: background 0.25s;
}

/* ===== FONT GRID ===== */
#font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 4rem;
  transition: background 0.25s, border-color 0.25s;
}

.font-card {
  background: var(--bg2);
  display: flex; align-items: center;
  gap: .75rem;
  padding: .85rem 1rem .85rem 1.25rem;
  transition: background .15s;
  cursor: pointer;
  min-height: 62px;
}
.font-card:hover { background: var(--surface); }

.font-preview {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.2;
  color: var(--text);
  flex: 1; min-width: 0;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: color 0.25s;
}
.font-name {
  font-size: .68rem; color: var(--muted);
  white-space: nowrap; font-family: 'Inter', system-ui, sans-serif;
  flex-shrink: 0; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
  transition: color 0.25s;
}
.copy-btn {
  background: var(--accent);
  color: #fff;
  font-size: .72rem; font-weight: 600;
  letter-spacing: .04em;
  padding: .32rem .85rem;
  border-radius: 6px;
  white-space: nowrap; flex-shrink: 0;
  transition: background .15s, transform .1s;
  user-select: none;
}
.font-card:hover .copy-btn { background: var(--accent2); }
.font-card:active .copy-btn { transform: scale(.95); }
.font-card.copied { background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); }
.font-card.copied .copy-btn { background: var(--gold); color: #000; }

.no-results {
  grid-column: 1 / -1; text-align: center;
  padding: 4rem 1rem; color: var(--muted); display: none;
}
.no-results.show { display: block; }

/* ===== HOW IT WORKS ===== */
.how-section { margin-bottom: 5rem; }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.step {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 1.5rem;
  transition: background 0.25s, border-color 0.25s;
}
.step-num {
  font-family: 'BebasNeue', 'Arial Narrow', sans-serif;
  font-size: 2.5rem; color: var(--accent);
  line-height: 1; margin-bottom: .75rem;
  transition: color 0.25s;
}
.step h3 { font-size: 1rem; margin-bottom: .4rem; font-weight: 600; }
.step p { font-size: .875rem; color: var(--muted); line-height: 1.55; }

/* ===== CATEGORIES ===== */
.cat-section { margin-bottom: 5rem; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem; margin-top: 1.5rem;
}
.cat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.cat-card:hover {
  border-color: var(--accent2);
  background: var(--surface);
}
.cat-icon { font-size: 1.8rem; margin-bottom: .5rem; }
.cat-name { font-size: .8rem; color: var(--muted); transition: color 0.25s; }

/* ===== ADS ===== */
.ad-slot {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: var(--ad-bg);
  border: 1.5px dashed var(--ad-border);
  border-radius: 10px;
  overflow: hidden; contain: strict; box-sizing: border-box;
  transition: background 0.25s, border-color 0.25s;
}
.ad-label {
  font-size: .58rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ad-label);
  opacity: .5; pointer-events: none; user-select: none;
}
.ad-size-hint {
  font-size: .55rem; color: var(--ad-label);
  opacity: .3; pointer-events: none; user-select: none;
}
.ad-leaderboard {
  width: 728px; height: 90px; max-width: 100%;
  margin: 1.5rem auto;
}
@media(max-width: 767px) { .ad-leaderboard { width: 336px; height: 280px; } }

.ad-rectangle {
  width: 336px; height: 280px; max-width: 100%;
  margin: 0 auto;
}
.ad-horizontal {
  width: 728px; height: 90px; max-width: 100%;
  margin: 2.5rem auto;
}
@media(max-width: 767px) { .ad-horizontal { width: 320px; height: 100px; } }

.ad-infeed {
  grid-column: 1 / -1;
  width: 100%; height: 90px; contain: strict;
}
@media(max-width: 767px) { .ad-infeed { height: 250px; } }

.ad-sticky-bottom {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 50px; display: none;
  align-items: center; justify-content: center;
  background: var(--bg); border-top: 1px solid var(--border);
  z-index: 200; contain: layout style;
  transition: background 0.25s, border-color 0.25s;
}
.ad-sticky-bottom .ad-slot {
  width: 320px; height: 50px; border: none; background: transparent;
}
@media(max-width: 767px) {
  .ad-sticky-bottom { display: flex; }
  footer { padding-bottom: 58px; }
  #scroll-top { bottom: 4.5rem; }
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  transition: border-color 0.25s;
}
.footer-logo {
  font-family: 'BebasNeue', 'Arial Narrow', sans-serif;
  font-size: 1.2rem; color: var(--muted);
  transition: color 0.25s;
}
.footer-links {
  display: flex; gap: 1.5rem; font-size: .8rem;
  color: var(--muted); flex-wrap: wrap;
}
.footer-links a { transition: color .15s; }
.footer-links a:hover { color: var(--text); }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: .65rem 1.2rem;
  border-radius: 999px; font-size: .875rem; z-index: 1000;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background 0.25s, color 0.25s;
  pointer-events: none; white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ===== SCROLL TOP ===== */
#scroll-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, color .15s, background 0.25s;
  z-index: 99;
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { color: var(--text); }

/* ===== MAIN WRAPPER ===== */
main {
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  max-width: 1200px; margin: 0 auto;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ===== UNICODE CARD — same layout as font cards ===== */
#unicode-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)) !important;
  gap: 1px !important;
  background: var(--border) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  margin-bottom: 1rem !important;
}

.unicode-card {
  background: var(--bg2) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: .75rem !important;
  padding: .85rem 1rem .85rem 1.25rem !important;
  min-height: 62px !important;
  cursor: pointer !important;
  transition: background .15s !important;
}
.unicode-card:hover { background: var(--surface) !important; }

.unicode-text {
  flex: 1 !important;
  min-width: 0 !important;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem) !important;
  line-height: 1.2 !important;
  color: var(--text) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  font-family: inherit !important;
}

.unicode-meta { display: none !important; }
.random-badge { display: none !important; }

.unicode-copy-btn {
  background: var(--accent) !important;
  color: #fff !important;
  font-size: .72rem !important;
  font-weight: 600 !important;
  padding: .32rem .85rem !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: background .15s !important;
  user-select: none !important;
  font-family: var(--font-body) !important;
}
.unicode-card:hover .unicode-copy-btn { background: var(--accent2) !important; }
.unicode-card.copied .unicode-copy-btn { background: var(--gold) !important; color: #000 !important; }

.ad-infeed-inline {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  height: 90px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--ad-bg) !important;
  border: 1.5px dashed var(--ad-border) !important;
}
@media(max-width:767px){ .ad-infeed-inline { height: 250px !important; } }
