/* ═══════════════════════════════════════════════════════════════════════════
   AmericasPress – Main Stylesheet  v2.0
   Aesthetic: Premium editorial broadsheet
   Fonts: Playfair Display · Source Serif 4 · DM Sans
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300;1,8..60,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@600;700&display=swap');

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

:root {
  --ink:          #0d0d0d;
  --ink-2:        #1a1a1a;
  --ink-3:        #2e2e2e;
  --charcoal:     #444;
  --mid:          #777;
  --rule:         #d4d0c8;
  --rule-light:   #ede9e0;
  --cream:        #faf8f3;
  --paper:        #fffef9;
  --white:        #ffffff;
  --red:          #c0392b;
  --red-dark:     #962d22;
  --red-light:    #e74c3c;
  --gold:         #b8860b;
  --blue:         #1a3a5c;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-ui:      'DM Sans', system-ui, sans-serif;

  --max-w:    1280px;
  --gutter:   clamp(16px, 4vw, 40px);
  --col-gap:  24px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.18);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.28);

  --transition: 200ms ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-ui); border: none; }

/* ── Layout ─────────────────────────────────────────────────────────────────*/
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.section    { padding: 40px 0; }
.section + .section { border-top: 1px solid var(--rule); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--col-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--col-gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--col-gap); }

/* ── Section Headers ──────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
  margin-bottom: 24px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-header a {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.04em;
}
.section-header a:hover { text-decoration: underline; }

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.top-bar {
  background: var(--ink);
  color: rgba(255,255,255,0.75);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 7px 0;
  border-bottom: 2px solid var(--red);
}
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-bar-left { display: flex; gap: 16px; align-items: center; }
.top-bar-date { opacity: 0.65; }
.top-bar-edition {
  background: var(--red);
  color: white;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.top-bar-right { display: flex; gap: 16px; }
.top-bar-right a { opacity: 0.6; transition: opacity var(--transition); }
.top-bar-right a:hover { opacity: 1; }

/* ── Masthead ─────────────────────────────────────────────────────────────── */
.masthead {
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  padding: 20px 0 0;
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
}
/* ── Site Logo ───────────────────────────────────────────────────────────── */
.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo-svg {
  height: 60px;
  width: auto;
  max-width: 340px;
  display: block;
  flex-shrink: 0;
}
/* Remove old hybrid classes (logo-globe, logo-wordmark, etc.) */
.logo-globe, .logo-wordmark, .logo-the, .logo-americas,
.logo-rule, .logo-press { all: unset; display: none; }
.masthead-search {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--rule);
  background: var(--cream);
  transition: border-color var(--transition);
}
.masthead-search:focus-within { border-color: var(--ink); }
.masthead-search input {
  border: none;
  background: none;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  width: 220px;
  outline: none;
  color: var(--ink);
}
.masthead-search button {
  background: var(--ink);
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  transition: background var(--transition);
  cursor: pointer;
}
.masthead-search button:hover { background: var(--red); }

/* ── Navigation ───────────────────────────────────────────────────────────── */
.main-nav {
  background: var(--ink);
  border-top: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 200;
}
.main-nav .container { display: flex; align-items: stretch; position: relative; }
.main-nav ul { display: flex; list-style: none; }
.main-nav a {
  display: flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  padding: 0 18px;
  height: 46px;
  transition: all var(--transition);
  border-right: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { background: var(--red); color: white; }
.nav-admin { margin-left: auto; }
.nav-admin a { color: rgba(255,255,255,0.4); font-size: 11px; }
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  padding: 12px var(--gutter);
  cursor: pointer;
}

/* ── Ticker ───────────────────────────────────────────────────────────────── */
.breaking-ticker {
  background: var(--red);
  color: white;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  height: 36px;
}
.ticker-label {
  background: var(--red-dark);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0 16px;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ticker-label::before {
  content: '';
  width: 7px; height: 7px;
  background: white;
  border-radius: 50%;
  animation: ticker-blink 1.2s ease-in-out infinite;
}
@keyframes ticker-blink { 0%,100%{opacity:1} 50%{opacity:0} }
.ticker-wrap {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  position: relative;
}
.ticker-inner {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}
.ticker-item {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding-right: 80px;
  flex-shrink: 0;
}
.ticker-item a { color: white; text-decoration: none; }
.ticker-item a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURED / HERO — FIXED IMAGE RENDERING
   ═══════════════════════════════════════════════════════════════════════════ */
.featured-section {
  padding: 28px 0 36px;
  background: var(--white);
  border-bottom: 1px solid var(--rule);
}
.featured-grid {
  display: grid;
  grid-template-columns: 1fr 390px;
  min-height: 420px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  background: var(--white);
}

/* Image column: the <a> itself is the column */
.featured-image-link {
  display: block;
  position: relative;
  overflow: hidden;
  background: #2a2a2a;
  min-height: 380px;
}

/* Wrapper ensures the img fills via absolute positioning */
.featured-image-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.featured-image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.7s ease;
}
.featured-image-link:hover .featured-image-wrap img { transform: scale(1.04); }

/* Overlay */
.featured-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.18) 0%, transparent 45%, rgba(0,0,0,.45) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Fallback / broken image state */
.featured-image-wrap.img-error {
  background: linear-gradient(135deg, var(--ink) 0%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.featured-image-wrap.img-error::after {
  content: 'AmericasPress';
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: rgba(255,255,255,0.15);
  letter-spacing: -0.02em;
}
/* Placeholder for missing image */
.featured-img-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--ink) 0%, var(--blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.featured-img-placeholder span {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  color: rgba(255,255,255,0.12);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* Badges on image */
.featured-img-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.feat-badge-star {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: white;
  background: var(--red);
  padding: 4px 12px;
  width: fit-content;
}
.feat-badge-cat {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: white;
  background: rgba(0,0,0,.55);
  padding: 3px 10px;
  width: fit-content;
  backdrop-filter: blur(4px);
}

/* Text panel */
.featured-body {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--rule);
  background: white;
}
.article-category-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: white;
  background: var(--red);
  padding: 4px 12px;
  margin-bottom: 16px;
  width: fit-content;
}
.featured-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  color: var(--ink);
}
.featured-title a:hover { color: var(--red); }
.featured-excerpt {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--charcoal);
  line-height: 1.7;
  margin-bottom: 20px;
  flex-grow: 1;
}
.article-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--mid);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.article-meta .author { font-weight: 600; color: var(--ink-3); }
.article-meta .dot { opacity: 0.35; }
.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  padding: 10px 20px;
  border: 2px solid var(--red);
  transition: all var(--transition);
  width: fit-content;
}
.read-more-btn:hover { background: var(--red); color: white; }
.btn-arrow { transition: transform var(--transition); }
.read-more-btn:hover .btn-arrow { transform: translateX(4px); }
.flipbook-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 2px 8px;
  margin-left: 8px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* ── Article Cards ──────────────────────────────────────────────────────────*/
