/* ============================================================
   THE MATCH — Game Styles
   LJ: Lora / Lato        / Navy #344966 / Crimson #BF3850
   MN: EB Garamond / Montserrat / Teal #316578 / Coral #DF564D
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,600;0,700;1,500&family=EB+Garamond:ital,wght@0,500;0,600;1,500&family=Bebas+Neue&family=Lato:wght@300;400;700&family=Montserrat:wght@300;400;500;700&display=swap');

/* ============================================================
   TOKENS
   ============================================================ */

:root {
  --accent:         #BF3850;
  --accent-dark:    #8b1a1a;
  --navy:           #344966;
  --navy-light:     #EEF4FA;
  --paper:          #faf8f4;
  --ink:            #1a1a1a;
  --ink-mid:        #444;
  --ink-light:      #777;
  --rule:           #d8d0c2;
  --rule-heavy:     #344966;
  --correct-bg:     #eef5ee;
  --correct-border: #4a7c59;
  --wrong-bg:       #fbeaea;
  --dot-empty:      #cfc7b8;
  --shadow-sm:      0 1px 4px rgba(52,73,102,0.08);
  --shadow-md:      0 4px 16px rgba(52,73,102,0.13);
  --radius:         4px;
  --font-display:   'Lora', Georgia, serif;
  --font-section:   'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body:      'Lato', 'Helvetica Neue', sans-serif;
}

body.mn {
  --accent:         #DF564D;
  --accent-dark:    #a83029;
  --navy:           #316578;
  --navy-light:     #e8f2f4;
  --paper:          #f7fafa;
  --rule:           #c5d6d8;
  --rule-heavy:     #316578;
  --correct-bg:     #edf5ee;
  --correct-border: #4a8c6a;
  --dot-empty:      #aecdd2;
  --shadow-sm:      0 1px 4px rgba(49,101,120,0.08);
  --shadow-md:      0 4px 16px rgba(49,101,120,0.13);
  --font-display:   'EB Garamond', Georgia, serif;
  --font-section:   'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body:      'Montserrat', 'Helvetica Neue', sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--navy); }
a:hover { color: var(--accent); }

/* ============================================================
   SITE NAV BAR
   ============================================================ */

.site-nav {
  background: #253650;
  border-bottom: 1px solid rgba(255,255,255,0.13);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 44px;
  gap: 12px;
}

body.mn .site-nav { background: #224556; }

.site-nav a {
  font-family: var(--font-section);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
  line-height: 44px;
}

.site-nav a:hover { color: #fff; }

.site-nav__home {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  line-height: 44px;
}

/* Inline logo in the back-to-paper link */
.site-nav__home-logo {
  height: 16px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.75;
  display: inline-block;
  vertical-align: middle;
  transition: opacity 0.15s;
  margin-bottom: 2px; /* optical alignment */
}

.site-nav__home:hover .site-nav__home-logo { opacity: 1; }

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

/* Accent the donate link */
.site-nav__links a[href*="donate"] {
  color: rgba(255,255,255,0.92);
  font-weight: 600;
}

.site-nav__links a[href*="donate"]:hover { color: #fff; }

@media (max-width: 580px) {
  .site-nav { padding: 0 14px; height: 38px; }
  .site-nav a { font-size: 0.65rem; letter-spacing: 0.13em; line-height: 38px; }
  .site-nav__home { line-height: 38px; }
  .site-nav__home-logo { height: 13px; }
  .site-nav__links { gap: 16px; }
}

/* ============================================================
   MASTHEAD
   ============================================================ */

.masthead {
  background: var(--navy);
  color: #fff;
  text-align: center;
  padding: 22px 24px 16px;
  border-bottom: 3px solid var(--accent);
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.025) 0px,
    rgba(255,255,255,0.025) 1px,
    transparent 1px,
    transparent 48px
  );
}

.paper-logo {
  display: block;
  margin: 0 auto 10px;
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.masthead h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5.5vw, 3rem);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}

body.mn .masthead h1 { font-weight: 500; letter-spacing: 0.01em; }

.tagline {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 300;
  font-style: italic;
  color: rgba(255,255,255,0.6);
  margin-bottom: 10px;
}

body.mn .tagline { font-family: 'Montserrat', sans-serif; }

.week-label {
  display: inline-block;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 20px;
  padding: 3px 16px;
  font-family: var(--font-section);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  color: rgba(255,255,255,0.82);
}

#back-to-current { margin-top: 10px; }

#back-to-current a {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.72) !important;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.35);
  transition: color 0.15s;
}

#back-to-current a:hover { color: #fff !important; }

/* ============================================================
   GAME CONTAINER
   ============================================================ */

.game-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 30px;
}

