/* ---------------------------------------------------------
   Toronto Mans Dictionary
   Design notes: dark, TTC-red accent, real Toronto photography.
   No framework — plain CSS with custom properties.
--------------------------------------------------------- */

:root {
  --bg: #101114;
  --bg-alt: #17181c;
  --card: #1c1e23;
  --card-border: #2b2d33;
  --text: #f3f2ef;
  --text-dim: #a8a9ae;
  --text-faint: #71727a;
  --red: #e0263f;
  --red-dim: #a11c2f;
  --gold: #f2b705;
  --focus: #6cb7ff;

  --radius: 10px;
  --radius-lg: 16px;
  --maxw: 1120px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(16, 17, 20, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.logo:hover { text-decoration: none; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.logo-text {
  font-weight: 700;
  font-size: 1.05rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.92rem;
}

.header-nav a { color: var(--text-dim); }
.header-nav a:hover { color: var(--text); text-decoration: none; }

.btn-ghost {
  display: inline-block;
  border: 1px solid var(--card-border);
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--text) !important;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover {
  border-color: var(--red);
  background: rgba(224, 38, 63, 0.08);
}

.header-nav a.active {
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--gold);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { color: var(--red); }

/* ---------- Submit-a-term modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 11, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.modal p.modal-sub {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.modal label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin: 14px 0 6px;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.modal textarea { resize: vertical; min-height: 70px; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  align-items: center;
  flex-wrap: wrap;
}

.modal-actions button[type="submit"] {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.modal-actions button[type="submit"]:hover { background: var(--red-dim); }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-inner { position: relative; }

.modal-fallback {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.modal-fallback[hidden] { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  padding: 90px 20px 40px;
}

.hero-media {
  position: absolute;
  inset: 0;
  background-image: url("https://commons.wikimedia.org/wiki/Special:FilePath/Toronto-CN-tower-and-Canadian-flag-skyline.jpg");
  background-size: cover;
  background-position: center 65%;
  filter: saturate(0.9) contrast(1.02);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10,11,13,0.55) 0%, rgba(10,11,13,0.75) 55%, var(--bg) 100%),
    linear-gradient(90deg, rgba(10,11,13,0.35) 0%, rgba(10,11,13,0.1) 40%, rgba(10,11,13,0.35) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 24px rgba(0,0,0,0.4);
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-dim);
  margin: 0 auto 34px;
  max-width: 560px;
}

.search-form {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

.search-form input {
  flex: 1;
  padding: 15px 18px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(28, 30, 35, 0.92);
  color: var(--text);
  font-size: 1rem;
}

.search-form input::placeholder { color: var(--text-faint); }

.search-form button {
  padding: 15px 22px;
  border-radius: 10px;
  border: none;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.search-form button:hover { background: var(--red-dim); }

.hero-actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

#random-btn {
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.hero-count {
  color: var(--text-faint);
  font-size: 0.88rem;
}

.hero-credit {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin: 18px 0 0;
}
.hero-credit a { color: var(--text-faint); text-decoration: underline; }

/* ---------- Sections ---------- */

.section {
  padding: 56px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}

/* ---------- Word of the day ---------- */

.wotd-card {
  background: linear-gradient(135deg, rgba(224,38,63,0.14), rgba(28,30,35,0.5));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}

.wotd-card h3 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 800;
}

.wotd-card .term-origin,
.wotd-card .term-definition,
.wotd-card .term-example {
  margin: 6px 0;
}

/* ---------- Wordle promo ---------- */

.wordle-promo-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(224,38,63,0.12), rgba(242,183,5,0.08));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
}

.wordle-promo-inner p {
  margin: 6px 0 0;
  color: var(--text-dim);
  max-width: 520px;
}

.wordle-promo-cta {
  white-space: nowrap;
  font-size: 1rem;
}

/* ---------- Filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.chip:hover { border-color: var(--red); color: var(--text); }

.chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.sort-row select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
}

.results-meta {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: 14px 2px 18px;
}

/* ---------- Term grid / cards ---------- */

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.term-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.term-card:hover { border-color: #3a3d45; }

.term-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.term-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
}