.article-card {
  background: white;
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
  overflow: hidden;
}
.article-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--ink-3);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s ease;
}
.article-card:hover .card-image img { transform: scale(1.06); }
.card-cat {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: white;
  background: var(--red);
  padding: 3px 9px;
  z-index: 1;
}
.card-flipbook-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.72);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  font-family: var(--font-ui);
  letter-spacing: .08em;
}
.card-body { padding: 18px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.4vw, 17px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 9px;
  letter-spacing: -0.01em;
}
.card-title a:hover { color: var(--red); }
.card-excerpt {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 14px;
}
.card-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--mid);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule-light);
  padding-top: 10px;
  margin-top: auto;
}

/* ── List Items ──────────────────────────────────────────────────────────── */
.article-list-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule-light);
}
.article-list-item:last-child { border-bottom: none; }
.list-image { overflow: hidden; aspect-ratio: 4/3; background: var(--ink-3); }
.list-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.article-list-item:hover .list-image img { transform: scale(1.06); }
.list-body { display: flex; flex-direction: column; gap: 6px; }
.list-cat { font-family: var(--font-ui); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
.list-title { font-family: var(--font-display); font-size: clamp(16px, 1.4vw, 18px); font-weight: 700; line-height: 1.2; }
.list-title a:hover { color: var(--red); }
.list-excerpt { font-family: var(--font-body); font-size: 13px; color: var(--charcoal); line-height: 1.55; }
.list-meta { font-family: var(--font-ui); font-size: 11px; color: var(--mid); margin-top: auto; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.content-layout { display: grid; grid-template-columns: 1fr 300px; gap: 40px; padding: 40px 0; }
.sidebar { display: flex; flex-direction: column; gap: 32px; }
.sidebar-widget { border-top: 3px solid var(--ink); padding-top: 16px; }
.sidebar-widget h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.trending-list { list-style: none; }
.trending-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule-light);
}
.trending-item:last-child { border-bottom: none; }
.trending-num { font-family: var(--font-display); font-size: 26px; font-weight: 900; color: var(--rule); line-height: 1; letter-spacing: -0.03em; }
.trending-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.trending-title a:hover { color: var(--red); }
.trending-meta { font-family: var(--font-ui); font-size: 10px; color: var(--mid); }

/* ── Article Reading ─────────────────────────────────────────────────────── */
.article-header { margin-bottom: 28px; }
.article-header .category-link { display: inline-block; font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--red); margin-bottom: 12px; }
.article-headline { font-family: var(--font-display); font-size: clamp(26px, 4vw, 44px); font-weight: 700; line-height: 1.15; letter-spacing: -0.025em; margin-bottom: 16px; }
.article-byline { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.byline-author { font-family: var(--font-ui); font-weight: 600; font-size: 13px; }
.byline-date   { font-family: var(--font-ui); font-size: 12px; color: var(--mid); }
.byline-views  { margin-left: auto; font-family: var(--font-ui); font-size: 11px; color: var(--mid); }
.article-featured-image { margin-bottom: 28px; overflow: hidden; }
.article-featured-image img { width: 100%; display: block; }
.article-body { font-family: var(--font-body); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.78; color: var(--ink-3); }
.article-body p { margin-bottom: 1.4em; }
.article-body h2 { font-family: var(--font-display); font-size: 1.5em; margin: 1.5em 0 0.6em; font-weight: 700; }
.article-body h3 { font-family: var(--font-display); font-size: 1.25em; margin: 1.2em 0 0.5em; font-weight: 700; }
.article-body blockquote { border-left: 4px solid var(--red); padding: 8px 0 8px 20px; margin: 1.5em 0; font-style: italic; color: var(--charcoal); }
.article-body a { color: var(--red); text-decoration: underline; }
.article-body ul, .article-body ol { margin: 1em 0 1em 1.5em; }
.article-body li { margin-bottom: 0.4em; }
.article-tags { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); }
.article-tags .tag { display: inline-block; font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; background: var(--rule-light); color: var(--charcoal); padding: 4px 12px; margin: 4px 4px 4px 0; transition: all var(--transition); }
.article-tags .tag:hover { background: var(--ink); color: white; }

/* ═══════════════════════════════════════════════════════════════════════════
   FLIPBOOK  — Premium book-like experience
   ═══════════════════════════════════════════════════════════════════════════ */

.flipbook-body { overflow: hidden; }

.flipbook-container {
  height: 100vh;
  background: #1a1714;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(140,60,30,.12), transparent),
    radial-gradient(ellipse 60% 80% at 100% 100%, rgba(0,0,0,.25), transparent);
}

/* Header */
.flipbook-header {
  flex-shrink: 0;
  background: rgba(10,10,10,0.97);
  border-bottom: 2px solid var(--red);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
}
.flipbook-title-wrap { overflow: hidden; flex: 1; min-width: 0; }
.flipbook-title-wrap h1 {
  font-family: var(--font-display);
  font-size: clamp(13px, 1.5vw, 17px);
  color: rgba(255,255,255,0.9);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flipbook-meta-line {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 2px;
}
.flipbook-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}
.flipbook-page-counter {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em;
  min-width: 90px;
  text-align: center;
}
.flipbook-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.82);
  padding: 0 16px;
  height: 36px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  border-radius: 2px;
}
.flipbook-btn:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: white; }
.flipbook-btn:disabled { opacity: 0.22; cursor: default; }
.flipbook-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.45);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  border-radius: 2px;
}
.flipbook-close-btn:hover { background: rgba(255,255,255,0.14); color: white; }

/* Progress */
.flipbook-progress { flex-shrink: 0; height: 2px; background: rgba(255,255,255,0.06); }
.flipbook-progress-fill { height: 100%; background: var(--red); transition: width 0.5s cubic-bezier(.4,0,.2,1); }

/* Stage */
.flipbook-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  overflow: hidden;
  position: relative;
}

/* ──────────────────────────────────────────────────
   BOOK: the realistic two-page spread
   ────────────────────────────────────────────────── */
.fb-book-scene {
  perspective: 2400px;
  perspective-origin: 50% 42%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fb-book {
  position: relative;
  display: flex;
  width: min(960px, 90vw);
  height: min(640px, 70vh);
  transform-style: preserve-3d;
  transform: rotateX(2deg);
  transition: transform 0.35s ease;
}
.fb-book:hover { transform: rotateX(0.5deg); }

/* Hard shadow under book */
.fb-book::before {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 5%;
  right: 5%;
  height: 40px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.7) 0%, transparent 70%);
  filter: blur(16px);
  z-index: -1;
}

/* Spine center line */
.fb-book::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 4px;
  margin-left: -2px;
  background: linear-gradient(to right, #a09070, #c8b898, #a09070);
  z-index: 10;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

/* Pages */
.fb-page {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: #fffef9;
  overflow: hidden;
  backface-visibility: hidden;
  /* Lined paper texture */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(0,0,0,0.028) 27px, rgba(0,0,0,0.028) 28px);
}

.fb-page.fb-left {
  left: 0;
  transform-origin: right center;
  /* Inner shadow — spine side */
  box-shadow:
    inset -20px 0 40px rgba(0,0,0,.12),
    inset  -4px 0  8px rgba(0,0,0,.09),
     2px 0 4px rgba(0,0,0,.15);
}

