/*
 * Site chrome — header + footer ported 1:1 from animeoshi-web
 * (src/components/Layout/SiteFooter, /Header). Module class names are flattened
 * to global prefixes: `aof-` (footer), `aoh-` (header). Loaded on every page
 * via Layout. Token-mapping block covers the few tokens this SSG names
 * differently or lacks.
 */

@font-face {
  font-family: 'Montra';
  src: url('Montra.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --font-montra: 'Montra', var(--font-heading);
}

/* ── token map (scoped to the ported chrome) ─────────────── */
.aof-footer {
  --font-size-base: var(--p-font-size);
  /* animeoshi's footer links/copyright are a fixed font-size-sm = 14px; the
     SSG's --font-size-sm maps to fluid --p-font-size (up to 16px), which widens
     the link groups and forces Partners onto a second row. Pin to 14px. */
  --font-size-sm: 0.875rem;
  --font-size-xs: var(--p-small-font-size);
  --spacing-4xl: 3.5rem;
}

/* ── Footer (SiteFooter) ─────────────────────────────────── */
.aof-footer {
  width: 100%;
  background: var(--color-surface);
  border-top: var(--border-normal) solid var(--color-border);
  padding: var(--spacing-3xl);
  box-sizing: border-box;
}

.aof-container {
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-4xl);
}

.aof-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-lg);
  min-width: 300px;
}

.aof-logo-link { display: flex; align-items: center; text-decoration: none; }
.aof-logo { height: auto; width: auto; }

.aof-socials { display: flex; gap: var(--spacing-sm); }

.aof-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--charcoal);
  color: var(--ivory);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.aof-social-btn:hover { background: var(--charcoal-80); transform: scale(1.05); }
.aof-social-badge { display: block; width: 20px; height: 20px; }

.aof-copyright {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.aof-right {
  display: flex;
  gap: var(--spacing-4xl);
  flex-wrap: wrap;
  width: 100%;
}

.aof-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  min-width: 160px;
}

.aof-group-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.aof-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.aof-link {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.aof-link:hover { color: var(--color-text-primary); }

@media (max-width: 1024px) {
  .aof-container { gap: var(--spacing-2xl); }
  .aof-right { gap: var(--spacing-2xl); }
  .aof-group { min-width: 140px; }
}

@media (max-width: 768px) {
  .aof-footer { padding: var(--spacing-2xl) 0; margin-top: var(--spacing-4xl); }
  .aof-container { flex-direction: column; gap: var(--spacing-2xl); padding: 0 var(--spacing-md); }
  .aof-left { align-items: center; text-align: center; }
  .aof-right { justify-content: center; gap: var(--spacing-xl); }
  .aof-group { min-width: 120px; align-items: center; text-align: center; }
  .aof-link-list { align-items: center; }
  .aof-link { font-size: var(--font-size-xs); }
  .aof-copyright { font-size: var(--font-size-xs); }
  .aof-logo { max-height: 32px; }
}

@media (max-width: 480px) {
  .aof-footer { padding-bottom: 120px; }
  .aof-right { flex-direction: column; align-items: center; gap: var(--spacing-lg); }
}

/* ── Header (ported from animeoshi-web Layout/Header) ─────── */
.aoh-header {
  --color-ghost: var(--ivory);
  --color-ghost-subtle: var(--pebble-15);
  --blur-md: 12px;
  --color-surface-hover: var(--color-surface-overlay);
  --spacing-2xs: 0.125rem;
  /* Fluid text size for all header pills (nav / country code / username) —
     animeoshi.com renders these spans at ~11px + 0.18vw (13.6px @1440). */
  --aoh-text: clamp(12.5px, calc(11px + 0.18vw), 16px);

  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding-block: var(--spacing-sm);
  padding-inline: var(--spacing-md);
  background: transparent;
  box-sizing: border-box;
}
/* Side space grows with the viewport, exactly like animeoshi-web's header. */
@media (min-width: 768px)  { .aoh-header { padding-inline: var(--spacing-xl); } }
@media (min-width: 1200px) { .aoh-header { padding-inline: var(--spacing-2xl); } }

.aoh-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--charcoal);
  border-radius: var(--radius-full);
  padding: var(--spacing-xs) var(--spacing-md);
  gap: var(--spacing-md);
  min-width: 280px;
  /* Query container so nav/search adapt to the pill's width, not the viewport —
     exactly like animeoshi-web's header (container-name: header). */
  container-type: inline-size;
  container-name: header;
}