.term-cats {
  font-size: 0.7rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.chevron {
  color: var(--text-faint);
  transition: transform 0.15s ease;
  font-size: 1.1rem;
}

.term-card-header[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
  color: var(--red);
}

.term-body {
  padding: 0 18px 18px;
}

.term-definition {
  margin: 0 0 10px;
  color: var(--text);
}

.term-example {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-style: italic;
  border-left: 2px solid var(--red);
  padding-left: 10px;
}

.term-origin {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: var(--gold);
}
.term-origin::before { content: "Origin — "; color: var(--text-faint); }

.term-votes {
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-page-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}

.vote-btn {
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

.vote-btn.voted-up { color: #38c172; border-color: #38c172; }
.vote-btn.voted-down { color: var(--red); border-color: var(--red); }

.vote-note {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-left: auto;
}

.no-results {
  color: var(--text-dim);
  padding: 20px 0;
}

.term-card-highlight {
  animation: highlight-pulse 1.8s ease;
}

@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 2px var(--red); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Streetcar band ---------- */

.streetcar-band {
  height: 220px;
  padding: 0;
  background-image:
    linear-gradient(180deg, var(--bg-alt) 0%, rgba(16,17,20,0.35) 25%, rgba(16,17,20,0.35) 75%, var(--bg) 100%),
    url("https://commons.wikimedia.org/wiki/Special:FilePath/CLRV_TTC_Streetcar_No_4004_(8063115473).jpg");
  background-size: cover;
  background-position: center 40%;
}

/* ---------- About ---------- */

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

.about-grid p { color: var(--text-dim); }
.about-grid .fine-print { font-size: 0.85rem; color: var(--text-faint); }

.about-photo {
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.about-photo-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.about-photo figcaption {
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--text-faint);
  background: var(--card);
}

/* ---------- Ad blocks ----------
   Real ad-network units (static IAB banner sizes + one native unit), each
   wrapped the same way: a small caption, the ad container itself sized to
   avoid layout shift, and — where there's room beside it — a "house ad"
   tile promoting another of our sites. js/ads.js fills the house-ad tiles
   and swaps a house ad into the main slot if the network doesn't fill it. */

.ad-block {
  margin: 28px auto;
  text-align: center;
}

.ad-caption {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 8px;
}

.ad-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ad-unit {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.ad-unit:empty {
  border: 1px dashed var(--card-border);
}

.house-ad-slot {
  display: none;
}

@media (min-width: 900px) {
  .house-ad-slot {
    display: flex;
    width: 160px;
  }
}

.house-ad-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 90px;
  padding: 14px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text-dim);
  text-align: left;
}
.house-ad-card:hover { border-color: var(--red); text-decoration: none; }

.house-ad-card .house-ad-kicker {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 4px;
}

.house-ad-card .house-ad-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.house-ad-card .house-ad-tagline {
  font-size: 0.76rem;
  margin: 0;
  line-height: 1.35;
}

.ad-fallback {
  width: 100%;
  height: 100%;
}
.ad-fallback .house-ad-card { min-height: inherit; }

.ad-mobile-only { display: none; }
@media (max-width: 480px) {
  .ad-mobile-only { display: block; padding-top: 12px; }
}

/* ---------- Learn more (History / FAQ) promo ---------- */

.learn-more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.learn-more-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: var(--text);
}
.learn-more-card:hover {
  border-color: var(--red);
  text-decoration: none;
}

.learn-more-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.learn-more-card p {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.learn-more-link {
  color: var(--gold);
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 30px 0 50px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 0.88rem;
}

.category-links-label {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin: 4px 0 8px;
}

.chip-static {
  display: inline-block;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  margin: 0 6px 6px 0;
}
.chip-static:hover { border-color: var(--red); color: var(--text); text-decoration: none; }

.footer-nav a { color: var(--text-dim); }
.footer-nav a:hover { color: var(--text); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .header-nav { gap: 12px; font-size: 0.85rem; }
  .header-nav a:not(.btn-ghost) { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .hero { min-height: 92vh; }
  .learn-more-grid { grid-template-columns: 1fr; }
}