.fb-page.fb-right {
  left: 50%;
  transform-origin: left center;
  box-shadow:
    inset 20px 0 40px rgba(0,0,0,.09),
    inset  4px 0  8px rgba(0,0,0,.06),
    -2px 0 4px rgba(0,0,0,.12);
}

/* Page-turn corner curl — right page */
.fb-page.fb-right::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 32px 32px;
  border-color: transparent transparent #e8e4da transparent;
  filter: drop-shadow(-3px -2px 4px rgba(0,0,0,.12));
  pointer-events: none;
}
.fb-page.fb-left::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 32px 0 0 32px;
  border-color: transparent transparent transparent #e8e4da;
  pointer-events: none;
}

/* ── Flip animations ─────────────────────────────────────────────────────── */

/* Forward flip: right page flips away to the left */
.fb-page.animate-flip-fwd {
  z-index: 20;
  animation: realFlipFwd 0.7s cubic-bezier(0.455, 0.030, 0.515, 0.955) forwards;
}

/* Backward flip: right page swings from the left */
.fb-page.animate-flip-bwd {
  z-index: 20;
  animation: realFlipBwd 0.7s cubic-bezier(0.455, 0.030, 0.515, 0.955) forwards;
}

@keyframes realFlipFwd {
  0%   {
    transform-origin: left center;
    transform: rotateY(0deg);
    box-shadow: inset 20px 0 40px rgba(0,0,0,.09), -2px 0 4px rgba(0,0,0,.12);
  }
  25%  {
    transform: rotateY(-30deg);
    box-shadow: inset 30px 0 60px rgba(0,0,0,.22), -4px 0 12px rgba(0,0,0,.28);
  }
  50%  {
    transform: rotateY(-90deg);
    box-shadow: inset 60px 0 80px rgba(0,0,0,.35);
  }
  75%  { transform: rotateY(-150deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes realFlipBwd {
  0%   {
    transform-origin: left center;
    transform: rotateY(-180deg);
  }
  25%  { transform: rotateY(-150deg); }
  50%  {
    transform: rotateY(-90deg);
    box-shadow: inset 60px 0 80px rgba(0,0,0,.35);
  }
  75%  {
    transform: rotateY(-30deg);
    box-shadow: inset 30px 0 60px rgba(0,0,0,.22);
  }
  100% {
    transform: rotateY(0deg);
    box-shadow: inset 20px 0 40px rgba(0,0,0,.09), -2px 0 4px rgba(0,0,0,.12);
  }
}

/* ── Page Inner Content ──────────────────────────────────────────────────── */
.fb-page-inner {
  padding: clamp(24px, 4%, 44px);
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.fb-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #ddd8cc;
  flex-shrink: 0;
}
.fb-logo {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: rgba(0,0,0,0.35);
}
.fb-logo span { color: var(--red); opacity: 0.7; }

.fb-section-tag {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.3);
}

.fb-page-body {
  flex: 1;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: clamp(12.5px, 1.05vw, 14px);
  line-height: 1.72;
  color: #2a2a2a;
}
.fb-page-body p          { margin-bottom: 0.85em; }
.fb-page-body h2         { font-family: var(--font-display); font-size: 1.3em; font-weight: 700; margin: 1em 0 0.45em; letter-spacing: -.015em; color: var(--ink); }
.fb-page-body h3         { font-family: var(--font-display); font-size: 1.1em; font-weight: 700; margin: 0.85em 0 0.4em; }
.fb-page-body blockquote {
  border-left: 3px solid var(--red);
  padding: 5px 0 5px 13px;
  margin: 0.85em 0;
  font-style: italic;
  color: #555;
  font-size: 0.94em;
}
.fb-page-body a { color: var(--red); }
.fb-page-body ul, .fb-page-body ol { margin: 0.7em 0 0.7em 1.2em; }
.fb-page-body li { margin-bottom: 0.28em; }

.fb-page-footer {
  flex-shrink: 0;
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid #e0dbd0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fb-page-num  { font-family: var(--font-ui); font-size: 10px; color: #aaa; letter-spacing: 0.08em; }
.fb-page-date { font-family: var(--font-ui); font-size: 10px; color: rgba(0,0,0,.2); }

/* ── Cover ───────────────────────────────────────────────────────────────── */
.fb-page.fb-cover {
  background: var(--ink);
  background-image: none;
  overflow: hidden;
}
.fb-page.fb-cover::after { display: none; }

.fb-cover-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.fb-cover-image {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.fb-cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.4;
  display: block;
}
.fb-cover-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(13,13,13,.25) 0%, rgba(13,13,13,.05) 38%, rgba(13,13,13,.72) 70%, rgba(13,13,13,.97) 100%);
}
.fb-cover-masthead {
  position: absolute;
  top: 22px; left: 24px; right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.fb-cover-brand { font-family: var(--font-display); font-size: 17px; font-weight: 900; color: white; letter-spacing: -0.02em; }
.fb-cover-brand span { color: var(--red-light); }
.fb-cover-edition { font-family: var(--font-ui); font-size: 9px; color: rgba(255,255,255,.4); letter-spacing: 0.12em; text-transform: uppercase; }

.fb-cover-body { position: relative; z-index: 2; padding: 24px; }
.fb-cover-cat {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: white;
  background: var(--red);
  padding: 4px 10px;
  margin-bottom: 12px;
}
.fb-cover-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 3.2vw, 26px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: white;
  margin-bottom: 13px;
}
.fb-cover-byline {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,.48);
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 11px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.fb-cover-byline strong { color: rgba(255,255,255,.72); font-weight: 600; }

/* ── Back cover ──────────────────────────────────────────────────────────── */
.fb-page.fb-back {
  background: #111010;
  background-image: none;
}
.fb-page.fb-back::after { display: none; }

.fb-back-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 36px;
  text-align: center;
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 18px,
    rgba(255,255,255,.012) 18px, rgba(255,255,255,.012) 19px
  );
}
.fb-back-brand { font-family: var(--font-display); font-size: 32px; font-weight: 900; color: white; letter-spacing: -0.03em; line-height: 1; }
.fb-back-brand span { color: var(--red-light); }
.fb-back-rule  { width: 36px; height: 2px; background: var(--red); }
.fb-back-tagline { font-family: var(--font-ui); font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255,255,255,.28); }
.fb-back-links { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.fb-back-link {
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.14);
  padding: 9px 22px;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.fb-back-link:hover { background: rgba(255,255,255,.08); color: white; }
.fb-back-link.primary { background: var(--red); border-color: var(--red); color: white; }
.fb-back-link.primary:hover { background: var(--red-dark); }

/* ── Blank page ──────────────────────────────────────────────────────────── */
.fb-page.fb-blank { background: #f7f4ee; }
.fb-page.fb-blank::after { display: none; }

/* ── Mobile flipbook ─────────────────────────────────────────────────────── */
.fb-mobile-wrap { display: none; flex-direction: column; align-items: center; width: 100%; max-width: 420px; }

.fb-mobile-page {
  width: 100%;
  min-height: min(520px, 65vh);
  background: #fffef9;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.65), 0 4px 16px rgba(0,0,0,.4);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(0,0,0,.024) 27px, rgba(0,0,0,.024) 28px);
}
.fb-mobile-page.slide-out-left  { animation: slideOutLeft  0.35s ease forwards; }
.fb-mobile-page.slide-out-right { animation: slideOutRight 0.35s ease forwards; }
.fb-mobile-page.slide-in-right  { animation: slideInRight  0.35s ease forwards; }
.fb-mobile-page.slide-in-left   { animation: slideInLeft   0.35s ease forwards; }

@keyframes slideOutLeft  { from{transform:translateX(0);opacity:1} to{transform:translateX(-60px);opacity:0} }
@keyframes slideOutRight { from{transform:translateX(0);opacity:1} to{transform:translateX(60px);opacity:0} }
@keyframes slideInRight  { from{transform:translateX(60px);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes slideInLeft   { from{transform:translateX(-60px);opacity:0} to{transform:translateX(0);opacity:1} }

.fb-mobile-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}
.fb-mobile-btn {
  flex: 1;
  max-width: 140px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  padding: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  border-radius: 2px;
}
.fb-mobile-btn:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
.fb-mobile-btn:disabled { opacity: 0.25; cursor: default; }
.fb-mobile-counter { font-family: var(--font-ui); font-size: 11px; color: rgba(255,255,255,.4); text-align: center; min-width: 80px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: rgba(255,255,255,.65); padding: 48px 0 20px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand .footer-logo { font-family: var(--font-display); font-size: 28px; font-weight: 900; color: white; letter-spacing: -0.03em; margin-bottom: 14px; }
.footer-brand .footer-logo span { color: var(--red-light); }
.footer-brand p { font-family: var(--font-ui); font-size: 13px; line-height: 1.65; color: rgba(255,255,255,.42); }
.footer-col h4 { font-family: var(--font-ui); font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: white; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-family: var(--font-ui); font-size: 13px; color: rgba(255,255,255,.42); transition: color var(--transition); }
.footer-col a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-ui); font-size: 11px; color: rgba(255,255,255,.3); }

/* ── Search / Category ───────────────────────────────────────────────────── */
.page-hero { background: var(--ink); color: white; padding: 40px 0; margin-bottom: 40px; }
.page-hero h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 44px); font-weight: 700; margin-bottom: 8px; }
.page-hero p  { font-family: var(--font-ui); font-size: 14px; color: rgba(255,255,255,.55); }
.search-form { display: flex; max-width: 560px; margin-top: 16px; }
.search-form input { flex: 1; border: none; padding: 12px 16px; font-family: var(--font-ui); font-size: 14px; outline: none; }
.search-form button { background: var(--red); border: none; color: white; padding: 12px 24px; font-family: var(--font-ui); font-weight: 600; font-size: 13px; cursor: pointer; transition: background var(--transition); }
.search-form button:hover { background: var(--red-dark); }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN
   ═══════════════════════════════════════════════════════════════════════════ */
