/* ==============================================
   Pamyatnik — Modern Responsive Stylesheet
   Palette: Option 3 — Lighter / Airier Teal
   ============================================== */

:root {
  --bg-primary: #F2F6F7;
  --bg-secondary: #FFFFFF;
  --bg-sidebar: #E8F0F2;
  --accent-primary: #2B8A96;
  --accent-secondary: #45B5C0;
  --text-primary: #2A3B40;
  --text-heading: #1A5560;
  --nav-bg: #1E4A54;
  --nav-bg-dark: #163940;
  --highlight: #5CD6C8;
  --border: #D0DADD;
  --link: #2B8A96;
  --nav-text: #F2F6F7;
  --status-ready: #2E9E6B;
  --status-new: #D94040;
  --shadow-sm: 0 1px 3px rgba(30,74,84,0.08);
  --shadow-md: 0 4px 12px rgba(30,74,84,0.1);
  --shadow-lg: 0 8px 24px rgba(30,74,84,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-heading: Verdana, Geneva, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', Arial, sans-serif;
  --transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-secondary); }

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.3;
  margin: 0 0 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
h4, h5, h6 { font-size: 1rem; }

p { margin: 0 0 1em; }

blockquote {
  margin: 0;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--accent-secondary);
  color: var(--text-primary);
  font-size: 0.9375rem;
}

/* === Skip Links (accessibility) === */
.skipLinks {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--nav-bg);
  color: #fff;
  padding: 8px 16px;
  z-index: 9999;
  font-size: 0.875rem;
}
.skipLinks:focus-within { top: 0; }
.skipLinks a { color: var(--highlight); margin: 0 8px; }

/* === Masthead (Header) === */
#masthead {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  box-shadow: var(--shadow-md);
}

.masthead-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Top bar: logo + utility */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  gap: 1rem;
}

#logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

#logo a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--highlight);
  text-decoration: none;
}

.monument-icon-wrap {
  position: relative;
  width: 37px;
  height: 52px;
  flex-shrink: 0;
}

#logo img.monument-icon,
#logo img.monument-icon-hover {
  width: 37px;
  height: 52px;
  border-radius: var(--radius-sm);
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.3s;
}

#logo img.monument-icon-hover {
  opacity: 0;
}

#logo a:hover img.monument-icon {
  opacity: 0;
}

#logo a:hover img.monument-icon-hover {
  opacity: 1;
}

#logo .site-logo-img {
  height: 40px;
  width: auto;
}

/* Animated site logo text (replaces Pamyatnik1.gif) */
.site-logo-text {
  display: inline-block;
  height: 44px;
  line-height: 44px;
  margin-left: 4px;
  font-family: 'Monotype Corsiva', 'Apple Chancery', 'ITC Zapf Chancery', cursive;
  font-size: 32px;
  font-weight: bold;
  font-style: italic;
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
  overflow: visible;
  padding-right: 4px;
  min-width: 210px;
}
.site-logo-text.en { font-size: 32px; }

/* Monument-rise animation: each letter scales up from bottom */
.site-logo-char {
  display: inline-block;
  transform: scaleY(0);
  transform-origin: bottom;
  opacity: 0;
}
.site-logo-char.rise {
  animation: monumentRise 0.25s ease-out forwards;
}
@keyframes monumentRise {
  0%   { transform: scaleY(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: scaleY(1); opacity: 1; }
}

/* Wipe-right animation: text clips from left to right */
.site-logo-wipe {
  display: inline-block;
  clip-path: inset(0 100% 0 0);
}
.site-logo-wipe.wipe {
  animation: wipeRight 3s ease-out forwards;
}
@keyframes wipeRight {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0% 0 0); }
}

/* Utility links (top-right) */
#utility {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
}

#utility a {
  color: rgba(242,246,247,0.75);
  transition: color var(--transition);
  white-space: nowrap;
}

#utility a:hover { color: #fff; }

/* Language toggle */
.lang-toggle {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition);
}

.lang-toggle:hover { background: var(--accent-secondary); }

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--nav-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* === Global Navigation === */
#globalNav {
  background: var(--nav-bg-dark);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.globalNav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#globalLink {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

