/* ================================================================
   FontDrop — main.css
   Global: variables, reset, base, header, footer, utilities
   ================================================================ */

/* ── 1. Design Tokens (CSS Custom Properties) ── */
:root {
  /* Colors */
  --bg:            #ffffff;
  --surface:       #f6f7fb;
  --surface-alt:   #ededf5;
  --border:        rgba(0, 0, 0, 0.08);
  --text:          #111827;
  --text-soft:     #4b5563;
  --text-faint:    #9ca3af;
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-subtle: rgba(99, 102, 241, 0.1);
  --danger:        #ef4444;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Border radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --t: 150ms ease;

  /* Layout */
  --max-w:    1152px;
  --header-h: 56px;
}

/* Suppress all transitions during theme switch to avoid animation storm */
html.no-transition * { transition: none !important; }

/* Dark mode tokens */
html.dark {
  --bg:            #0f172a;
  --surface:       #1e293b;
  --surface-alt:   #0f172a;
  --border:        rgba(255, 255, 255, 0.07);
  --text:          #f1f5f9;
  --text-soft:     #94a3b8;
  --text-faint:    #475569;
  --accent:        #818cf8;
  --accent-hover:  #6366f1;
  --accent-subtle: rgba(129, 140, 248, 0.12);
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 4px 14px rgba(0, 0, 0, 0.4);
}

/* ── 2. Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--t), color var(--t);
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

/* ── 3. Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  transition: background var(--t), border-color var(--t);
}

.header-inner {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--text);
  flex-shrink: 0;
  user-select: none;
}

.site-logo img {
  width: 22px;
  height: 22px;
}

.logo-light { display: block; }
.logo-dark  { display: none;  }
html.dark .logo-light { display: none;  }
html.dark .logo-dark  { display: block; }

/* Desktop navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: var(--r-md);
  transition: color var(--t), background var(--t);
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface-alt);
}

.nav-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Header right actions */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* Generic icon button */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  color: var(--text-soft);
  flex-shrink: 0;
  transition: color var(--t), background var(--t);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Theme icon toggling */
.icon-sun  { display: none;  }
.icon-moon { display: block; }
html.dark .icon-sun  { display: block; }
html.dark .icon-moon { display: none;  }

/* Menu toggle — hidden on desktop */
.menu-btn { display: none; }

/* ── 4. Mobile navigation ── */
.mobile-nav {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: var(--sp-2) var(--sp-4);
  display: none;
  flex-direction: column;
  gap: 2px;
  transition: background var(--t);
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--sp-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: var(--r-md);
  transition: color var(--t), background var(--t);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--text);
  background: var(--surface-alt);
}

/* ── 5. Footer ── */
.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--sp-4);
  transition: background var(--t), border-color var(--t);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  font-size: 13px;
  color: var(--text-faint);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 16px;
}

.footer-nav a {
  transition: color var(--t);
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-dot {
  color: var(--border);
}

/* ── 6. Scroll-to-top button ── */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, background var(--t);
  cursor: pointer;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: var(--accent-hover);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
}

/* ── 7. Responsive breakpoints ── */
@media (max-width: 767px) {
  .header-nav { display: none; }
  .menu-btn   { display: flex; }
}

@media (min-width: 640px) {
  .header-inner { padding: 0 24px; }
  .footer-inner { padding: 0 24px; }
}

@media (min-width: 1024px) {
  .header-inner { padding: 0 32px; }
  .footer-inner { padding: 0 32px; }
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}
