/* ─── LAYOUT: HEADER & FOOTER ───────────────────────────────────────────── */

.em-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-surface) 90%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Offset sticky header when WP admin bar is present (prevents overlap on scroll). */
body.admin-bar .em-header {
  top: var(--wp-admin--admin-bar--height, 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .em-header {
    top: var(--wp-admin--admin-bar--height, 46px);
  }
}

@media screen and (max-width: 600px) {
  body.admin-bar .em-header {
    top: 0;
  }
}

.em-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  gap: 28px;
}

.em-header-top {
  height: 58px;
}

.em-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.em-logo-divider {
  width: 1px;
  height: 18px;
  background: var(--border-default);
  margin: 0 6px;
  display: inline-block;
}

.em-logo-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.em-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.em-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-on-brand);
}

.em-logo-text {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.em-logo-text-accent {
  color: var(--brand-primary);
}

.em-nav-list {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.em-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.em-mobile-only {
  display: none;
}

.em-desktop-only {
  display: inline-flex;
}

.em-header-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition:
    background 0.18s,
    border-color 0.18s,
    color 0.18s;
}

.em-header-icon-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.em-header-newsletter {
  padding: 9px 14px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition:
    background 0.18s,
    transform 0.18s;
  white-space: nowrap;
}

.em-header-newsletter:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

/* ─── HEADER: SEARCH ───────────────────────────────────────────────────── */

.em-header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.em-header-search-input {
  width: 200px;
  height: 36px;
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
  padding: 0 12px 0 34px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition:
    border-color 0.18s,
    background 0.18s;
  font-family: inherit;
}

.em-header-search-toggle {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
}

.em-header-search-input:focus {
  border-color: var(--brand-primary);
}

.em-header-search-results {
  position: absolute;
  top: 44px;
  left: 0;
  width: min(460px, 90vw);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: none;
  z-index: 210;
}

.em-header-search-results.is-open {
  display: block;
}

.em-search-panel {
  padding: 10px;
}

.em-search-section+.em-search-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.em-search-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 8px 8px;
}

.em-search-items {
  display: flex;
  flex-direction: column;
}

.em-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
}

.em-search-item:hover {
  background: var(--bg-subtle);
}

.em-search-item-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.em-search-empty {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 8px;
}

.em-mobile-search-overlay[hidden] {
  display: none !important;
}

.em-mobile-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: var(--bg-primary);
}

.em-mobile-search-shell {
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  font-family: "Plus Jakarta Sans", sans-serif;
  transition: background 0.3s;
  animation: em-mobile-search-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.em-mobile-search-header {
  padding: 14px 16px 0;
  flex-shrink: 0;
}

.em-mobile-search-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.em-mobile-search-form {
  display: block;
}

.em-mobile-search-input-wrap {
  position: relative;
}

.em-mobile-search-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.em-mobile-search-input {
  width: 100%;
  border: 1.5px solid var(--border-default);
  background: var(--bg-subtle);
  padding: 14px 16px 14px 46px;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
}

.em-mobile-search-input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 15%, transparent);
}

.em-mobile-search-input::placeholder {
  color: var(--text-muted);
}

.em-mobile-search-input-clear {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.em-mobile-search-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 40px;
}

.em-mobile-search-section {
  margin-bottom: 28px;
}

.em-mobile-search-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.em-mobile-search-section-kicker,
.em-mobile-search-results-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.em-mobile-search-section-action {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-mid);
  font-family: "Plus Jakarta Sans", sans-serif;
  text-decoration: none;
}

.em-mobile-search-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.em-mobile-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.16s;
}

.em-mobile-search-chip:hover {
  border-color: var(--brand-light);
  color: var(--brand-mid);
  background: var(--bg-brand-subtle);
}

.em-mobile-search-mostread-list,
.em-mobile-search-results {
  display: flex;
  flex-direction: column;
}

.em-mobile-search-mostread-item,
.em-mobile-search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}

.em-mobile-search-result-item {
  padding: 14px 0;
}

.em-mobile-search-mostread-item:last-child,
.em-mobile-search-result-item:last-child {
  border-bottom: none;
}

.em-mobile-search-mostread-text,
.em-mobile-search-result-copy {
  min-width: 0;
  flex: 1;
}

.em-mobile-search-mostread-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.em-mobile-search-mostread-post,
.em-mobile-search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.em-mobile-search-mostread-meta,
.em-mobile-search-empty {
  font-size: 11.5px;
  color: var(--text-muted);
}

.em-mobile-search-link-arrow {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--border-default);
  flex-shrink: 0;
}

.em-mobile-search-result-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-brand-subtle);
  color: var(--brand-mid);
  flex-shrink: 0;
}

.em-mobile-search-results-wrap[hidden] {
  display: none !important;
}

.em-mobile-search-results-label {
  margin-bottom: 14px;
}

.em-mobile-search-empty {
  padding: 4px 0;
}

body.em-mobile-search-open {
  overflow: hidden;
}

body.em-mobile-search-open .em-mobile-bottom-nav {
  opacity: 0;
  pointer-events: none;
}

@keyframes em-mobile-search-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── HEADER: CATEGORY MENU ROW ────────────────────────────────────────── */

.em-header-menu {
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
}

.em-header-menu-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.em-header-menu-inner::-webkit-scrollbar {
  display: none;
}

.em-header-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1;
  transition:
    color 0.18s,
    border-color 0.18s;
}

.em-live-dot--menu {
  margin-right: 0;
}

.em-header-menu-link:hover {
  color: var(--brand-primary);
}

.em-header-menu-link.is-active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.em-header-menu-spacer {
  flex: 1;
}

.em-header-menu-date {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 10px 0;
  white-space: nowrap;
  text-transform: capitalize;
}

.em-reading-progress {
  width: 100%;
  height: 3px;
  background: var(--border-subtle);
  overflow: hidden;
}

.em-reading-progress-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-light), var(--brand-primary));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] .em-reading-progress-bar {
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-light));
}

.em-main {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.em-footer {
  padding: 40px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.em-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0px 16px;
}

.em-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}

.em-footer-brand {
  max-width: 360px;
}

.em-footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.em-footer-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.em-footer-logo-text {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.em-footer-logo-accent {
  color: var(--brand-primary);
}

.em-footer-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.em-footer-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

.em-footer-col-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.em-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.em-footer-link {
  font-size: 13.5px;
  color: var(--text-muted);
}

.em-footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.em-footer-legal,
.em-footer-made {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ─── THEME TOGGLE ──────────────────────────────────────────────────────── */

.em-theme-toggle {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.em-theme-toggle-track {
  width: 42px;
  height: 24px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  position: relative;
  display: flex;
  align-items: center;
  transition: background 0.25s;
  border-radius:12px;
}

.em-theme-toggle-thumb {
  position: absolute;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius:50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] .em-theme-toggle-thumb {
  transform: translateX(18px);
}

.em-theme-icon {
  width: 10px;
  height: 10px;
  stroke-width: 2;
  fill: none;
  stroke: var(--accent-primary);
}

.em-theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .em-theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .em-theme-icon-moon {
  display: block;
}

/* ─── HOMEPAGE SECTIONS (BASIC LAYOUT) ─────────────────────────────────── */