a.glink, a.glink:visited {
  font-size: 0.875rem;
  color: rgba(242,246,247,0.85);
  font-weight: 600;
  padding: 0.625rem 0.875rem;
  border-right: 1px solid rgba(255,255,255,0.1);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

a.glink:last-child { border-right: none; }

a.glink:hover {
  background: rgba(92,214,200,0.15);
  color: #fff;
  text-decoration: none;
}

/* Search in nav */
#search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#search input[type="text"] {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: var(--font-body);
  width: 140px;
  transition: border-color var(--transition), width var(--transition);
}

#search input[type="text"]::placeholder { color: rgba(255,255,255,0.4); }
#search input[type="text"]:focus {
  outline: none;
  border-color: var(--highlight);
  width: 180px;
}

#searchbtn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition);
}

#searchbtn:hover { background: var(--accent-secondary); }

/* Sub-navigation dropdowns */
.subglobalNav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--accent-primary);
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: 999;
  box-shadow: var(--shadow-md);
  /* Center content to match globalNav-inner */
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  gap: 0.25rem 0.25rem;
  /* Extend background full-width beyond centered content */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.subglobalNav::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100vw;
  right: -100vw;
  background: var(--accent-primary);
  z-index: -1;
}

.subglobalNav.visible {
  visibility: visible;
  opacity: 1;
}

.subglobalNav a:link, .subglobalNav a:visited {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.9);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.subglobalNav a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

/* === Page Layout === */
#pagecell1 {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  min-height: calc(100vh - 200px);
}

/* Nav & sidebar decorative icons */
a[data-i18n="nav.adventures"]::after {
  content: '\2122';
  color: #61CBF4;
  font-size: 0.78em;
  vertical-align: super;
}
a[data-i18n="sidebar.wife"]::after {
  content: ' \2665';
  color: #E8657C;
  font-size: 1.15em;
}
a[data-i18n="sidebar.newspapers"]::after {
  content: ' \1F3A8';
}
a[data-i18n="sidebar.august16"]::after {
  content: ' \1F319';
}

/* Breadcrumb */
#breadCrumb {
  padding: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#breadCrumb a {
  color: var(--accent-primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  font-size: 0.80em;
  line-height: 1;
  position: relative;
  top: 1px;
}

#breadCrumb a:hover {
  background: rgba(43,138,150,0.1);
  text-decoration: none;
}

/* Main content grid: sidebar + content */
.page-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* === Sidebar Navigation === */
#pageNav {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 120px;
}

#sectionLinks {
  padding: 0;
}

/* Shared sidebar section headings */
#pageNav h3 {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--accent-primary);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  margin: 0;
}

/* Shared sidebar link style */
#pageNav a:link, #pageNav a:visited {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border);
  background: none;
  transition: background var(--transition), color var(--transition), padding-left var(--transition);
}

#pageNav a:hover {
  background: rgba(43,138,150,0.06);
  color: var(--accent-primary);
  padding-left: 1.25rem;
  text-decoration: none;
}

.relatedLinks {
  padding: 0;
  border-bottom: none;
}

.relatedLinks:last-of-type { border-bottom: none; }

/* Sidebar ad/promo */
#advert {
  padding: 0.75rem;
  text-align: center;
}

#advert img {
  display: block;
  margin: 0 auto 0.5rem;
  border-radius: var(--radius-sm);
  max-width: 100%;
}

#advert a:link, #advert a:visited {
  border-bottom: none;
  text-align: center;
  font-weight: 600;
}

/* === Content Area === */
#content {
  padding: 0;
  margin: 0;
  border: none;
}

/* Feature (hero) section */
.feature {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  height: auto;
  font-size: 0.9375rem;
}

.feature h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.feature h3 {
  font-size: 1.25rem;
  padding: 1rem 0 0.5rem;
}

.feature img {
  float: none;
  padding: 0;
}

.feature video {
  border-radius: var(--radius-md);
  max-width: 100%;
  height: auto;
}

/* ── InLaws Title Wipe Animation ───────────────── */

.inlaws-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;       /* matches .feature h2 size */
  color: var(--text-heading);
  text-align: center;
  margin: 0.5rem 0;
  padding: 0.25rem 0;
  clip-path: inset(0 100% 0 0);
}

.inlaws-title.wipe-active {
  animation: inlawsWipeRight 3s ease-out forwards;
}

