/* ═══════════════════════════════════════════════
   THE PRESS ROOM — Design System
   ═══════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg:          #0A0A0F;
  --surface:     #141419;
  --elevated:    #1E1E26;
  --border:      #2A2A36;
  --border-sub:  #1E1E26;
  --accent:      #E8C84A;
  --accent-dim:  rgba(232, 200, 74, 0.15);
  --accent-glow: rgba(232, 200, 74, 0.08);
  --text-pri:    #F0EDE8;
  --text-sec:    #A8A5A0;
  --text-muted:  #6B6B7A;
  --danger:      #E05252;

  --font-serif:  Georgia, 'Times New Roman', serif;
  --font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', monospace;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   18px;

  --shadow-card: 0 1px 3px rgba(0,0,0,.4), 0 8px 32px rgba(0,0,0,.5);
  --shadow-drop: 0 4px 24px rgba(0,0,0,.6);

  --ease-out:    cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --header-h:    56px;
  --touch-min:   44px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--text-pri);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;   /* pages control their own scroll */
  -webkit-font-smoothing: antialiased;
}

/* ── Page System ── */
.page {
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease-out);
  z-index: 10;
}
.page.active {
  opacity: 1;
  pointer-events: all;
}
.page.above {
  z-index: 20;
}

/* ════════════════════════════════════
   LANDING PAGE
   ════════════════════════════════════ */
#landing {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

/* ── Masthead ── */
.landing-header {
  flex-shrink: 0;
  padding: 2rem 1.5rem 0;
}
.masthead {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.masthead-rule {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin-bottom: 1rem;
}
.masthead-rule:last-child { margin-bottom: 0; margin-top: 1rem; }
.masthead-inner { padding: .75rem 0; }
.masthead-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: .4rem;
  opacity: .85;
}
.masthead-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--text-pri);
  line-height: 1.1;
}
.masthead-tagline {
  display: block;
  font-size: .75rem;
  letter-spacing: .12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: .4rem;
}

/* ── Main / Card ── */
.landing-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem 1.5rem;
}
.selector-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Form Group ── */
.form-group { display: flex; flex-direction: column; gap: .6rem; }
.form-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-sec);
}
.step-mark {
  font-family: var(--font-mono);
  font-size: .6875rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: .15rem .4rem;
  border-radius: 4px;
  letter-spacing: .04em;
}

/* ── Type Toggle ── */
.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-sec);
  font-family: var(--font-ui);
  font-size: .9375rem;
  font-weight: 500;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background .15s, border-color .15s, color .15s, transform .1s var(--ease-spring);
}
.type-btn:hover { background: #252530; color: var(--text-pri); }
.type-btn:active { transform: scale(.97); }
.type-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Searchable Dropdown ── */
.searchable-dropdown { position: relative; }
.dropdown-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.dropdown-input {
  width: 100%;
  padding: .75rem 2.75rem .75rem .875rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-pri);
  font-family: var(--font-ui);
  font-size: .9375rem;
  min-height: var(--touch-min);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  caret-color: var(--accent);
}
.dropdown-input::placeholder { color: var(--text-muted); }
.dropdown-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.dropdown-icon {
  position: absolute;
  right: .875rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}
.dropdown-clear {
  position: absolute;
  right: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--border);
  border: none;
  border-radius: 50%;
  color: var(--text-sec);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.dropdown-clear:hover { background: var(--accent-dim); color: var(--accent); }

.dropdown-list {
  position: absolute;
  top: calc(100% + .375rem);
  left: 0;
  right: 0;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-drop);
  list-style: none;
  padding: .375rem 0;
  scroll-behavior: smooth;
}
.dropdown-list:not([hidden]) { display: block; }
.dropdown-option {
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .9375rem;
  color: var(--text-pri);
  transition: background .1s;
  user-select: none;
}
.dropdown-option:hover,
.dropdown-option[aria-selected="true"] {
  background: var(--accent-dim);
  color: var(--accent);
}
.dropdown-option.selected { color: var(--accent); }
.dropdown-option mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.dropdown-empty {
  padding: .75rem 1rem;
  color: var(--text-muted);
  font-size: .875rem;
  text-align: center;
}