.admin-body { background: #f0efe9; min-height: 100vh; }
.admin-topbar { background: var(--ink); border-bottom: 3px solid var(--red); padding: 0 var(--gutter); display: flex; align-items: stretch; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 16px rgba(0,0,0,.3); }
.admin-topbar .brand { font-family: var(--font-display); font-size: 20px; font-weight: 900; color: white; letter-spacing: -0.02em; display: flex; align-items: center; padding: 14px 0; margin-right: 32px; }
.admin-topbar .brand span { color: var(--red-light); }
.admin-nav { display: flex; }
.admin-nav a { font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: rgba(255,255,255,.65); padding: 0 16px; letter-spacing: 0.04em; border-bottom: 3px solid transparent; transition: all var(--transition); display: flex; align-items: center; gap: 6px; }
.admin-nav a:hover, .admin-nav a.active { color: white; border-bottom-color: var(--red); }
.admin-topbar .admin-user { margin-left: auto; display: flex; align-items: center; gap: 16px; font-family: var(--font-ui); font-size: 12px; color: rgba(255,255,255,.5); }
.admin-topbar .admin-user a { color: rgba(255,255,255,.4); transition: color var(--transition); }
.admin-topbar .admin-user a:hover { color: white; }
.admin-main { padding: 32px var(--gutter); max-width: 1200px; margin: 0 auto; }
.admin-page-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; }
.btn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 13px; font-weight: 600; padding: 10px 20px; border: none; cursor: pointer; transition: all var(--transition); text-decoration: none; letter-spacing: 0.02em; }
.btn-primary   { background: var(--red); color: white; }
.btn-primary:hover  { background: var(--red-dark); }
.btn-secondary { background: white; color: var(--ink); border: 1px solid var(--rule); }
.btn-secondary:hover { background: var(--cream); }
.btn-danger    { background: #c0392b; color: white; }
.btn-danger:hover   { background: #962d22; }
.btn-success   { background: #27ae60; color: white; }
.btn-success:hover  { background: #1e8449; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: white; border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 20px 24px; box-shadow: var(--shadow-xs); }
.stat-card.red   { border-top-color: var(--red); }
.stat-card.green { border-top-color: #27ae60; }
.stat-card.blue  { border-top-color: var(--blue); }
.stat-card.gold  { border-top-color: var(--gold); }
.stat-number { font-family: var(--font-display); font-size: 36px; font-weight: 900; letter-spacing: -0.03em; }
.stat-label  { font-family: var(--font-ui); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--mid); margin-top: 4px; }
.admin-table-wrap { background: white; border: 1px solid var(--rule); overflow-x: auto; box-shadow: var(--shadow-xs); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: var(--ink); color: white; font-family: var(--font-ui); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 12px 16px; text-align: left; }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--rule-light); font-family: var(--font-ui); font-size: 13px; color: var(--ink-3); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--cream); }
.status-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; font-family: var(--font-ui); }
.status-published { background: #d4edda; color: #155724; }
.status-draft     { background: #fff3cd; color: #856404; }
.type-badge { display: inline-block; font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; font-family: var(--font-ui); border: 1px solid; }
.type-standard { border-color: var(--blue); color: var(--blue); }
.type-flipbook { border-color: var(--gold); color: var(--gold); }
.admin-form-card { background: white; border: 1px solid var(--rule); padding: 28px; box-shadow: var(--shadow-xs); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.form-group input, .form-group select, .form-group textarea { border: 1.5px solid var(--rule); padding: 10px 12px; font-family: var(--font-ui); font-size: 14px; color: var(--ink); background: white; outline: none; transition: border-color var(--transition); width: 100%; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--ink); }
.form-group textarea { resize: vertical; min-height: 300px; font-family: var(--font-body); }
.form-help { font-family: var(--font-ui); font-size: 11px; color: var(--mid); }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.alert { padding: 12px 16px; font-family: var(--font-ui); font-size: 13px; margin-bottom: 20px; border-left: 4px solid; }
.alert-success { background: #d4edda; color: #155724; border-color: #28a745; }
.alert-error   { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #17a2b8; }
.login-page { min-height: 100vh; background: var(--ink); display: flex; align-items: center; justify-content: center; background-image: repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(255,255,255,.018) 24px, rgba(255,255,255,.018) 25px), repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(255,255,255,.018) 24px, rgba(255,255,255,.018) 25px); }
.login-card { background: white; width: 100%; max-width: 400px; padding: 48px 40px; box-shadow: var(--shadow-xl); }
.login-logo { font-family: var(--font-display); font-size: 34px; font-weight: 900; letter-spacing: -0.03em; text-align: center; margin-bottom: 8px; }
.login-logo span { color: var(--red); }
.login-subtitle { font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; text-align: center; color: var(--mid); margin-bottom: 32px; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .content-layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }

  /* Featured stacks vertically */
  .featured-grid { grid-template-columns: 1fr; min-height: auto; }
  .featured-image-link { min-height: 300px; }
  .featured-body { border-left: none; border-top: 1px solid var(--rule); }

  /* Flipbook: hide desktop book, show mobile */
  .fb-book-scene { display: none; }
  .fb-mobile-wrap { display: flex; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .top-bar-right   { display: none; }
  .masthead-search { display: none; }
  .main-nav ul     { display: none; }
  .mobile-menu-btn { display: block; }
  .main-nav.open ul {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--ink);
    z-index: 300;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .main-nav.open a { height: 44px; border-right: none; border-bottom: 1px solid rgba(255,255,255,.06); }
  .footer-grid   { grid-template-columns: 1fr; }
  .form-grid     { grid-template-columns: 1fr; }
  .flipbook-title-wrap h1 { font-size: 13px; }
  .flipbook-page-counter  { display: none; }
  .flipbook-btn   { padding: 0 12px; font-size: 11px; }
  .article-list-item { grid-template-columns: 100px 1fr; gap: 12px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .article-list-item { grid-template-columns: 1fr; }
  .list-image { display: none; }
  .sidebar { grid-template-columns: 1fr; }
  .featured-image-link { min-height: 220px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLIPBOOK MODAL  v3.0 — Premium real-book experience
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Modal overlay wrapper ─────────────────────────────────────────────── */
.flipbook-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  /* display is controlled entirely by JS inline style — no CSS display here */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* JS sets display:flex, then adds this class to trigger fade-in */
.flipbook-modal.fb-modal-open {
  opacity: 1;
}

.flipbook-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.flipbook-modal-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

/* ── Shell (the actual reader UI) ──────────────────────────────────────── */
.fb-modal-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  pointer-events: all;
  animation: fbShellSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fbShellSlideIn {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.fb-modal-header {
  flex-shrink: 0;
  background: rgba(10, 9, 8, 0.98);
  border-bottom: 2px solid var(--red);
  padding: 0 clamp(12px, 3vw, 32px);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.fb-modal-title { overflow: hidden; min-width: 0; flex: 1; }

.fb-modal-headline {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.4vw, 17px);
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.fb-modal-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 2px;
}

.fb-modal-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fb-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all 0.18s ease;
  border-radius: 3px;
  flex-shrink: 0;
}

.fb-ctrl-btn:hover:not(:disabled) {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.fb-ctrl-btn:disabled {
  opacity: 0.22;
  cursor: default;
}

.fb-ctrl-close {
  margin-left: 4px;
}

.fb-ctrl-close:hover {
  background: rgba(192, 57, 43, 0.8) !important;
  border-color: var(--red) !important;
}

.fb-ctrl-counter {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  min-width: 64px;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── Progress bar ─────────────────────────────────────────────────────── */
.fb-modal-progress {
  flex-shrink: 0;
  height: 2px;
  background: rgba(255,255,255,0.06);
}

.fb-modal-progress-fill {
  height: 100%;
  background: var(--red);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ── Stage ───────────────────────────────────────────────────────────── */
.fb-modal-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vh, 36px) clamp(16px, 3vw, 48px);
  overflow: hidden;
  background: #18110a;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(120,60,10,.15) 0%, transparent 70%),
    radial-gradient(ellipse 50% 80% at 0% 100%, rgba(0,0,0,.3) 0%, transparent 60%);
}

/* ── Spread (desktop two-page book) ───────────────────────────────────── */
.fb-spread {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Subtle floor shadow */
.fb-book-shadow {
  position: absolute;
  bottom: -24px;
  left: 10%;
  right: 10%;
  height: 40px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.65) 0%, transparent 70%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.fb-book-wrap {
  position: relative;
  display: flex;
  height: min(580px, 78vh);
  width: min(880px, 88vw);
  max-width: 900px;
  /* Subtle 3D tilt for realism */
  transform: perspective(2400px) rotateX(1.2deg);
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.75),
    0  8px 24px rgba(0,0,0,0.5);
  z-index: 1;
}

.fb-book-wrap:hover {
  transform: perspective(2400px) rotateX(0.4deg);
}

/* ── Spine ───────────────────────────────────────────────────────────── */
.fb-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 5px;
  margin-left: -2.5px;
  background: linear-gradient(to right, #8a7860, #c4aa84, #b09a72, #8a7860);
  z-index: 20;
  box-shadow:
    0 0 8px rgba(0,0,0,0.45),
    inset 0 0 4px rgba(255,255,255,0.2);
}

/* ── Pages ───────────────────────────────────────────────────────────── */
.fb-page {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  /* Paper texture via lines */
  background: #fffef9;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 26px,
      rgba(0,0,0,0.026) 26px,
      rgba(0,0,0,0.026) 27px
    );
}

.fb-page-left {
  /* Spine-side shadow (right edge) */
  box-shadow:
    inset -20px 0 40px rgba(0,0,0,0.13),
    inset  -4px 0  8px rgba(0,0,0,0.09);
}

/* Left-page corner fold */
.fb-page-left::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  border-style: solid;
  border-width: 28px 0 0 28px;
  border-color: transparent transparent transparent #f0ece2;
  pointer-events: none;
  z-index: 5;
}

/* ── Right page + flip container ─────────────────────────────────────── */
.fb-page-right {
  position: relative;
  overflow: visible; /* allow flip to extend */
}

.fb-flip-container {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: left center;
  /* NOT transitioning by default – animation class handles it */
}

.fb-flip-front,
.fb-flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fffef9;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 26px,
    rgba(0,0,0,0.026) 26px, rgba(0,0,0,0.026) 27px
  );
  overflow: hidden;
}

.fb-flip-front {
  /* Spine-side shadow (left edge on right page) */
  box-shadow:
    inset 20px 0 40px rgba(0,0,0,0.10),
    inset  4px 0  8px rgba(0,0,0,0.07);
}

/* Right-page corner fold */
.fb-flip-front::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  border-style: solid;
  border-width: 0 0 28px 28px;
  border-color: transparent transparent #f0ece2 transparent;
  pointer-events: none;
}

.fb-flip-back {
  transform: rotateY(180deg);
  /* Mirror the left-page shadow since this becomes the new left page */
  box-shadow:
    inset -20px 0 40px rgba(0,0,0,0.13),
    inset  -4px 0  8px rgba(0,0,0,0.09);
}

/* ── Flip animations ─────────────────────────────────────────────────── */
.fb-flip-container.flipping-forward {
  animation: fbFlipForward 0.60s cubic-bezier(0.42, 0, 0.58, 1.0) forwards;
}

.fb-flip-container.flipping-backward {
  animation: fbFlipBackward 0.60s cubic-bezier(0.42, 0, 0.58, 1.0) forwards;
}

@keyframes fbFlipForward {
  0%   {
    transform: rotateY(0deg);
    filter: none;
  }
  35%  {
    transform: rotateY(-42deg);
    filter: drop-shadow(-12px 0 20px rgba(0,0,0,0.35));
  }
  50%  {
    transform: rotateY(-90deg);
    filter: drop-shadow(-20px 0 30px rgba(0,0,0,0.50));
  }
  65%  {
    transform: rotateY(-138deg);
    filter: drop-shadow(-12px 0 20px rgba(0,0,0,0.30));
  }
  100% {
    transform: rotateY(-180deg);
    filter: none;
  }
}

@keyframes fbFlipBackward {
  0%   { transform: rotateY(-180deg); filter: none; }
  35%  { transform: rotateY(-138deg); filter: drop-shadow(12px 0 20px rgba(0,0,0,0.35)); }
  50%  { transform: rotateY(-90deg);  filter: drop-shadow(20px 0 30px rgba(0,0,0,0.50)); }
  65%  { transform: rotateY(-42deg);  filter: drop-shadow(12px 0 20px rgba(0,0,0,0.30)); }
  100% { transform: rotateY(0deg);    filter: none; }
}

/* ── Page inner content ──────────────────────────────────────────────── */
.fb-page-content-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.fb-pg-inner {
  padding: clamp(20px, 3.5%, 44px);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.fb-pg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1.5px solid #ddd8ce;
  flex-shrink: 0;
}

.fb-pg-logo {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: rgba(0,0,0,0.28);
}
.fb-pg-logo em { font-style: normal; color: rgba(192,57,43,0.6); }

.fb-pg-section {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.28);
}