@keyframes inlawsWipeRight {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* ── Credits Roll (SamSebe page) ───────────────── */
.credits-viewport {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 450px;
  margin: 1rem auto;
  overflow: hidden;
  background: linear-gradient(170deg, #0d2831 0%, #132d35 40%, #0a1e24 100%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(92,214,200,0.08);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.credits-track {
  position: absolute;
  left: 0;
  right: 0;
  padding: 0 2rem;
  will-change: transform;
}

.credits-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.6rem 0;
}

.credits-row.credits-sub {
  padding-left: 2.5rem;
}

.credits-role {
  font-family: "Merriweather", Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.4;
  color: #c0d4d9;
  text-align: left;
}

.credits-name {
  font-family: "Merriweather", Georgia, serif;
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--highlight);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.credits-section {
  font-family: "Merriweather", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.4;
  color: #ffffff;
  text-align: left;
  padding: 1rem 0 0.2rem;
  letter-spacing: 0.03em;
}

/* ── Hero Animation (Main page) ────────────────── */

.hero-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  min-height: 48px;
}

.hero-title {
  font-size: 1.5rem;
  color: var(--text-heading);
  opacity: 0;
  transition: opacity 0.8s ease;
  white-space: nowrap;
  margin: 0;
}

.hero-title.visible {
  opacity: 1;
}

.hero-anim {
  position: relative;
  width: 576px;
  height: 540px;
  max-width: 100%;
  margin: 0 auto 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
}

.hero-phase {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

/* Phase 1 — Welcome + Marble Plaque (Merriweather) */
.p1-line {
  font-family: "Merriweather", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: 3.15rem;    /* scaled from 4rem for 540px height */
  line-height: 1.3;
  text-align: center;
  color: #135674;
  text-shadow:
    0 0 15px rgba(19,86,116,0.4),
    0 0 40px rgba(19,86,116,0.2),
    0 0 80px rgba(19,86,116,0.1);
  opacity: 0;
}

.p1-line.p1-sm {
  font-size: 2.75rem;    /* scaled from 3.5rem */
}

.p1-plaque-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 1.5rem 1rem;
  margin-top: 0.5rem;        /* reasonable gap from "ever", similar to other line gaps */
}

.p1-plaque-wrap .p1-plaque-text {
  font-size: 2.1rem;     /* scaled from 2.7rem */
}

.p1-plaque-img {
  position: absolute;
  width: 352px;              /* scaled from 445px for 540px height */
  max-width: none;           /* override global img { max-width: 100% } */
  height: auto;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

.p1-plaque-text {
  position: relative;
  z-index: 1;
  transition: color 0.8s ease, text-shadow 0.8s ease;
}

.p1-plaque-text.embossed {
  color: rgba(70, 64, 55, 0.6);
  text-shadow:
    -1.5px -1.5px 0.5px rgba(255,255,255,0.9),
     1.5px  1.5px 1.5px rgba(0,0,0,0.3),
     0 0 3px rgba(0,0,0,0.05);
}

/* Phase 2 — Quote (Merriweather Italic, -19.4° rotation, teal glow) */
.p2-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.p2-quote {
  position: relative;
  z-index: 1;
  transform: rotate(-19.4deg);
  padding: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-self: flex-end;
  margin-top: auto;
  margin-bottom: 0.5rem;        /* lowered 30px from 2.4rem */
  margin-right: 1.6rem;         /* scaled from 2rem */
  width: 100%;                 /* full width to fit Russian text in 3 lines */
}

.p2-line {
  display: block;
  font-family: "Merriweather", Georgia, serif;
  font-optical-sizing: auto;
  font-size: 1.6rem;       /* scaled from 2rem */
  font-weight: 400;
  font-style: italic;
  line-height: 1.45;
  color: #fff;
  text-shadow:
    0 0 8px rgba(19,86,116,0.95),
    0 0 20px rgba(19,86,116,0.7),
    0 0 45px rgba(19,86,116,0.45),
    0 0 80px rgba(19,86,116,0.25);
}

.p2-word {
  display: inline-block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.p2-word.visible {
  opacity: 1;
}

/* Phase 3 — Metronome Photo Slideshow */
.p3-photos {
  position: absolute;
  inset: 0;
}

.p3-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.p3-hand {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: min(160px, 28%);
  height: 90%;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: center bottom;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

.p3-hand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
}

/* Story cards */
.story {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
}

.story h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.story p { padding: 0; margin-bottom: 0.75rem; }

.story a.capsule {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--accent-primary);
  display: block;
  padding: 0.375rem 0;
  transition: color var(--transition);
}

.story a.capsule:hover { color: var(--accent-secondary); text-decoration: none; }

/* Story grid (two-column stories) */
.story table { width: 100%; }
.story td { vertical-align: top; padding: 0.5rem; }
td.storyLeft { padding-right: 1rem; }

/* Status labels */
.style6 { color: var(--status-ready); font-weight: 600; }
.style8 { color: var(--status-new); font-weight: 600; }
.style1 { color: var(--text-heading); }

/* === Album / Gallery === */
.album {
  padding: 0;
  font-size: 0.875rem;
  height: auto;
}

.imagetable img {
  padding: 0;
  border-radius: var(--radius-sm);
}

/* === Footer === */
#siteInfo {
  clear: both;
  border-top: none;
  background: var(--nav-bg);
  color: rgba(242,246,247,0.7);
  padding: 1.25rem 1.5rem;
  font-size: 0.8125rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-top: 1.5rem;
  text-align: center;
}