.aoh-logo { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.aoh-logo img { height: clamp(36px, 9vw, 56px); width: auto; display: block; }
@media (max-width: 768px) { .aoh-logo img { height: 50px; } }

.aoh-left { display: flex; align-items: center; gap: var(--spacing-md); flex: 1; min-width: 0; }
.aoh-nav { display: none; gap: var(--spacing-sm); align-items: center; }
@container header (min-width: 1000px) { .aoh-nav { display: flex; } }

.aoh-nav-button {
  font-family: var(--font-body);
  font-size: var(--aoh-text);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: transparent;
  color: var(--color-ghost);
  text-decoration: none;
  gap: var(--spacing-xs);
}
.aoh-nav-button:hover { opacity: 0.8; }
.aoh-nav-icon { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; }
.aoh-nav-icon svg { width: 20px; height: 20px; display: block; }

.aoh-dropdown-container { position: relative; }
.aoh-dropdown {
  position: absolute;
  top: calc(100% + var(--spacing-md));
  left: 0;
  background: hsla(271, 25%, 18%, 0.9);
  -webkit-backdrop-filter: blur(var(--blur-md));
  backdrop-filter: blur(var(--blur-md));
  border: var(--border-normal) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xs);
  width: max-content;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xs);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}
.aoh-dropdown-container.aoh-open .aoh-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.aoh-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.aoh-dropdown-item:hover { background: var(--color-surface); }

/* Search */
.aoh-search { display: flex; align-items: center; flex: 1; min-width: 0; }
/* Search narrows as the pill tightens, then collapses to its own width — the
   same container-query steps animeoshi-web uses on .searchContainer. */
@container header (min-width: 1000px) and (max-width: 1230px) { .aoh-search { max-width: 100px; } }
@container header (min-width: 1000px) and (max-width: 1100px) { .aoh-search { flex: none; max-width: none; } }
/* SearchBar .container — transparent w/ subtle border + radius-3xl, 14px (matches app). */
.aoh-search-form {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  width: 100%;
  /* animeoshi.com's header search renders ~264px at desktop (its SearchBar is
     collapsed:160 / expanded:100%); the old 320px cap was visibly longer. */
  max-width: 264px;
  padding: var(--spacing-md);
  border: var(--border-normal) solid var(--color-ghost-subtle);
  background: transparent;
  border-radius: 24px;
  color: var(--color-ghost);
  font-size: 14px;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.aoh-search-form:hover { border-color: var(--color-ghost); }
.aoh-search-form:focus-within { background: var(--color-ghost-subtle); }
.aoh-search-icon { flex-shrink: 0; color: var(--color-ghost); opacity: 1; }
.aoh-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-ghost);
  font-family: inherit;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
}
.aoh-search-input::placeholder { color: var(--color-ghost); opacity: 0.95; font-weight: var(--font-weight-medium); }

/* Right / auth */
.aoh-right { display: flex; align-items: center; gap: var(--spacing-md); flex-shrink: 0; margin-inline-end: calc(-1 * var(--spacing-md)); }
@media (max-width: 768px) { .aoh-right { gap: var(--spacing-xs); } }
.aoh-user-actions { display: flex; align-items: center; gap: var(--spacing-xs); }
/* Sign In — shared Button variant="primary" (pebble bg, dark text). */
.aoh-signin {
  font-family: var(--font-body);
  font-size: var(--p-font-size);
  font-weight: var(--font-weight-semibold);
  /* animeoshi's Button inherits body line-height 1.6 → ~42px tall; the SSG
     button reset defaults to normal (~35px), so pin it to match. */
  line-height: 1.6;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  border: none;
  color: var(--charcoal);
  background: var(--pebble);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}
.aoh-signin:hover { opacity: 0.8; }
/* Signed-in pill = animeoshi's profileButton (Button variant="secondary"):
   transparent bordered pill, 40px tall, 14px, avatar + username. */
.aoh-profile {
  display: inline-flex; align-items: center; gap: var(--spacing-xs);
  height: 40px; padding: 0 var(--spacing-md);
  border-radius: var(--radius-full);
  border: var(--border-normal) solid var(--color-ghost-subtle);
  background: transparent;
  color: var(--color-ghost);
  font-family: var(--font-body);
  font-size: var(--aoh-text);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}
.aoh-profile:hover { background: var(--color-ghost-subtle); }
.aoh-profile img {
  width: 24px; height: 24px; border-radius: var(--radius-full);
  object-fit: cover; background: #f3f4f6; flex-shrink: 0;
  /* .avatarContainer margin-right:8px + the 4px pill gap = 12px, per animeoshi. */
  margin-right: var(--spacing-sm);
}
/* Mobile: avatar only (no username, no border) — like animeoshi ≤480px. */
@media (max-width: 480px) {
  .aoh-profile { border: none; padding: 0; }
  .aoh-profile span { display: none; }
}