.fb-pg-body {
  flex: 1;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: clamp(12px, 1.05vw, 13.5px);
  line-height: 1.72;
  color: #252525;
}
.fb-pg-body p          { margin-bottom: 0.82em; }
.fb-pg-body h2         { font-family: var(--font-display); font-size: 1.28em; font-weight: 700; margin: 0.9em 0 0.42em; letter-spacing: -.015em; color: #111; }
.fb-pg-body h3         { font-family: var(--font-display); font-size: 1.08em; font-weight: 700; margin: 0.8em 0 0.38em; }
.fb-pg-body blockquote { border-left: 3px solid var(--red); padding: 4px 0 4px 12px; margin: 0.8em 0; font-style: italic; color: #555; font-size: 0.94em; }
.fb-pg-body ul, .fb-pg-body ol { margin: 0.65em 0 0.65em 1.15em; }
.fb-pg-body li { margin-bottom: 0.26em; }
.fb-pg-body a  { color: var(--red); }

.fb-pg-footer {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid #e2ddd2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fb-pg-num  { font-family: var(--font-ui); font-size: 10px; color: #bbb; letter-spacing: 0.08em; }
.fb-pg-date { font-family: var(--font-ui); font-size: 10px; color: rgba(0,0,0,0.18); }

/* ── Cover page ──────────────────────────────────────────────────────── */
.is-cover .fb-page-content-wrap { background: var(--ink); }
.is-cover.fb-flip-front          { background: var(--ink); }
.is-cover.fb-flip-back           { background: var(--ink); }
.is-cover::after                 { display: none; }
.fb-flip-front.is-cover::after   { display: none; }

.fb-pg-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.fb-pg-cover-img {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.fb-pg-cover-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.38;
  display: block;
}

.fb-pg-cover-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(13,13,13,0.22) 0%,
    rgba(13,13,13,0.04) 35%,
    rgba(13,13,13,0.72) 68%,
    rgba(13,13,13,0.97) 100%
  );
}

.fb-pg-cover-top {
  position: absolute;
  top: 20px; left: 22px; right: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.fb-pg-cover-brand { font-family: var(--font-display); font-size: 16px; font-weight: 900; color: white; letter-spacing: -0.02em; }
.fb-pg-cover-brand em { font-style: normal; color: var(--red-light); }
.fb-pg-cover-date  { font-family: var(--font-ui); font-size: 9px; color: rgba(255,255,255,.38); letter-spacing: 0.1em; text-transform: uppercase; }

.fb-pg-cover-body {
  position: relative;
  z-index: 2;
  padding: 20px 22px 22px;
}
.fb-pg-cover-cat {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: white; background: var(--red);
  padding: 3px 9px; margin-bottom: 11px;
}
.fb-pg-cover-title {
  font-family: var(--font-display);
  font-size: clamp(15px, 2.8vw, 24px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: white;
  margin: 0 0 11px;
}
.fb-pg-cover-byline {
  font-family: var(--font-ui);
  font-size: 11px; color: rgba(255,255,255,.45);
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 10px;
}
.fb-pg-cover-byline strong { color: rgba(255,255,255,.7); font-weight: 600; }

/* ── Back cover ──────────────────────────────────────────────────────── */
.is-back .fb-page-content-wrap { background: #0e0d0c; }
.is-back::after { display: none; }

.fb-pg-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 18px,
    rgba(255,255,255,0.012) 18px, rgba(255,255,255,0.012) 19px
  );
}

.fb-pg-back-brand { font-family: var(--font-display); font-size: 30px; font-weight: 900; color: white; letter-spacing: -0.03em; line-height: 1; }
.fb-pg-back-brand em { font-style: normal; color: var(--red-light); }
.fb-pg-back-rule  { width: 32px; height: 2px; background: var(--red); flex-shrink: 0; }
.fb-pg-back-tag   { font-family: var(--font-ui); font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255,255,255,.26); }

.fb-pg-back-links { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; width: 100%; }

.fb-pg-back-btn {
  display: block;
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.14);
  padding: 9px 18px;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  text-align: center;
}
.fb-pg-back-btn:hover { background: rgba(255,255,255,.08); color: white; }
.fb-pg-back-btn.primary { background: var(--red); border-color: var(--red); color: white; }
.fb-pg-back-btn.primary:hover { background: var(--red-dark); }

