/* =========================================================
   unified-header.css (v1.3 - Itako-Dict Adjustment)
   Modern unified header system for all Anagura sites
   Based on linguistics/river-theme pattern
   
   v1.3:
   - Itako-Dict body padding reduced (80px/70px) to remove white gap
   - Hamburger hover styles removed (v1.2)
   ========================================================= */

:root {
  --header-accent: #e07a00;
  --header-text: #3b2411;
  --header-bg: rgba(255, 255, 255, 0.98);
  --header-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== MAIN HEADER CONTAINER ========== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--header-accent);
  box-shadow: var(--header-shadow);
  flex-wrap: nowrap;
  gap: 16px;
}

/* ========== NAVIGATION TOGGLE (HAMBURGER) ========== */
.nav-toggle {
  order: 3;
  display: block;
  appearance: none;
  border: 0;
  background: none;
  color: var(--header-text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.nav-toggle:hover,
.nav-toggle:focus {
  color: var(--header-accent);
  transform: rotate(90deg);
  outline: none; 
}

/* ========== SITE TITLE AREA ========== */
.site-title {
  order: 1;
  flex-grow: 1;
  text-align: left;
  margin-left: 0;
  min-width: 0;
}

.site-title a {
  color: var(--header-text);
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-family: "Noto Serif JP", serif;
  letter-spacing: 0.02em;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  margin: 0;
  color: var(--header-accent);
  font-size: 0.9rem;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 500;
  opacity: 0.9;
  line-height: 1.2;
}

/* ========== HEADER CONTROLS (THEME-SPECIFIC BUTTONS) ========== */
.header-controls {
  order: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* ========== SCRIPT SELECTOR (linguistics) ========== */
.script-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--header-accent);
  border-radius: 20px;
}

.script-selector label {
  font-size: 0.8rem;
  color: #5a4943;
  font-weight: 600;
}

.script-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5a4943;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Noto Sans JP", sans-serif;
}

.script-btn.active {
  background: var(--header-accent);
  color: #fff;
  font-weight: 600;
}

.script-btn:hover:not(.active) {
  background: rgba(224, 122, 0, 0.1);
}

.script-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== VIEW MODE SELECTOR (dict-db) ========== */
.view-mode-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--header-accent);
  border-radius: 20px;
}

.view-mode-selector label {
  font-size: 0.8rem;
  color: #5a4943;
  font-weight: 600;
}

.view-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5a4943;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Noto Sans JP", sans-serif;
}

.view-btn.active {
  background: var(--header-accent);
  color: #fff;
  font-weight: 600;
}

.view-btn:hover:not(.active) {
  background: rgba(224, 122, 0, 0.1);
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 920px) {
  .view-mode-selector,
  .script-selector {
    display: none; /* Hide on tablet/mobile to save space */
  }
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 12px 16px;
    gap: 8px;
  }

  .nav-toggle {
    display: block;
    order: 3;
    margin: 0;
    padding-left: 8px;
  }

  .site-title {
    order: 1;
    flex-grow: 1;
    padding-left: 0;
  }

  .site-title a {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  }

  .header-controls {
    order: 2;
    width: auto;
    margin-top: 0;
  }

  .subtitle {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .subtitle {
    display: none; /* Hide on very small screens */
  }
}

/* ========== ACCESSIBILITY ========== */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--header-accent);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 200;
  font-weight: 600;
  font-family: "Noto Sans JP", sans-serif;
  border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
  top: 0;
  outline: 2px solid white;
  outline-offset: 2px;
}

/* ========== PRINT STYLES ========== */
@media print {
  .site-header {
    position: static;
    background: white;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .nav-toggle,
  .header-controls {
    display: none !important;
  }
}

/* ========== BODY OFFSET FOR FIXED HEADER ========== */

/* Calculate header height: 12px top + 12px bottom + ~40px content = ~64px */
body {
  padding-top: 70px; /* Safe default for all sites */
}

/* Specific adjustments for each theme */

/* [UPDATED] dict-db: Menu moved to sidebar/header, so we use standard padding now */
body.archive,
body.post-type-archive-dictionary,
body.tax-dict_category,
body.tax-dict_language {
  padding-top: 70px; /* Was 120px. Reduced to remove gap. */
}

/* itako-dict: has breadcrumb + alphabet nav */
/* CHANGED: Pulled up from 115px to 80px */
body.page-template-default,
body.single-post {
  padding-top: 80px; 
}

/* linguistics: river layout needs minimal offset */
body.home.linguistics,
body.blog.linguistics {
  padding-top: 70px; 
}

/* Mobile adjustments */
@media (max-width: 768px) {
  body {
    padding-top: 60px; /* Smaller header on mobile */
  }
  
  /* [UPDATED] dict-db Mobile: Reduced to standard mobile header height */
  body.archive,
  body.post-type-archive-dictionary {
    padding-top: 60px; /* Was 110px */
  }
  
  /* CHANGED: Pulled up from 100px to 70px */
  body.page-template-default,
  body.single-post {
    padding-top: 70px;
  }
}