/* ── Explainer ── */
.explainer {
  background: var(--navy-light);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 14px 20px 16px;
  margin: 16px auto 0;
  max-width: 680px;
  font-size: 0.85rem;
  color: var(--ink-mid);
  line-height: 1.65;
  text-align: center;
}

.explainer-label {
  font-family: var(--font-section);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 6px;
}

/* ── Score bar ── */
.score-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 13px 0 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 22px;
}

.score-display {
  font-family: var(--font-section);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--ink-light);
  text-transform: uppercase;
}

.score-display strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  font-style: normal;
}

/* ── Progress dots ── */
.progress-dots { display: flex; gap: 7px; align-items: center; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-empty);
  transition: background 0.3s ease, transform 0.2s ease;
}

.dot.correct { background: var(--accent); transform: scale(1.2); }

.dot.lost {
  background: var(--accent);
  opacity: 0.35;
  position: relative;
}

.dot.lost::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -1px;
  right: -1px;
  height: 2px;
  background: var(--accent);
  transform: rotate(-45deg);
  opacity: 1;
}

/* ── Sponsor bar ── */
.sponsor-bar {
  text-align: center;
  padding: 10px 16px;
  font-family: var(--font-section);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}

.sponsor-bar a {
  font-family: var(--font-section);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--ink-mid);
  text-decoration: none;
}

.sponsor-bar a:hover { color: var(--accent); }

.sponsor-logo {
  height: 56px;
  max-width: 280px;
  width: auto;
  display: block;
  margin: 0 auto 6px;
  object-fit: contain;
}

/* ── Instructions ── */
.instructions {
  font-family: var(--font-section);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 14px;
  text-align: center;
}

/* ============================================================
   GAME AREA
   ============================================================ */

#game-area .loading {
  text-align: center;
  padding: 40px;
  color: var(--ink-light);
  font-style: italic;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Photos column ── */
#photos-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-card {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  background: var(--rule);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.25s ease;
}

.photo-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.photo-card:hover img { transform: scale(1.04); }

.photo-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(191,56,80,0.22), var(--shadow-md);
}

body.mn .photo-card.selected {
  box-shadow: 0 0 0 3px rgba(223,86,77,0.22), var(--shadow-md);
}

.photo-card.matched {
  opacity: 0.32;
  cursor: default;
  pointer-events: none;
}

.photo-card.wrong-flash { animation: wrongFlash 0.45s ease forwards; }

.photo-num {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.52));
  color: #fff;
  font-family: var(--font-section);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 16px 4px 5px;
  pointer-events: none;
}

/* ── Matched photo checkmark ── */
.photo-match-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #fff;
  background: rgba(74,124,89,0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: var(--radius);
}

.photo-card.matched .photo-match-check { opacity: 1; }

/* ── Headlines column ── */
#headlines-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.headline-card {
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-heavy);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s, background 0.15s;
  min-height: 56px;
}

.headline-card:hover {
  border-left-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

.headline-card.selected {
  border-left-color: var(--accent);
  background: var(--navy-light);
  box-shadow: var(--shadow-md);
}

.headline-card.matched {
  cursor: default;
  border-left-color: var(--correct-border);
  background: var(--correct-bg);
  animation: revealPop 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
}

.headline-card.wrong-flash { animation: wrongFlash 0.45s ease forwards; }

.headline-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.mn .headline-text { font-weight: 500; }

/* ── Reveal contents ── */
.reveal-headline {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 5px;
}

body.mn .reveal-headline { font-weight: 500; }

.reveal-teaser {
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--ink-mid);
  line-height: 1.5;
  margin-bottom: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.headline-card.matched a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-section);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  transition: gap 0.15s, color 0.15s;
}

.headline-card.matched a:hover { color: var(--accent-dark); gap: 7px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes wrongFlash {
  0%, 60% { background: var(--wrong-bg); }
  100%     { background: transparent; }
}

@keyframes revealPop {
  0%   { transform: scale(0.97); opacity: 0.6; }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   COMPLETED BANNER
   ============================================================ */

.completed-banner {
  background: var(--navy-light);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  text-align: center;
  padding: 32px 24px 28px;
  margin: 24px 0;
}

.completed-banner h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  font-style: italic;
  color: var(--navy);
  margin-bottom: 10px;
}

body.mn .completed-banner h2 { font-weight: 500; }

.completed-banner .final-score { font-size: 1.05rem; color: var(--ink-mid); }
.completed-banner .final-score strong { color: var(--navy); font-weight: 700; }

/* ============================================================
   WIN MODAL
   ============================================================ */

.win-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlayIn 0.25s ease;
  padding: 20px;
}

.win-modal {
  background: var(--paper);
  border-radius: 8px;
  padding: 40px 32px 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  animation: modalIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  border-top: 4px solid var(--accent);
}