/* ── Blank page ──────────────────────────────────────────────────────── */
.is-blank .fb-page-content-wrap { background: #f7f4ee; }
.fb-pg-blank { position: absolute; inset: 0; }

/* ── Mobile single page ──────────────────────────────────────────────── */
.fb-single {
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  gap: 16px;
}

.fb-page-mobile {
  width: 100%;
  min-height: min(520px, 65vh);
  position: relative;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.72),
    0  6px 18px rgba(0,0,0,0.45);
}

/* Mobile slide animations */
.fb-slide-out-left  { animation: fbSlideOutL 0.26s ease forwards; }
.fb-slide-out-right { animation: fbSlideOutR 0.26s ease forwards; }
.fb-slide-in-right  { animation: fbSlideInR  0.26s ease forwards; }
.fb-slide-in-left   { animation: fbSlideInL  0.26s ease forwards; }

@keyframes fbSlideOutL  { to { transform: translateX(-50px); opacity: 0; } }
@keyframes fbSlideOutR  { to { transform: translateX(50px);  opacity: 0; } }
@keyframes fbSlideInR   { from { transform: translateX(50px);  opacity: 0; } }
@keyframes fbSlideInL   { from { transform: translateX(-50px); opacity: 0; } }

.fb-single-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.fb-mobile-nav-btn {
  flex: 1;
  max-width: 120px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.82);
  padding: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  border-radius: 2px;
}
.fb-mobile-nav-btn:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: white; }
.fb-mobile-nav-btn:disabled { opacity: 0.22; cursor: default; }