/* ── Date Grid ── */
.date-loader {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text-muted);
  font-size: .875rem;
  padding: .5rem 0;
}
.date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem;
}
.date-chip {
  padding: .6rem .875rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-align: center;
  min-height: var(--touch-min);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.date-chip:hover { background: #252530; border-color: #3A3A48; }
.date-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.date-chip .chip-weekday {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .15rem;
}
.date-chip.active .chip-weekday { color: var(--accent); opacity: .7; }
.date-chip .chip-date {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-pri);
  font-variant-numeric: tabular-nums;
}
.date-chip.active .chip-date { color: var(--accent); }
.date-chip .chip-month {
  font-size: .6875rem;
  color: var(--text-muted);
}
.date-chip.active .chip-month { color: var(--accent); opacity: .7; }

/* ── Open Button ── */
.open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: .9rem 1.5rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #0A0A0F;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: opacity .2s, transform .15s var(--ease-spring), box-shadow .2s;
  box-shadow: 0 2px 16px rgba(232, 200, 74, .25);
}
.open-btn:hover:not(:disabled) {
  opacity: .92;
  box-shadow: 0 4px 24px rgba(232, 200, 74, .35);
  transform: translateY(-1px);
}
.open-btn:active:not(:disabled) { transform: scale(.97); }
.open-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Footer ── */
.landing-footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem 1.5rem;
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Spinner small ── */
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ════════════════════════════════════
   LOADING SCREEN
   ════════════════════════════════════ */
.loading-page {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.125rem;
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.press-mark {
  margin-bottom: -.25rem;
  opacity: .7;
}
.loading-progress-ring {
  position: relative;
}
.progress-arc {
  transform-origin: center;
  transform: rotate(-90deg);
  animation: dash-spin 2.4s ease-in-out infinite;
}
@keyframes dash-spin {
  0%   { stroke-dashoffset: 213.6; opacity: 1; }
  50%  { stroke-dashoffset: 53.4;  opacity: 1; }
  100% { stroke-dashoffset: 213.6; opacity: .4; }
}
.loading-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-pri);
  letter-spacing: -.01em;
}
.loading-sub {
  font-size: .9375rem;
  color: var(--accent);
  font-weight: 600;
  max-width: 280px;
}
.loading-attempt {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .06em;
  min-height: 1.25rem;
}
.loading-notice {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  text-align: left;
  max-width: 340px;
}
.loading-notice svg { flex-shrink: 0; color: var(--accent); margin-top: .1rem; }
.loading-notice p { font-size: .8125rem; color: var(--text-sec); line-height: 1.55; }
.loading-note {
  font-size: .75rem;
  color: var(--text-muted);
}
.cancel-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.125rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: .8125rem;
  cursor: pointer;
  margin-top: .25rem;
  transition: border-color .15s, color .15s;
}
.cancel-btn:hover { border-color: var(--text-muted); color: var(--text-pri); }

/* ════════════════════════════════════
   ERROR SCREEN
   ════════════════════════════════════ */
.error-page {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1.5rem;
  max-width: 360px;
  text-align: center;
}
.error-icon {
  width: 80px;
  height: 80px;
  background: rgba(232, 200, 74, .08);
  border: 1px solid rgba(232, 200, 74, .2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .5rem;
}
.error-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-pri);
}
.error-msg {
  font-size: .9375rem;
  color: var(--text-sec);
  line-height: 1.55;
}
.error-actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 100%;
  margin-top: .5rem;
}
.error-retry-btn {
  padding: .8rem 1.5rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #0A0A0F;
  font-family: var(--font-ui);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: opacity .2s;
}
.error-retry-btn:hover { opacity: .88; }
.error-back-btn {
  padding: .8rem 1.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-sec);
  font-family: var(--font-ui);
  font-size: .9375rem;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: border-color .15s, color .15s;
}
.error-back-btn:hover { border-color: var(--text-sec); color: var(--text-pri); }

