/* ==========================================================================
   hi INDiA ePaper – main styles
   Layout: header (top bar + section tabs) → reader (full-width paper,
   floating dock, article view) → footer.
   Breakpoint overrides live in responsive.css
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Brand (sampled from the hi INDiA logo) */
  --brand: #e40011;
  --brand-dark: #b8000e;
  --brand-soft: #fdecee;

  /* Neutrals */
  --ink: #16181d;
  --ink-2: #3a3f48;
  --muted: #6b7280;
  --line: #e4e6ea;
  --line-strong: #d3d6dc;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eef0f3;
  --viewer-bg: #e9eaee;

  /* Sizes (--header-h is re-measured by script.js) */
  --header-h: 118px;
  --page-ratio: 2100 / 3000; /* updated from EPAPER_CONFIG by script.js */

  /* Effects */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-page: 0 1px 3px rgba(0, 0, 0, .08), 0 10px 30px rgba(0, 0, 0, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 2000;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { background: var(--surface-3); color: var(--ink); }
.btn-light:hover { background: var(--line); }
.btn-outline { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color .15s, color .15s, opacity .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:active { background: var(--line); }
.icon-btn.is-active { color: var(--brand); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.menu-label { display: none; }

/* CSS tooltips (pointer devices only). Shown above by default. */
@media (hover: hover) and (pointer: fine) {
  [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    z-index: 70;
    padding: 5px 9px;
    border-radius: 5px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity .15s, transform .15s;
  }
  [data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
  [data-tip]:disabled::after { display: none; }
  .article-bar [data-tip]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
  .article-bar [data-tip]:hover::after { transform: translate(-50%, 0); }
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 40;
  background: var(--surface);
  border-top: 3px solid var(--brand);
  box-shadow: 0 1px 0 var(--line), var(--shadow-sm);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 20px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo img { width: auto; height: 46px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Date button */
.date-picker { position: relative; }
.date-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  transition: border-color .15s;
}
.date-btn:hover, .date-btn[aria-expanded="true"] { border-color: var(--brand); }
.date-btn > .icon:first-child { color: var(--brand); }
.date-btn-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.date-btn-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}
.date-btn.is-latest .date-btn-kicker { color: var(--brand); }
#dateBtnLabel { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.caret { color: var(--muted); transition: transform .2s; }
.date-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* Search */
.search {
  display: flex;
  align-items: center;
  height: 44px;
  padding-left: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  transition: border-color .15s, background-color .15s;
}
.search:focus-within { border-color: var(--brand); background: var(--surface); }
.search input {
  width: 180px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}
.search-btn { border-radius: 999px; margin-right: 2px; }

.site-link { height: 44px; }

/* ---------- Section tabs (one per page) ---------- */
.section-bar {
  display: flex;
  align-items: stretch;
  height: 48px;
  padding: 0 0 0 8px;
  border-top: 1px solid var(--line);
}
.tabs-arrow { align-self: center; width: 32px; height: 32px; flex: none; }
.tabs-arrow:disabled { opacity: .25; }

.tabs {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.tab::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  transition: background-color .15s;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab-num {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}
.tab[aria-current="page"] { color: var(--brand); }
.tab[aria-current="page"]::after { background: var(--brand); }
.tab[aria-current="page"] .tab-num { background: var(--brand); color: #fff; }

.pages-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 0 18px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
}
.pages-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pages-toggle[aria-expanded="true"] { color: var(--brand); background: var(--brand-soft); }

/* Thumbnail drawer */
.pages-drawer {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 45;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(16, 24, 40, .14);
  animation: drawer-in .18s var(--ease);
}
@keyframes drawer-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
.thumb-list {
  position: relative;
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 14px 20px 16px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.thumb-list > li { flex: none; }
.thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 104px;
  padding: 0;
  border: 0;
  background: transparent;
}
.thumb-img {
  display: block;
  width: 100%;
  aspect-ratio: var(--page-ratio);
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, .08);
  transition: box-shadow .15s, transform .15s;
}
.thumb-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb:hover .thumb-img { box-shadow: 0 0 0 1px var(--line-strong), 0 4px 12px rgba(0, 0, 0, .14); transform: translateY(-2px); }
.thumb[aria-current="page"] .thumb-img { box-shadow: 0 0 0 3px var(--brand); }
.thumb-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 12px;
  color: var(--muted);
}
.thumb-num {
  flex: none;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-3);
  font-weight: 700;
  color: var(--ink-2);
}
.thumb-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb[aria-current="page"] .thumb-num { background: var(--brand); color: #fff; }
.thumb[aria-current="page"] .thumb-title { color: var(--ink); font-weight: 600; }

/* ---------- Popovers (calendar, share) ---------- */
.popover {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: pop-in .16s var(--ease);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* Calendar */
.calendar {
  top: calc(100% + 8px);
  right: 0;
  width: 316px;
  padding: 14px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-head strong { font-size: 15px; }
.cal-dow, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-dow span {
  padding: 4px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}
.cal-day {
  position: relative;
  height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  transition: background-color .12s, color .12s;
}
.cal-day:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.cal-day:disabled { color: #c3c7ce; cursor: default; }
.cal-day.is-available { color: var(--ink); font-weight: 700; }
.cal-day.is-available::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 5px;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--brand);
}
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.cal-day.is-selected,
.cal-day.is-selected:hover:not(:disabled) { background: var(--brand); color: #fff; }
.cal-day.is-selected::after { background: #fff; }

.cal-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

.cal-msg {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  line-height: 1.45;
}
.cal-msg button {
  margin: 4px 6px 0 0;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-dark);
  font-size: 12.5px;
  font-weight: 600;
}
.cal-msg button:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.cal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.cal-selected { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.cal-selected-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.cal-selected strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-foot .btn { height: 36px; padding: 0 14px; }

/* ==========================================================================
   READER
   ========================================================================== */
.reader {
  position: relative;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  min-height: 420px;
  background: var(--viewer-bg);
  overflow: hidden;
}

/* Scrollable stage; the paper is shown at full width and scrolls vertically */
.stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;   /* pinch is handled by script.js */
  outline: none;
  scrollbar-color: #b9bdc5 transparent;
}
.stage.is-dragging { cursor: grabbing; user-select: none; }

.paper-wrap {
  /* side padding leaves room for the prev / next arrows;
     bottom padding keeps the dock from covering the end of the page */
  padding: 24px var(--side-pad, 76px) 96px;
  min-width: 100%;
}

.paper {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow-page);
}
.paper img {
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
  user-select: none;
  transition: opacity .25s;
}
.paper img:not([src]) { visibility: hidden; }
.paper.is-loading img { opacity: .35; }
.paper.is-entering img { animation: page-in .3s var(--ease); }
@keyframes page-in { from { opacity: .2; } to { opacity: 1; } }

/* Skeleton shimmer before the very first image arrives */
.paper.is-empty {
  background: linear-gradient(100deg, #fff 30%, #f1f2f4 50%, #fff 70%) 0 0 / 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- Clickable articles ---------- */
.hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.hotspot::after {
  content: attr(data-label);
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(228, 0, 17, .3);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
}
@media (hover: hover) {
  .stage:not(.is-dragging) .hotspot:hover {
    background: rgba(228, 0, 17, .05);
    box-shadow: inset 0 0 0 2px var(--brand);
  }
  .stage:not(.is-dragging) .hotspot:hover::after { opacity: 1; transform: none; }
}
.hotspot:focus-visible {
  outline: none;
  background: rgba(228, 0, 17, .05);
  box-shadow: inset 0 0 0 3px var(--brand);
}
.hotspot:focus-visible::after { opacity: 1; transform: none; }
/* Advertisements: dark outline and chip, so they read differently from news */
.hotspot.is-ad::after { background: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
@media (hover: hover) {
  .stage:not(.is-dragging) .hotspot.is-ad:hover {
    background: rgba(0, 0, 0, .04);
    box-shadow: inset 0 0 0 2px var(--ink);
  }
}
.hotspot.is-ad:focus-visible { background: rgba(0, 0, 0, .04); box-shadow: inset 0 0 0 3px var(--ink); }
.hotspot.is-flash { animation: flash 1.8s ease-out 1; }
@keyframes flash {
  0%, 40% { background: rgba(255, 214, 0, .28); box-shadow: inset 0 0 0 3px var(--brand); }
  100%    { background: transparent; box-shadow: inset 0 0 0 3px transparent; }
}

/* ---------- Loader / arrows / hint ---------- */
.viewer-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.reader.is-loading .viewer-loader { opacity: 1; transition-delay: .15s; }
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(228, 0, 17, .18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.nav-arrow {
  position: absolute;
  top: 50%;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: opacity .2s, background-color .15s, color .15s, transform .15s;
}
.nav-arrow .icon { width: 24px; height: 24px; }
.nav-arrow:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.nav-arrow:active { transform: scale(.94); }
.nav-arrow:disabled { opacity: 0; pointer-events: none; }
.nav-prev { left: 14px; }
.nav-next { right: 26px; } /* clears the stage scrollbar */

.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 84px;
  z-index: 15;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(22, 24, 29, .85);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .3s, transform .3s;
}
.viewer-hint.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Empty / unavailable state */
.viewer-empty {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--viewer-bg);
}
.viewer-empty h2 { margin: 14px 0 6px; font-family: var(--font-serif); font-size: 24px; }
.viewer-empty p { max-width: 440px; margin: 0 0 20px; color: var(--muted); }
.empty-ico {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-md);
}
.empty-ico .icon { width: 32px; height: 32px; stroke-width: 1.6; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- Floating dock ---------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 30px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.dock-group { display: flex; align-items: center; gap: 2px; }
.dock-divider { width: 1px; height: 24px; margin: 0 4px; background: var(--line); }
.more-btn { display: none; }

.page-select select {
  height: 34px;
  max-width: 200px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.page-select select:hover { border-color: var(--brand); }
.page-total { padding: 0 2px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }

.zoom-level {
  min-width: 46px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ink-2);
}

/* Share panel */
.share-panel {
  right: 16px;
  bottom: 80px;
  width: 300px;
  padding: 14px;
}
.share-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.share-head .icon-btn { width: 32px; height: 32px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
}
.share-item:hover { background: var(--surface-2); }
.share-ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}
.share-whatsapp .share-ico { background: #25d366; }
.share-facebook .share-ico { background: #1877f2; font-family: Arial, sans-serif; }
.share-x .share-ico { background: #111; }
.share-copy .share-ico { background: var(--surface-3); color: var(--ink); }

/* ==========================================================================
   ARTICLE VIEW
   ========================================================================== */
.article-view {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  animation: article-in .2s var(--ease);
}
@keyframes article-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.article-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.article-back { height: 36px; padding: 0 12px; }
.article-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.article-bar-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.article-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 20px 48px;
}
.article-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 30px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.article-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
}
.article-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.2;
  color: var(--ink);
}
.article-clip {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 160px;
  margin: 20px 0 22px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}
.article-clip canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.article-clip[hidden] { display: none; }

/* Story as text */
.article-deck {
  max-width: 720px;
  margin: 12px 0 0;
  font-size: 19px;
  line-height: 1.5;
  color: var(--muted);
}
.article-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
}
.article-byline::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--brand);
}
.article-body {
  max-width: 720px;
  margin: 20px 0 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink);
}
.article-body p { margin: 0 0 1.05em; }
.article-body p:last-child { margin-bottom: 0; }
.article-body strong { font-weight: 700; letter-spacing: .01em; }
.article-card.has-text .article-clip { margin-top: 0; }

.article-clip .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -19px 0 0 -19px;
  display: none;
}
.article-clip.is-loading canvas { visibility: hidden; }
.article-clip.is-loading .spinner { display: block; }
.article-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Ads: contact buttons go above the (often tall) ad so they're seen first */
.article-card.is-ad { display: flex; flex-direction: column; }
.article-card.is-ad .article-actions { order: 1; margin-top: 16px; }
.article-card.is-ad .article-clip { order: 2; margin-bottom: 0; }

/* ---------- Full screen ---------- */
.reader:fullscreen { height: 100vh; min-height: 0; }
.reader:-webkit-full-screen { height: 100vh; width: 100%; }
/* Fallback for browsers without the Fullscreen API on elements (iPhone Safari) */
.reader.is-fake-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
body.has-fake-fullscreen { overflow: hidden; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 1100;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 16px 20px;
}
.footer-copy { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }

.noscript {
  padding: 16px 20px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-align: center;
}

/* ==========================================================================
   PRINT – only the current page (or open story) is printed
   ========================================================================== */
.print-area { display: none; }

@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .print-area img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 16mm);
    object-fit: contain;
    margin: 0 auto;
  }
  .print-area.is-text img, .print-area:not(.is-text) .print-story { display: none; }
  .print-story { font-family: var(--font-serif); color: #000; }
  .print-story .article-kicker { color: #000; }
  .print-story .article-title { font-size: 24pt; margin-bottom: 8pt; }
  .print-story .article-body { max-width: none; font-size: 11.5pt; line-height: 1.5; columns: 2; column-gap: 8mm; }
  .print-story .article-byline::before { background: #000; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