#siteInfo a { color: rgba(242,246,247,0.85); }
#siteInfo a:hover { color: var(--highlight); }
.grey { color: rgba(242,246,247,0.5); }

/* === Audio Player Button === */
.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  border: none;
  padding: 0.375rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition), transform var(--transition), color var(--transition);
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 900;
  box-shadow: var(--shadow-md);
}

.audio-play-btn:hover {
  background: var(--border);
  transform: scale(1.05);
}

.audio-play-btn.playing {
  background: var(--accent-primary);
  color: #fff;
}

.audio-play-btn.playing:hover {
  background: var(--accent-secondary);
}

/* === Page Name (right column label) === */
#pageName {
  position: static;
  width: auto;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

#pageName h2 {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
}

/* === Forms === */
form { padding: 0; }

label {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 0.875rem;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(43,138,150,0.15);
}

/* === Lists === */
ul { list-style-type: disc; padding-left: 1.5rem; }
ul ul { list-style-type: circle; }

/* === Decorative corners (hidden — replaced by border-radius) === */
#tl, #tr { display: none; }

/* === Legacy image spacers === */
img[alt="spacer"], img[name*="spacer"], img[name*="Spacer"] {
  display: none;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet: ≤1024px */
@media (max-width: 1024px) {
  .page-grid {
    grid-template-columns: 180px 1fr;
    gap: 1rem;
  }

  .header-top { flex-wrap: wrap; }

  #search input[type="text"] { width: 120px; }
  #search input[type="text"]:focus { width: 140px; }

  a.glink, a.glink:visited {
    font-size: 0.8125rem;
    padding: 0.5rem 0.625rem;
  }
}

/* Mobile: ≤768px */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .hamburger { display: flex; }

  .header-top {
    flex-wrap: nowrap;
  }

  #utility {
    display: none;
  }

  #utility.mobile-visible {
    display: flex;
    order: 99;
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  /* Mobile nav */
  #globalNav {
    display: none;
  }

  #globalNav.mobile-open {
    display: block;
  }

  .globalNav-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }

  #globalLink {
    flex-direction: column;
    width: 100%;
  }

  a.glink, a.glink:visited {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
  }

  #search {
    padding: 0.75rem 1rem;
    width: 100%;
  }

  #search input[type="text"] { flex: 1; width: auto; }

  .subglobalNav {
    position: static;
    visibility: visible;
    opacity: 1;
    flex-direction: column;
    padding: 0.5rem 1rem 0.5rem 2rem;
    background: rgba(43,138,150,0.15);
    box-shadow: none;
  }

  /* Page layout: stack sidebar under content */
  .page-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #pageNav {
    order: 2;
    position: static;
  }

  #content { order: 1; }

  .feature { padding: 1rem; }
  .story { padding: 1rem; }

  .feature h3 { font-size: 1.125rem; }

  /* Story tables: keep 2-column but allow natural shrinking */
  .story table { width: 100%; table-layout: fixed; }
  .story table td { word-wrap: break-word; overflow-wrap: break-word; font-size: 0.8125rem; }
  td.storyLeft { padding-right: 0.25rem; }

  #breadCrumb { font-size: 0.8125rem; }
}