.fb-mobile-nav-counter {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  text-align: center;
  min-width: 60px;
}

/* ── Loading spinner ─────────────────────────────────────────────────── */
.fb-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: fbSpin 0.75s linear infinite;
}
@keyframes fbSpin { to { transform: rotate(360deg); } }

/* ── Flipbook open button (on article page) ──────────────────────────── */
.flipbook-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 13px 28px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.flipbook-open-btn:hover {
  background: var(--red);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* ── Flipbook article card badge (on homepage cards) ─────────────────── */
.flipbook-modal-badge {
  cursor: pointer;
}
.flipbook-modal-badge:hover { opacity: 0.85; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */
.footer-tagline {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  margin-top: 12px;
  font-style: italic;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOMEPAGE SECTION IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Better card grid gaps */
.grid-3 { gap: 20px; }
.grid-2 { gap: 20px; }

/* Section spacing */
.section { padding: 36px 0; }

/* Category section header color accent */
.section-header.cat-politics  { border-top-color: #c0392b; }
.section-header.cat-business  { border-top-color: #1a6e3c; }
.section-header.cat-world     { border-top-color: #1a3a5c; }
.section-header.cat-technology{ border-top-color: #6e2fa0; }
.section-header.cat-health    { border-top-color: #b06020; }
.section-header.cat-sports    { border-top-color: #1a5e8a; }
.section-header.cat-entertainment { border-top-color: #8a1a4e; }
.section-header.cat-science   { border-top-color: #1a7a6e; }

/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT / CONTACT PAGE IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .about-grid, .contact-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLIPBOOK MODAL RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .fb-book-wrap { display: none; }
  .fb-book-shadow { display: none; }
  .fb-single { display: flex !important; }
  .fb-spread { pointer-events: none; }
}

@media (max-width: 480px) {
  .fb-modal-header { height: 50px; }
  .fb-modal-headline { font-size: 12px; }
  .fb-modal-meta { display: none; }
  .fb-ctrl-counter { display: none; }
  .fb-ctrl-btn { width: 32px; height: 32px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v4.0 ADDITIONS — Flipbook Book Lifecycle + Mobile Fixes + Homepage
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Flipbook: nav control visibility transition ─────────────────────── */
.fb-ctrl-nav {
  transition: opacity 0.3s ease !important;
}

/* ── Cover state wrapper ─────────────────────────────────────────────── */
.fb-cover-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 24px;
  animation: fbCoverAppear 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fbCoverAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.fb-cover-state-out {
  animation: fbCoverOut 0.3s ease forwards !important;
}
@keyframes fbCoverOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.9); }
}

/* ── Closed book scene ─────────────────────────────────────────────── */
.fb-closed-book-scene {
  perspective: 1800px;
  perspective-origin: 50% 45%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fb-closed-book {
  position: relative;
  width: clamp(180px, 22vw, 280px);
  height: clamp(240px, 32vw, 380px);
  cursor: pointer;
  transform: rotateY(-22deg) rotateX(4deg);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
  box-shadow:
    -12px 16px 50px rgba(0,0,0,0.75),
     -4px  6px 18px rgba(0,0,0,0.55);
}

.fb-closed-book:hover {
  transform: rotateY(-8deg) rotateX(2deg) translateY(-6px);
  box-shadow:
    -20px 28px 70px rgba(0,0,0,0.82),
     -6px 10px 24px rgba(0,0,0,0.6);
}

/* The book cover face */
.fb-cbook-cover {
  position: absolute;
  inset: 0;
  background: #111;
  overflow: hidden;
  border-radius: 1px 3px 3px 1px;
}

.fb-cbook-img {
  position: absolute;
  inset: 0;
}
.fb-cbook-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.45;
}

.fb-cbook-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10,10,10,0.2) 0%,
    rgba(10,10,10,0.05) 30%,
    rgba(10,10,10,0.65) 65%,
    rgba(10,10,10,0.96) 100%
  );
}

.fb-cbook-top {
  position: absolute;
  top: 16px; left: 14px; right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}
.fb-cbook-brand {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.5vw, 15px);
  font-weight: 900;
  color: white;
  letter-spacing: -0.02em;
}
.fb-cbook-brand em { font-style: normal; color: var(--red-light); }
.fb-cbook-edition {
  font-family: var(--font-ui);
  font-size: 8px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fb-cbook-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 3;
  padding: 14px;
}
.fb-cbook-cat {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: white;
  background: var(--red);
  padding: 3px 8px;
  margin-bottom: 8px;
}
.fb-cbook-title {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.8vw, 18px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: white;
  margin: 0 0 8px;
}
.fb-cbook-by {
  font-family: var(--font-ui);
  font-size: 10px;
  color: rgba(255,255,255,0.42);
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 8px;
}
.fb-cbook-by strong { color: rgba(255,255,255,0.65); }

/* Spine (left side of closed book) */
.fb-cbook-spine {
  position: absolute;
  top: 0; bottom: 0;
  left: -18px;
  width: 18px;
  background: linear-gradient(to right, #1a1510, #2e261e, #3a3028);
  transform: rotateY(-90deg);
  transform-origin: right center;
  backface-visibility: hidden;
  border-radius: 2px 0 0 2px;
  box-shadow: inset -3px 0 8px rgba(0,0,0,0.4);
}

/* Pages stack illusion (right side) */
.fb-cbook-pages {
  position: absolute;
  top: 2px; bottom: 2px;
  right: -6px;
  width: 6px;
  background: repeating-linear-gradient(
    to right,
    #f5f2ea, #f5f2ea 1px,
    #e8e4da 1px, #e8e4da 2px
  );
  border-radius: 0 2px 2px 0;
  box-shadow: 2px 0 6px rgba(0,0,0,0.3);
}

/* ── Open book button ──────────────────────────────────────────────── */
.fb-open-book-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--red);
  color: white;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 28px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(192,57,43,0.45);
}
.fb-open-book-btn:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(192,57,43,0.55);
}

/* ── Cover hint text ───────────────────────────────────────────────── */
.fb-cover-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.05em;
  text-align: center;
}

/* ── Reading state ─────────────────────────────────────────────────── */
.fb-reading-state {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 0;
}

@keyframes fbBookOpen {
  0%   { opacity: 0; transform: perspective(1600px) rotateY(-35deg) scale(0.82); }
  60%  { opacity: 1; transform: perspective(1600px) rotateY(3deg)   scale(1.01); }
  80%  { transform: perspective(1600px) rotateY(-1deg) scale(0.995); }
  100% { opacity: 1; transform: perspective(1600px) rotateY(0deg)   scale(1);    }
}

.fb-reading-state-opening .fb-book-wrap,
.fb-reading-state-opening .fb-single {
  animation: fbBookOpen 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fbBookClose {
  0%   { opacity: 1; transform: perspective(1600px) rotateY(0deg) scale(1); }
  100% { opacity: 0; transform: perspective(1600px) rotateY(-40deg) scale(0.8); }
}

.fb-reading-state-closing .fb-book-wrap,
.fb-reading-state-closing .fb-single {
  animation: fbBookClose 0.35s ease-in forwards;
}

/* Ensure the spread and single fill reading state */
.fb-reading-state .fb-spread,
.fb-reading-state .fb-single {
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE NAV — FIXED HAMBURGER
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 0 16px;
    height: 46px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
  }

  .main-nav .container {
    flex-wrap: wrap;
    padding: 0;
  }

  .main-nav ul {
    width: 100%;
    position: static !important;
    flex-direction: column;
    display: none !important;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .main-nav.open ul {
    display: flex !important;
  }

  .main-nav ul li a {
    height: 46px !important;
    padding: 0 20px !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    font-size: 12px !important;
  }

  .nav-admin { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL MOBILE RESPONSIVENESS FIXES
   ═══════════════════════════════════════════════════════════════════════════ */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Article page sidebar goes below on mobile */
@media (max-width: 768px) {
  /* Article layout: single column */
  .container > div[style*="grid-template-columns:1fr 280px"] {
    grid-template-columns: 1fr !important;
  }
  .sidebar[style*="position:sticky"] {
    position: static !important;
  }

  /* Article images don't overflow */
  .article-featured-image img {
    max-height: 260px !important;
    object-fit: cover;
  }

  /* Article body text comfortable on mobile */
  .article-body {
    font-size: 16px !important;
    line-height: 1.72 !important;
  }

  .article-headline {
    font-size: clamp(22px, 6vw, 32px) !important;
  }

  /* Author block fix */
  div[style*="display:flex;align-items:center;gap:18px"] {
    flex-wrap: wrap;
  }

  /* Featured section fully responsive */
  .featured-grid {
    grid-template-columns: 1fr !important;
  }

  .featured-body {
    padding: 24px 20px !important;
  }

  /* Content layout full width */
  .content-layout {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 24px 0 !important;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr !important;
  }

  /* Cards don't stretch badly */
  .grid-3, .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Masthead responsive — logo stays left, search wraps below */
  .masthead-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
  }
  .masthead-search {
    width: 100%;
    display: flex !important;
  }
  .masthead-search input {
    width: 100%;
    flex: 1;
  }

  /* Top bar single line */
  .top-bar .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .top-bar-right { display: flex !important; gap: 12px; }
  .top-bar-left  { gap: 8px; }

  /* Footer responsive */
  .footer-grid { grid-template-columns: 1fr !important; gap: 28px; }

  /* Ticker: identical on all screen sizes — no mobile override needed */

  /* Section headers */
  .section { padding: 28px 0; }
  .section-header { margin-bottom: 16px; }
}

@media (max-width: 480px) {
  /* Logo stays horizontal on mobile — just shrinks */
  .site-logo-svg { height: 42px; max-width: 240px; }

  .article-byline { flex-direction: column; align-items: flex-start; gap: 8px; }
  .byline-views { margin-left: 0 !important; }

  .card-body { padding: 14px 12px 12px; }
  .card-title { font-size: 15px; }

  .featured-title { font-size: clamp(20px, 6vw, 28px); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOMEPAGE — PREMIUM LAYOUT ENHANCEMENTS
   Inspired by premium international news portals (Al Jazeera / BBC style)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sharper section dividers */
.section + .section {
  border-top: 1px solid var(--rule);
}

/* Latest News: make first article larger (editorial lead) */
.latest-lead-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Category sections: alternate layout for visual variety */
.cat-section-alt .grid-3 {
  grid-template-columns: 1.5fr 1fr 1fr;
}

/* Improved section header with category accent bar */
.section-header-accent {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: none !important;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 12px 0;
  margin-bottom: 24px;
}
.section-header-accent .accent-bar {
  width: 4px;
  height: 22px;
  background: var(--red);
  flex-shrink: 0;
  border-radius: 1px;
}
.section-header-accent h2 {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-header-accent a {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.04em;
  margin-left: auto;
}
.section-header-accent a:hover { text-decoration: underline; }

/* ── BREAKING / Featured HERO enhancement ─────────────────────────── */
.featured-section {
  background: linear-gradient(to bottom, #fefefe 0%, var(--cream) 100%);
}

/* Make featured body feel like real editorial */
.featured-body {
  background: white;
}

.featured-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Article card enhancements ─────────────────────────────────────── */
.article-card {
  border-top: 2px solid transparent;
  transition: box-shadow 0.22s ease, transform 0.22s ease, border-top-color 0.22s ease;
}
.article-card:hover {
  border-top-color: var(--red);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ── Homepage breaking-news style top label ─────────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
}

/* ── Trending sidebar improvement ───────────────────────────────────── */
.trending-num {
  font-size: 22px;
  color: rgba(0,0,0,0.08);
  font-weight: 900;
}
.trending-item:hover .trending-num {
  color: var(--red);
  transition: color 0.2s;
}

/* ── Homepage responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .latest-lead-grid {
    grid-template-columns: 1fr 1fr;
  }
  .cat-section-alt .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .latest-lead-grid {
    grid-template-columns: 1fr;
  }
  .cat-section-alt .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLIPBOOK COVER STATE MOBILE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .fb-closed-book {
    width: clamp(150px, 45vw, 200px);
    height: clamp(200px, 60vw, 270px);
    transform: rotateY(-15deg) rotateX(3deg);
  }
  .fb-closed-book:hover {
    transform: rotateY(-6deg) rotateX(2deg) translateY(-4px);
  }
  .fb-open-book-btn {
    font-size: 12px;
    padding: 11px 22px;
  }
  .fb-cover-hint {
    font-size: 10px;
    padding: 0 16px;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ARTICLE PAGE MOBILE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Article grid single col */
  .article-layout-grid {
    grid-template-columns: 1fr !important;
    padding: 24px 0 40px !important;
  }

  /* Related articles */
  .related-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Prevent any element from exceeding viewport width */
* {
  max-width: 100%;
  box-sizing: border-box;
}
img { max-width: 100%; height: auto; }


/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT + CONTACT PAGE — RESPONSIVE GRIDS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Main 2-col layout */
.about-grid,
.contact-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 60px;
  padding-top: 40px;
}

/* 2-col sections grid inside About */
.about-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* 2-col form name/email row */
.contact-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 600px) {
  .about-sections-grid {
    grid-template-columns: 1fr;
  }
  .contact-form-row {
    grid-template-columns: 1fr;
  }
  .about-grid,
  .contact-grid {
    padding-top: 24px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Admin pages.php — contact entry grid responsive
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .contact-entry-grid {
    grid-template-columns: 52px 1fr !important;
  }
  .contact-entry-grid .form-group:nth-child(3),
  .contact-entry-grid .form-group:nth-child(4) {
    grid-column: 2;
  }
}