.win-modal-icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }

.win-modal-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  font-style: italic;
  color: var(--navy);
  margin-bottom: 8px;
}

.win-modal-score {
  font-family: var(--font-section);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--ink-light);
  text-transform: uppercase;
  margin-bottom: 24px;
}

.win-modal-close {
  display: block;
  margin-top: 16px;
  font-family: var(--font-section);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
  transition: color 0.15s;
}

.win-modal-close:hover { color: var(--ink); }

/* ============================================================
   WRONG TOAST
   ============================================================ */

#wrong-toast {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-section);
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 32px;
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.25);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

#wrong-toast.visible { opacity: 1; }

@media (min-width: 581px) {
  #wrong-toast { top: 280px; }
}

/* ============================================================
   SHARE BUTTON
   ============================================================ */

.share-btn {
  display: inline-block;
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 22px;
  font-family: var(--font-section);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}

.share-btn:hover { background: var(--accent-dark); }

/* ============================================================
   ARCHIVE
   ============================================================ */

.archive-section {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 2px solid var(--rule-heavy);
}

.archive-section h2 {
  font-family: var(--font-section);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 14px;
}

.archive-list { list-style: none; border-top: 1px solid var(--rule); }
.archive-list li { border-bottom: 1px solid var(--rule); }

.archive-list li a {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  font-size: 0.95rem;
  color: var(--navy) !important;
  text-decoration: none !important;
  transition: color 0.15s;
  width: 100%;
}

.archive-list li a:hover { color: var(--accent) !important; }

.archive-list li a span:last-child {
  font-family: var(--font-section);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  white-space: nowrap;
  margin-left: 12px;
}

.archive-expand-btn {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: 1px solid var(--rule-heavy);
  border-radius: var(--radius);
  padding: 6px 20px;
  font-family: var(--font-section);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.archive-expand-btn:hover { background: var(--navy); color: #fff; }

/* ============================================================
   ADMIN LINKS
   ============================================================ */

.admin-edit-btn {
  display: block;
  text-align: center;
  margin: 24px auto 0;
  font-family: var(--font-section);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  text-decoration: none;
  transition: color 0.15s;
}

.admin-edit-btn:hover { color: var(--accent); }

.admin-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

/* ============================================================
   LOADING & ERROR STATES
   ============================================================ */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--rule);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

.error-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-mid);
}

.error-icon { font-size: 2.5rem; margin-bottom: 12px; }

.error-state h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.error-state p { font-size: 0.9rem; color: var(--ink-light); }

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 28px;
  padding: 20px 24px;
  background: var(--paper);
}

.site-footer__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-section);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light);
}

.site-footer__links {
  display: flex;
  gap: 20px;
}

.site-footer__links a {
  color: var(--ink-light);
  text-decoration: none;
  font-family: var(--font-section);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.site-footer__links a:hover { color: var(--accent); }

@media (max-width: 580px) {
  .site-footer { padding: 16px; }
  .site-footer__inner { flex-direction: column; align-items: center; gap: 8px; text-align: center; }
}

/* ============================================================
   MOBILE (≤580px)
   ============================================================ */

@media (max-width: 580px) {
  .columns { grid-template-columns: 1fr; gap: 16px; }

  /* Hide headline column — shown in drawer instead */
  #headlines-col { display: none; }

  /* Photo grid stays 2-col */
  #photos-col { grid-template-columns: 1fr 1fr; }

  /* Expanded photo */
  .photo-card.expanded {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
    transform: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(191,56,80,0.22), var(--shadow-md);
  }

  body.mn .photo-card.expanded {
    box-shadow: 0 0 0 3px rgba(223,86,77,0.22), var(--shadow-md);
  }

  .photo-card.expanded img { transform: none; }

  /* Mobile drawer */
  #mobile-drawer { grid-column: 1 / -1; aspect-ratio: unset; }

  .mobile-headline-drawer {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: drawerIn 0.2s ease;
  }

  .mobile-headline-drawer .headline-card {
    padding: 10px 12px;
    min-height: 48px;
  }

  .mobile-headline-drawer .headline-text {
    font-size: 0.88rem;
    -webkit-line-clamp: 2;
  }

  .mobile-drawer-label {
    font-family: var(--font-section);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 2px;
  }

  .mobile-deselect-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--ink-light);
    font-style: italic;
    margin-top: 4px;
    cursor: pointer;
  }

  /* Smaller elements on mobile */
  .paper-logo { height: 22px; }
  .explainer { font-size: 0.8rem; padding: 12px 14px 14px; text-align: center; }
  .sponsor-logo { height: 36px; max-width: 200px; }
  .instructions { font-size: 0.72rem; padding: 9px 12px; letter-spacing: 0.09em; }
}