/* ════════════════════════════════════
   READER PAGE
   ════════════════════════════════════ */
.reader-page {
  background: #000;
  display: flex;
  flex-direction: column;
}

/* ── Reader Header ── */
.reader-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 .875rem 0 .625rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.85) 0%, rgba(0,0,0,.6) 70%, transparent 100%);
  backdrop-filter: none;

}
.reader-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.reader-back:hover { background: rgba(255,255,255,.16); }
.reader-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.reader-pub-name {
  display: block;
  font-size: .9375rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-serif);
}
.reader-date {
  display: block;
  font-size: .6875rem;
  color: rgba(255,255,255,.55);
  letter-spacing: .05em;
  margin-top: .05rem;
}
.reader-page-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.reader-page-counter {
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: rgba(255,255,255,.75);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.reader-jump-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75);
  cursor: pointer;
  transition: background .15s;
}
.reader-jump-btn:hover { background: rgba(255,255,255,.16); }

/* ── PhotoSwipe Container ── */
.pswp-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}
/* Override PhotoSwipe defaults for our dark theme */
.pswp {
  --pswp-bg: #000;
  --pswp-placeholder-bg: #111;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.pswp__bg { 
  background: #000; 
  pointer-events: none; 
}
.pswp__top-bar { display: none; } /* we have our own header */
.pswp__counter { display: none; }
.pswp__button--arrow--prev,
.pswp__button--arrow--next {
  color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.35) !important;
  border-radius: 50%;
  backdrop-filter: blur(4px);
}
.pswp__button--arrow--prev:hover,
.pswp__button--arrow--next:hover { color: #fff; }

/* ════════════════════════════════════
   JUMP DIALOG
   ════════════════════════════════════ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fade-in .2s var(--ease-out);
}
.dialog-overlay[hidden] { display: none; }
.dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-drop);
  animation: slide-up .25s var(--ease-spring);
}
.dialog-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--text-pri);
  margin-bottom: 1rem;
}
.jump-input {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-pri);
  font-family: var(--font-ui);
  font-size: 1.125rem;
  outline: none;
  transition: border-color .15s;
  caret-color: var(--accent);
  /* hide number spinners */
  -moz-appearance: textfield;
  appearance: textfield;
}
.jump-input::-webkit-inner-spin-button,
.jump-input::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
.jump-input:focus { border-color: var(--accent); }
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem;
  margin-top: 1rem;
}
.dialog-cancel {
  padding: .75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-sec);
  font-family: var(--font-ui);
  font-size: .9375rem;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: border-color .15s, color .15s;
}
.dialog-cancel:hover { border-color: var(--text-muted); color: var(--text-pri); }
.dialog-confirm {
  padding: .75rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #0A0A0F;
  font-family: var(--font-ui);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: opacity .2s;
}
.dialog-confirm:hover { opacity: .88; }

/* ════════════════════════════════════
   ANIMATIONS & UTILITIES
   ════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* Focus indicators */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar style */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3A3A48; }

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

/* ── Responsive ── */
@media (min-width: 600px) {
  .landing-header { padding: 2.5rem 2rem 0; }
  .landing-main { padding: 2.5rem 2rem 2rem; align-items: center; }
  .selector-card { padding: 2rem; }
  .date-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .landing-footer { padding: 1rem 2rem 2rem; }
}

@media (min-width: 900px) {
  .reader-header { padding: 0 1.25rem 0 1rem; }
}

/* Safe area insets (iPhone notch etc.) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .landing-footer { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
  .reader-header  { padding-top: env(safe-area-inset-top); }
}