/* Small mobile: ≤375px */
@media (max-width: 375px) {
  html { font-size: 14px; }

  #pagecell1 { padding: 0.5rem; }

  .feature, .story {
    border-radius: var(--radius-md);
    padding: 0.75rem;
  }

  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }

  .feature video { border-radius: var(--radius-sm); }

  .hero-anim { border-radius: var(--radius-sm); }
  .hero-title { font-size: 1.15rem; }
  .p1-line { font-size: 2rem; }
  .p1-line.p1-sm { font-size: 1.75rem; }
  .p2-line {
    font-size: 1.1rem;
    text-shadow: -1px -1px 0 rgba(0,0,0,0.8), 1px -1px 0 rgba(0,0,0,0.8),
                 -1px 1px 0 rgba(0,0,0,0.8), 1px 1px 0 rgba(0,0,0,0.8),
                 0 0 8px rgba(0,0,0,0.9);
  }
  .p2-quote { padding: 0 0.5rem; margin-right: 0.25rem; }
}

/* Ensure tap targets are ≥44px on touch */
@media (pointer: coarse) {
  a.glink, a.glink:visited { min-height: 44px; display: flex; align-items: center; }
  #sectionLinks a:link, #sectionLinks a:visited { min-height: 44px; display: flex; align-items: center; }
  .relatedLinks a { min-height: 44px; display: flex; align-items: center; }
  #breadCrumb a { min-height: 44px; display: flex; align-items: center; }
  #utility a { min-height: 44px; display: flex; align-items: center; }
  .lang-toggle { min-height: 44px; }
  .hamburger { min-width: 44px; min-height: 44px; justify-content: center; }
}

/* ============================================
   MOBILE SMARTPHONE EXPERIENCE (≤768px)
   Bottom bar, swipe nav, accordion menu, sidebar panel
   ============================================ */