/* CountrySelector (the flag) — from countrySelector.module.css .trigger */
.aoh-country {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: transparent;
  border: var(--border-normal) solid var(--color-ghost-subtle);
  cursor: pointer;
  height: 40px;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  color: var(--color-ghost);
  font-family: var(--font-body);
  font-size: var(--aoh-text);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  line-height: 1.25;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.aoh-country:hover { background: var(--color-ghost-subtle); }
/* flag + country code (e.g. "US"), like animeoshi's .triggerLabel */
.aoh-country-label { display: inline-flex; align-items: center; gap: 15px; }
.aoh-country-flagbox { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--radius-sm, 4px); overflow: hidden; flex-shrink: 0; }
/* Inline country-flag-icons SVG cropped in the box — mirrors animeoshi's
   .flagIcon .flag { width:auto; height:24px }. */
.aoh-country-flagbox svg { display: block; height: 24px; width: auto; }
.aoh-country-caret { width: 10px; height: 10px; flex-shrink: 0; }
@media (max-width: 480px) {
  .aoh-country { border: none; }
  .aoh-country-code, .aoh-country-caret { display: none; }
}

/* Settings gear + inbox bell — 40px circular icon buttons (signed-in only). */
.aoh-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: none; background: transparent;
  border-radius: var(--radius-full);
  color: var(--color-ghost); cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.aoh-iconbtn:hover { background: var(--color-ghost-subtle); }
.aoh-iconbtn svg { width: 22px; height: 22px; display: block; }
@media (max-width: 768px) { .aoh-iconbtn { width: 36px; } }

/* Inbox unread badge (mirrors animeoshi's InboxBell .badge). */
.aoh-bell { position: relative; }
.aoh-bell-icon { display: inline-flex; }
.aoh-bell-badge {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 9999px;
  background: var(--color-accent);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  line-height: 1;
  pointer-events: none;
}

/* Below 1220px the top nav/search hide and the bottom dock takes over. */
/* Search hides on mobile only; animeoshi renders it for tablet + desktop.
   (The nav is governed by the pill's container query above, not the viewport.) */
@media (max-width: 767px) { .aoh-search { display: none; } }
@media (max-width: 299px) { .aoh-country { display: none; } }

/* ── Mobile bottom dock (ported from Layout/Footer + Layout/Dock) ── */
.aod-container {
  position: fixed;
  bottom: 20px;
  left: 0; right: 0;
  z-index: 50;
  display: none;
  justify-content: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.aod-container.aod-hidden { transform: translateY(120px); opacity: 0; pointer-events: none; }
.aod-panel {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  border-radius: var(--radius-2xl);
  background: hsla(271, 45%, 9%, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: var(--border-normal) solid var(--color-border);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-lg);
}
.aod-slot { position: relative; }
.aod-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: var(--border-normal) solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.aod-item:hover { background: var(--color-surface); }
.aod-icon { width: 24px; height: 24px; display: block; }
.aod-dropdown {
  position: absolute;
  bottom: calc(100% + var(--spacing-sm));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: hsla(271, 25%, 18%, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: var(--border-normal) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xs);
  width: max-content;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}
.aod-slot.aod-open .aod-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.aod-dropdown-item {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: var(--p-font-size);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: background 0.2s ease;
}
.aod-dropdown-item:hover { background: var(--color-surface); }

@media (max-width: 1219.98px) { .aod-container { display: flex; } }

/* ── Breadcrumb (ported from animeoshi-web Commons/Navigation/Breadcrumb) ──
 * Just the trail styling — pages position the .bc-nav wrapper themselves. */
.bc-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.bc-item { display: flex; align-items: center; gap: var(--spacing-xs); }
.bc-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.bc-link:hover { color: var(--color-text-primary); text-decoration: underline; }
.bc-separator { width: 12px; height: 12px; color: var(--color-text-tertiary); flex-shrink: 0; }
.bc-current { color: var(--color-text-primary); font-weight: var(--font-weight-semibold); }

@media (max-width: 768px) {
  .bc-list { font-size: 12px; }
  .bc-separator { width: 10px; height: 10px; }
  .bc-link, .bc-current { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Toasts: anchor top-right (match the live site) ──────────────
   The vendored tokens.css snapshot positions #ao-toasts bottom-right;
   override to top-right, just below the fixed header. */
#ao-toasts {
  top: calc(var(--header-height) + var(--spacing-sm));
  bottom: auto;
  right: var(--spacing-xl);
  left: auto;
}
@media (max-width: 480px) {
  #ao-toasts {
    top: calc(var(--header-height) + var(--spacing-sm));
    bottom: auto;
    left: var(--spacing-md);
    right: var(--spacing-md);
  }
}

/* ── Toast: left accent bar + circled icon (match the live toast) ── */
.ao-toast {
  border-left-width: 4px;
  border-left-style: solid;
  border-left-color: var(--color-border);
}
.ao-toast-success { border-left-color: var(--color-success); }
.ao-toast-error   { border-left-color: var(--color-danger); }
.ao-toast-warning { border-left-color: var(--color-warning); }
.ao-toast-info    { border-left-color: var(--cotton-sky); }
/* Circle-check style: wrap the glyph in a colored ring instead of a bare mark. */
.ao-toast-icon {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
}
