/* ============================================================
   Hentai x Sub — main.css
   Shared design system loaded on every custom template.

   Contains only the chrome that is byte-identical across all
   original templates: tokens, reset, header, search overlay,
   Telegram CTA, section heading, footer and back-to-top, plus
   the shared header/nav responsive collapse.

   Page-specific pieces (poster grids, prose, contact cards,
   single-post styling) live in their own conditionally-loaded
   files. .site-footer intentionally has NO margin-top here —
   grid.css and content.css add the page-specific value.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:           #141414;
  --text:         #ededed;
  --muted:        #7a7a7a;
  --border:       #1f1f1f;
  --accent:       #2BEE34;
  --accent-hover: #59C749;
  --bg-card:      #1a1a1a;
  --btn-telegram: #229ED9;
  --btn-discord:  #5865F2;
}

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

/* !important + html,body beats theme rules like `body.home { background:#fff }` */
html, body {
  background:       var(--bg) !important;
  background-color: var(--bg) !important;
}

body {
  color:       var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a   { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: 1200px;
  margin:  0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position:      sticky;
  top:           0;
  z-index:       50;
  background:    var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  height:          64px;
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}

.site-name {
  font-size:      18px;
  font-weight:    600;
  letter-spacing: -0.02em;
}

/* Mobile header action buttons (hamburger + search) */
.header-actions {
  display:     none; /* hidden on desktop */
  align-items: center;
  gap:         8px;
}

.menu-btn {
  background:      none;
  border:          none;
  padding:         6px;
  border-radius:   6px;
  width:           38px;
  height:          38px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  cursor:          pointer;
  color:           var(--text);
  transition:      color 0.2s ease, background 0.2s ease;
  position:        relative;
}
.menu-btn:hover { color: var(--accent); background: rgba(43,238,52,0.08); }

/* Two SVG icons inside the button — toggled via .open */
.menu-btn .icon-hamburger,
.menu-btn .icon-close {
  width:      20px;
  height:     20px;
  position:   absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.menu-btn .icon-close          { opacity: 0; transform: rotate(-45deg) scale(0.7); }
.menu-btn.open .icon-hamburger { opacity: 0; transform: rotate(45deg) scale(0.7); }
.menu-btn.open .icon-close     { opacity: 1; transform: rotate(0deg) scale(1); }

/* Mobile search icon button — bare icon, no border box */
.search-btn-mobile {
  display:         none; /* hidden on desktop; shown in mobile media query */
  background:      none;
  border:          none;
  padding:         6px;
  border-radius:   6px;
  align-items:     center;
  justify-content: center;
  cursor:          pointer;
  color:           var(--text);
  flex-shrink:     0;
  transition:      color 0.2s ease, background 0.2s ease;
}
.search-btn-mobile:hover { color: var(--accent); background: rgba(43,238,52,0.08); }
.search-btn-mobile svg   { width: 20px; height: 20px; display: block; }

/* Desktop: inline horizontal nav */
.site-nav {
  display:        flex;
  flex-direction: row;
  align-items:    center;
  gap:            4px;
}
.site-nav a {
  padding:       10px 12px;
  border-radius: 6px;
  font-size:     14px;
  color:         var(--muted);
  transition:    color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--accent-hover); background: #1e1e1e; }

/* Search icon button (lives inside the menu) */
.search-btn {
  background:    none;
  border:        none;
  cursor:        pointer;
  color:         var(--muted);
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       10px 12px;
  border-radius: 6px;
  font:          inherit;
  transition:    color 0.15s ease, background 0.15s ease;
}
.search-btn:hover         { color: var(--accent-hover); background: #1e1e1e; }
.search-btn svg           { width: 18px; height: 18px; }
.search-btn .search-label { display: none; }

/* ---------- Search Overlay ---------- */
.search-overlay {
  position:        fixed;
  inset:           0;
  z-index:         100;
  display:         none;
  align-items:     flex-start;
  justify-content: center;
  padding-top:     120px;
  background:      rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.search-overlay.open { display: flex; }

.search-box {
  display:     flex;
  align-items: center;
  gap:         8px;
  width:       100%;
  max-width:   560px;
  padding:     0 24px;
}

.search-input {
  flex:          1;
  height:        48px;
  padding:       0 16px;
  background:    #2a2a2a;
  border:        1px solid #3a3a3a;
  border-radius: 8px;
  color:         var(--text);
  font-size:     16px;
  outline:       none;
  transition:    border-color 0.15s ease;
}
.search-input::placeholder { color: #666; }
.search-input:focus        { border-color: var(--accent); background: #2f2f2f; }

.search-submit {
  flex-shrink:   0;
  height:        48px;
  padding:       0 20px;
  background:    var(--accent);
  color:         #0a0a0a;
  border:        none;
  border-radius: 8px;
  font-size:     14px;
  font-weight:   700;
  cursor:        pointer;
  transition:    background 0.15s ease;
}
.search-submit:hover { background: var(--accent-hover); }

.search-close {
  flex-shrink:   0;
  width:         48px;
  height:        48px;
  background:    none;
  border:        1px solid var(--border);
  border-radius: 8px;
  color:         var(--muted);
  font-size:     22px;
  line-height:   1;
  cursor:        pointer;
  display:       flex;
  align-items:   center;
  justify-content: center;
  padding:       0;
  transition:    color 0.15s ease, border-color 0.15s ease;
}
.search-close:hover { color: var(--accent-hover); border-color: var(--accent-hover); }

/* ---------- "Join us" banner — header (Telegram + Discord) ---------- */
.telegram-banner {
  max-width:     900px;
  margin:        32px auto;
  padding:       2rem;
  border:        2px dashed var(--border);
  border-radius: 12px;
  text-align:    center;
  color:         #fff;
  background:    var(--bg-card);
}
.telegram-banner h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; color: #fff; }
.telegram-banner p  { margin-bottom: 1.5rem; color: var(--muted); }

/* Shared button row for both banners */
.banner-btns,
.request-btns {
  display:         flex;
  justify-content: center;
  gap:             1rem;
  flex-wrap:       wrap;
}

/* White pill buttons on the Join banner */
.btn-join {
  display:       inline-flex;
  align-items:   center;
  gap:           0.5rem;
  background:    #fff;
  color:         var(--btn-telegram);
  padding:       0.75rem 1.5rem;
  border-radius: 50px;
  font-weight:   700;
  transition:    transform 0.2s, box-shadow 0.2s;
}
.btn-join svg { width: 1.1em; height: 1.1em; }
.btn-join:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.btn-join.is-discord { color: var(--btn-discord); }

/* ---------- Request banner — footer (Telegram + Discord) ---------- */
.request-banner {
  max-width:     900px;
  margin:        48px auto;
  padding:       2rem;
  border:        2px dashed var(--border);
  border-radius: 12px;
  text-align:    center;
  background:    var(--bg-card);
}
.request-banner h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; color: #fff; }
.request-banner p  { margin-bottom: 1.5rem; color: var(--muted); }

.req-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           0.5rem;
  padding:       0.75rem 1.5rem;
  border-radius: 6px;
  font-weight:   600;
  color:         #fff;
  transition:    opacity 0.2s, transform 0.2s;
}
.req-btn svg { width: 1.1em; height: 1.1em; }
.req-btn:hover { opacity: 0.9; color: #fff; transform: translateY(-1px); }
.req-telegram { background: var(--btn-telegram); }
.req-discord  { background: var(--btn-discord); }

/* ---------- Section Heading ---------- */
.section-heading {
  font-size:      20px;
  font-weight:    700;
  letter-spacing: -0.01em;
  color:          var(--text);
  margin-bottom:  20px;
  padding-left:   12px;
  border-left:    3px solid var(--accent);
}

/* ---------- Footer ---------- */
/* Base footer — margin-top is added per template (grid.css / content.css). */
.site-footer {
  border-top: 1px solid var(--border);
  background: #111;
  padding:    56px 0 28px;
}

.footer-brand {
  display:        inline-block;
  font-size:      20px;
  font-weight:    700;
  letter-spacing: -0.02em;
  color:          var(--text);
  margin-bottom:  28px;
  transition:     color 0.15s ease;
}
.footer-brand:hover { color: var(--accent); }

.footer-contact-heading {
  font-size:      11px;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color:          var(--muted);
  margin-bottom:  14px;
}

.footer-contact-row {
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-wrap:       wrap;
  gap:             10px;
  margin-bottom:   40px;
}

.footer-email {
  display:       inline-flex;
  align-items:   center;
  gap:           7px;
  font-size:     14px;
  color:         var(--text);
  padding:       8px 16px;
  border:        1px solid var(--border);
  border-radius: 20px;
  background:    #181818;
  transition:    color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.footer-email svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.footer-email:hover {
  color:        var(--accent);
  border-color: rgba(43,238,52,0.4);
  background:   rgba(43,238,52,0.06);
}

.footer-tg-link {
  display:       inline-flex;
  align-items:   center;
  gap:           7px;
  font-size:     14px;
  color:         var(--muted);
  padding:       8px 16px;
  border:        1px solid var(--border);
  border-radius: 20px;
  background:    #181818;
  transition:    color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.footer-tg-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.footer-tg-link:hover {
  color:        var(--accent);
  border-color: rgba(43,238,52,0.4);
  background:   rgba(43,238,52,0.06);
}

.footer-divider {
  height:        1px;
  background:    var(--border);
  margin-bottom: 28px;
}

.footer-nav {
  display:         flex;
  flex-wrap:       wrap;
  align-items:     center;
  justify-content: center;
  gap:             2px;
  margin-bottom:   32px;
}
.footer-nav a {
  font-size:     13px;
  color:         var(--muted);
  padding:       5px 10px;
  border-radius: 6px;
  white-space:   nowrap;
  transition:    color 0.15s ease, background 0.15s ease;
}
.footer-nav a:hover { color: var(--accent-hover); background: rgba(43,238,52,0.07); }
.footer-nav .fn-sep {
  color:          #333;
  font-size:      13px;
  line-height:    1;
  user-select:    none;
  pointer-events: none;
}

.footer-copy {
  font-size:  12px;
  color:      var(--muted);
  text-align: center;
  opacity:    0.65;
}

/* ---------- Back to Top ---------- */
/*
 * Astra injects its OWN scroll-to-top button (#ast-scroll-top) via wp_footer on
 * every page, which collides with our custom .back-to-top. Hide Astra's so only
 * ours shows. (functions.php also disables it at the source as a belt-and-suspenders.)
 */
#ast-scroll-top { display: none !important; }

.back-to-top {
  position:        fixed !important;
  bottom:          28px !important;
  right:           28px !important;
  z-index:         9999 !important;
  width:           44px !important;
  height:          44px !important;
  min-width:       44px !important;
  min-height:      44px !important;
  max-width:       44px !important;
  max-height:      44px !important;
  border-radius:   50% !important;
  background:      var(--accent) !important;
  color:           #0a0a0a !important;
  border:          none !important;
  padding:         0 !important;
  margin:          0 !important;
  cursor:          pointer !important;
  display:         flex !important;
  align-items:     center !important;
  justify-content: center !important;
  opacity:         0 !important;
  transform:       translateY(14px) !important;
  pointer-events:  none !important;
  transition:      opacity 0.25s ease, transform 0.25s ease, background 0.15s ease, box-shadow 0.15s ease !important;
  box-shadow:      0 4px 14px rgba(43, 238, 52, 0.3) !important;
  line-height:     1 !important;
  flex-shrink:     0 !important;
}
.back-to-top.visible {
  opacity:        1 !important;
  transform:      translateY(0) !important;
  pointer-events: auto !important;
}
.back-to-top:hover {
  background: var(--accent-hover) !important;
  transform:  translateY(-2px) !important;
  box-shadow: 0 6px 22px rgba(43, 238, 52, 0.45) !important;
}
.back-to-top svg {
  width:       20px !important;
  height:      20px !important;
  flex-shrink: 0 !important;
  display:     block !important;
}

/* ---------- Shared responsive: header / nav / CTA collapse ---------- */
@media (max-width: 780px) {
  /* Show mobile action buttons */
  .header-actions    { display: flex; }
  .search-btn-mobile { display: flex; }

  /* Collapse nav into a dropdown toggled by the hamburger */
  .site-nav {
    position:       absolute;
    right:          24px;
    top:            64px;
    background:     var(--bg);
    border:         1px solid var(--border);
    border-radius:  8px;
    padding:        8px;
    min-width:      160px;
    display:        none;
    flex-direction: column;
    align-items:    stretch;
  }
  .site-nav.open { display: flex; }
  .search-btn    { display: none; }

  /* Banners tighten up on mobile; buttons already wrap. */
  .telegram-banner,
  .request-banner { padding: 1.5rem; }
}