@media (max-width: 768px) {
  /* --- Prevent viewport blowout from hardcoded pixel widths --- */
  html, body { overflow-x: hidden; max-width: 100vw; }
  #content { overflow-x: hidden; }
  .feature, .story { overflow-x: auto; max-width: 100%; }
  .feature img, .feature video, .story img { max-width: 100% !important; height: auto !important; }
  .feature table, .story table { max-width: 100%; }
  /* Override inline widths only — do NOT touch heights */
  .feature div[style*="width:"] { max-width: 100% !important; }
  .hero-anim { width: 100% !important; max-width: 576px; height: auto !important; aspect-ratio: 576 / 540; }
  /* Gallery buttons: prevent width squishing */
  .button { flex-shrink: 0; }

  /* --- Hide desktop subglobal menus (replaced by accordion) --- */
  .subglobalNav {
    display: none !important;
    visibility: hidden !important;
  }

  /* --- Compact top bar --- */
  #masthead {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
  }

  .header-top {
    padding: 0.5rem 0.75rem;
    min-height: 48px;
  }

  #logo .site-logo-img { height: 28px; }
  .monument-icon-wrap { width: 28px; height: 40px; }
  #logo img.monument-icon,
  #logo img.monument-icon-hover { width: 28px; height: 40px; }

  /* Disable logo animation on mobile — prevents lang toggle jump */
  .site-logo-text { min-width: 0; width: auto; font-size: 20px; height: 28px; line-height: 28px; }
  .site-logo-text.en { font-size: 18px; }
  .site-logo-char { transform: none !important; opacity: 1 !important; animation: none !important; }

  /* Push page content below fixed header */
  body {
    padding-top: 48px;
    padding-bottom: 56px; /* space for bottom bar */
  }

  /* Hide breadcrumb on mobile */
  #breadCrumb { display: none; }

  /* Hide desktop sidebar on mobile */
  #pageNav { display: none; }

  /* Content full width, no grid gap */
  .page-grid {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  #pagecell1 {
    padding: 0.5rem;
  }

  /* Hide desktop footer (info is in bottom bar) */
  #siteInfo { margin-bottom: 0; border-radius: var(--radius-md); }

  /* --- Accordion menu (replaces flat nav) --- */
  #globalNav.mobile-open {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 56px;
    overflow-y: auto;
    z-index: 1050;
    background: var(--nav-bg-dark);
    -webkit-overflow-scrolling: touch;
  }

  .mobile-accordion-section {
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .mobile-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    color: var(--nav-text);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    transition: background var(--transition);
  }

  .mobile-accordion-header:hover,
  .mobile-accordion-header:active {
    background: rgba(92,214,200,0.1);
  }

  .mobile-accordion-header::after {
    content: '\25BC';
    font-size: 0.625rem;
    opacity: 0.6;
    transition: transform var(--transition);
  }

  .mobile-accordion-section.open .mobile-accordion-header::after {
    transform: rotate(180deg);
  }

  .mobile-accordion-body {
    display: none;
    padding: 0 1rem 0.5rem 1.5rem;
    background: rgba(0,0,0,0.15);
  }

  .mobile-accordion-section.open .mobile-accordion-body {
    display: block;
  }

  .mobile-accordion-body a {
    display: block;
    padding: 0.625rem 0.75rem;
    color: rgba(242,246,247,0.85);
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: color var(--transition), padding-left var(--transition);
  }

  .mobile-accordion-body a:last-child { border-bottom: none; }

  .mobile-accordion-body a:hover,
  .mobile-accordion-body a:active {
    color: var(--highlight);
    padding-left: 1rem;
    text-decoration: none;
  }

  /* --- Bottom bar --- */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--nav-bg);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1100;
    box-shadow: 0 -2px 8px rgba(30,74,84,0.15);
    padding: 0 0.5rem;
  }

  .mobile-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(242,246,247,0.7);
    font-size: 1.25rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    min-width: 56px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    font-family: var(--font-body);
  }

  .mobile-bottom-btn span {
    font-size: 0.625rem;
    letter-spacing: 0.02em;
  }

  .mobile-bottom-btn:hover,
  .mobile-bottom-btn:active,
  .mobile-bottom-btn.active {
    color: var(--highlight);
    background: rgba(92,214,200,0.1);
  }

  /* --- Sidebar slide-up panel --- */
  .mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
  }

  .mobile-sidebar-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 70vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 1250;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1rem 2rem;
    box-shadow: 0 -4px 20px rgba(30,74,84,0.2);
  }

  .mobile-sidebar-panel.visible {
    transform: translateY(0);
  }

  .mobile-sidebar-panel .panel-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 1rem;
  }

  .mobile-sidebar-panel h3 {
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    color: var(--accent-primary);
    margin: 0.75rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
  }

  .mobile-sidebar-panel a {
    display: block;
    padding: 0.625rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-heading);
    border-bottom: 1px solid var(--border);
    transition: color var(--transition);
  }

  .mobile-sidebar-panel a:hover,
  .mobile-sidebar-panel a:active {
    color: var(--accent-primary);
    text-decoration: none;
  }

  /* --- Swipe hint (visual only) --- */
  .swipe-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 900;
    pointer-events: none;
  }

  .swipe-indicator.left { left: 2px; }
  .swipe-indicator.right { right: 2px; }
  .swipe-indicator.active { opacity: 0.5; }

  /* --- Mobile language toggle (in header-top) --- */
  .mobile-lang-toggle {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    letter-spacing: 0.05em;
    transition: background var(--transition);
    min-height: 28px;
    min-width: 36px;
    flex-shrink: 0;
  }

  .mobile-lang-toggle:hover,
  .mobile-lang-toggle:active {
    background: var(--accent-secondary);
  }

  /* --- Mobile nav arrows in bottom bar --- */
  .mobile-nav-btn {
    min-width: 44px;
    padding: 0.375rem 0.5rem;
  }

  /* --- Swipe onboarding hint --- */
  .swipe-onboarding {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
  }
  .swipe-onboarding.animate {
    opacity: 1;
    animation: swipeHint 2s ease-in-out;
  }
  .swipe-onboarding.fade-out {
    opacity: 0;
  }
  .swipe-hand {
    color: var(--accent-primary);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
  }
  @keyframes swipeHint {
    0%   { transform: translate(-50%, -50%) translateX(0); }
    25%  { transform: translate(-50%, -50%) translateX(40px); }
    50%  { transform: translate(-50%, -50%) translateX(0); }
    75%  { transform: translate(-50%, -50%) translateX(-40px); }
    100% { transform: translate(-50%, -50%) translateX(0); }
  }

  /* Hide desktop audio button (replaced by bottom bar icon) */
  .audio-play-btn { display: none; }
}

/* === Print styles === */
@media print {
  #masthead, #globalNav, .audio-play-btn, #search, .hamburger { display: none; }
  .mobile-bottom-bar { display: none; }
  body { background: #fff; color: #000; padding: 0; }
  #pagecell1 { max-width: 100%; }
  .page-grid { grid-template-columns: 1fr; }
}
