/* The Charlotte Real — component styles */

/* ===== Ticker ===== */
.ticker {
  background: var(--teal-ink);
  color: #e8ede9;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #0a1f1f;
  overflow: hidden;
  position: relative;
  z-index: 60;
}
.ticker-inner {
  display: flex;
  align-items: center;
  gap: 0;
  height: 34px;
}
.ticker-label {
  background: var(--terra);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0 14px;
  height: 34px;
  display: flex;
  align-items: center;
  font-weight: 500;
  flex-shrink: 0;
}
[data-warm="off"] .ticker-label { background: var(--teal); }
.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0, #000 30px, #000 calc(100% - 30px), transparent 100%);
}
.ticker-run {
  display: inline-flex;
  gap: 36px;
  padding-left: 20px;
  white-space: nowrap;
  animation: tickerScroll 90s linear infinite;
}
.ticker-item { display: inline-flex; align-items: center; gap: 10px; }
.ticker-item .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #86b7a7;
  flex-shrink: 0;
}
.ticker-item .live { background: #e8976a; }
.ticker-item strong { color: #fff; font-weight: 600; }
.ticker-item em { color: #9fb7ad; font-style: normal; font-family: var(--mono); font-size: 10.5px; }
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker:hover .ticker-run { animation-play-state: paused; }

/* ===== Header ===== */
.header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;
  padding: 18px 0;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
}
.brand-mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.brand-mark em {
  font-style: italic;
  color: var(--teal);
}
.brand-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.nav {
  display: flex;
  gap: 2px;
  justify-content: center;
}
.nav-item {
  position: relative;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  transition: color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-item:hover { color: var(--ink); }
.nav-item .caret {
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.5;
  transition: transform .2s;
}
.nav-item[aria-expanded="true"] .caret { transform: rotate(-135deg) translateY(-2px); opacity: 1; }
.nav-item.active { color: var(--teal); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -19px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--teal);
}

.header-cta {
  display: flex;
  gap: 10px;
  align-items: center;
}
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--ink-2); color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 2px;
  transition: all .18s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-subtle { color: var(--teal); }
.btn-subtle::after {
  content: '→';
  transition: transform .2s;
}
.btn-subtle:hover::after { transform: translateX(4px); }

/* ===== Mega menu ===== */
.megamenu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 20px 40px -20px rgba(21, 32, 31, 0.12);
  padding: 40px 0 48px;
  z-index: 49;
  display: none;
}
.megamenu.open { display: block; }
.megamenu-grid {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1.2fr;
  gap: 60px;
}
.megamenu h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 18px;
}
.mega-list { list-style: none; padding: 0; margin: 0; }
.mega-list li { margin-bottom: 12px; }
.mega-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  color: var(--ink);
  transition: color .15s;
}
.mega-list a:hover { color: var(--teal); }
.mega-list a span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.mega-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 40px; }

.mega-feature {
  background: var(--paper-2);
  padding: 22px;
  border-radius: 2px;
}
.mega-feature .kicker { margin-bottom: 12px; }
.mega-feature h5 {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.15;
  margin: 0 0 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.mega-feature p { font-size: 13.5px; color: var(--ink-3); margin: 0 0 14px; line-height: 1.55; }

/* ===== Placeholders (striped SVG) ===== */
.ph {
  background-color: var(--paper-3);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(21, 32, 31, 0.045) 10px,
    rgba(21, 32, 31, 0.045) 20px
  );
  border: 1px solid var(--rule-2);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 14px 16px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
}
.ph.ph-teal {
  background-color: #d7e2de;
  background-image: repeating-linear-gradient(
    -45deg, transparent, transparent 10px,
    rgba(31, 94, 94, 0.1) 10px, rgba(31, 94, 94, 0.1) 20px);
  border-color: #b9cbc5;
}
.ph.ph-warm {
  background-color: #ebddd0;
  background-image: repeating-linear-gradient(
    -45deg, transparent, transparent 10px,
    rgba(184, 85, 58, 0.1) 10px, rgba(184, 85, 58, 0.1) 20px);
  border-color: #d9c6b3;
}
.ph .ph-corner {
  position: absolute;
  top: 14px; right: 16px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
}

/* ===== Cards — editorial style ===== */
.story-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: transform .2s;
}
.story-card:hover .story-headline { color: var(--teal); }
.story-card:hover .ph { transform: scale(1.015); }
.story-card .ph { transition: transform .3s ease; }
.story-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.story-meta .sep { color: var(--ink-4); }
.story-meta .cat { color: var(--teal); font-weight: 500; }
.story-headline {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.12;
  margin: 0;
  color: var(--ink);
  transition: color .15s;
  text-wrap: balance;
}
.story-dek {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-3);
  margin: 0;
}
.byline {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ===== Pill / tag ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper);
}
.pill:hover { border-color: var(--ink-2); }
.pill.pill-teal { border-color: var(--teal); color: var(--teal); }
.pill.pill-filled { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ===== Stat ===== */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .stat-value {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.stat .stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat .stat-delta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--positive);
}
.stat .stat-delta.down { color: var(--terra); }

/* ===== Section head ===== */
.section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 40px;
  margin-bottom: 36px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.section-head .kicker { margin-bottom: 10px; }
.section-head h2 {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
.section-head .head-links { display: flex; gap: 20px; font-size: 13px; }
.section-head .head-links a { color: var(--ink-3); }
.section-head .head-links a:hover { color: var(--ink); }

/* ===== Footer ===== */
.footer {
  background: var(--ink);
  color: #d9ddda;
  padding: 72px 0 28px;
  margin-top: 100px;
}
.footer a { color: #d9ddda; }
.footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer h5 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8f968f;
  font-weight: 500;
  margin: 0 0 18px;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 10px; font-size: 14px; }
.footer-brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
  margin-bottom: 14px;
}
.footer-brand em { font-style: italic; color: #7ea99e; }
.footer-bio { font-size: 13.5px; color: #a8ada8; line-height: 1.6; max-width: 28ch; margin-bottom: 20px; }
.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8f968f;
}

/* ===== Newsletter ===== */
.nl {
  background: var(--paper-2);
  padding: 64px var(--gutter);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.nl-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 80px;
  align-items: center;
}
.nl h3 {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 10px 0 16px;
  text-wrap: balance;
}
.nl p { color: var(--ink-3); margin: 0 0 20px; font-size: 15px; max-width: 50ch; }
.nl-form {
  display: flex;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  padding: 4px;
}
.nl-form input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.nl-form button { padding: 10px 20px; }
.nl-form input::placeholder { color: var(--ink-4); }
.nl-details {
  display: flex;
  gap: 20px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.nl-details span { display: flex; align-items: center; gap: 6px; }
.nl-details .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--teal); }

/* ===== Sidebar rail ===== */
.rail-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 22px;
}
.rail-card h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

/* Tweaks panel */
.tweaks {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 18px 20px;
  width: 280px;
  z-index: 200;
  box-shadow: 0 20px 40px -15px rgba(21,32,31,0.25);
  display: none;
}
.tweaks.open { display: block; }
.tweaks h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
}
.tweaks h4 button { color: var(--ink-3); font-family: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; }
.tweaks-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
.tweaks-row label { color: var(--ink-2); }
.tweaks-row .seg {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.tweaks-row .seg button {
  padding: 5px 10px;
  font-size: 11px;
  color: var(--ink-3);
  background: var(--paper);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-right: 1px solid var(--rule);
}
.tweaks-row .seg button:last-child { border-right: 0; }
.tweaks-row .seg button.on { background: var(--ink); color: var(--paper); }

/* ===== Mobile menu toggle (hidden on desktop) ===== */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
}
.menu-toggle-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  transition: transform .2s, opacity .2s;
}
.header.mobile-open .menu-toggle-bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.header.mobile-open .menu-toggle-bar:nth-child(2) { opacity: 0; }
.header.mobile-open .menu-toggle-bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ===== Tablet (<= 960px) ===== */
@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 32px;
  }
  .megamenu-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .mega-columns { grid-template-columns: 1fr 1fr; gap: 24px; }
  .nl-inner {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .nl h3 { font-size: 34px; }
  .section-head h2 { font-size: 30px; }
  .header-inner { gap: 20px; }
  .nav { gap: 0; }
  .nav-item { padding: 10px 10px; font-size: 13.5px; }
}

/* ===== Mobile (<= 768px) ===== */
@media (max-width: 768px) {
  /* Header reflow */
  .header-inner {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 14px 0;
  }
  .brand-tag { display: none; }
  .brand-mark { font-size: 22px; }
  .header-cta { gap: 8px; }
  .header-cta-btn { display: none; }
  .icon-btn { width: 44px; height: 44px; }
  .menu-toggle { display: flex; }

  /* Nav becomes a full-width dropdown panel */
  .nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 12px;
    border-top: 1px solid var(--rule);
    margin-top: 14px;
  }
  .nav.open { display: flex; }
  .nav-item {
    padding: 14px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--rule-2);
    justify-content: space-between;
  }
  .nav-item.active::after { display: none; }

  /* Megamenu is disabled on mobile (nav links navigate directly) */
  .megamenu { display: none !important; }

  /* Footer single column */
  .footer {
    padding: 48px 0 24px;
    margin-top: 64px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-bottom: 36px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    font-size: 10px;
  }

  /* Newsletter */
  .nl {
    padding: 40px var(--gutter);
  }
  .nl h3 { font-size: 28px; }
  .nl p { font-size: 14.5px; }
  .nl-details {
    flex-wrap: wrap;
    gap: 10px 18px;
  }
  .nl-form {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
  }
  .nl-form input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }
  .nl-form button {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  /* Section head stacks */
  .section-head {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 28px;
  }
  .section-head h2 { font-size: 26px; }
  .section-head .head-links { flex-wrap: wrap; gap: 14px; }

  /* Ticker: keep scroll, soften */
  .ticker-label {
    padding: 0 10px;
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  /* Hide floating tweaks panel on small screens */
  .tweaks { display: none !important; }

  /* Buttons: meet 44px touch target */
  .btn {
    padding: 14px 20px;
    font-size: 14px;
  }
  .pill {
    padding: 6px 12px;
    font-size: 10.5px;
  }

  /* Generic: stack inline grid layouts used across pages (hero splits,
     blog sidebar, article rails, contact split, etc.) */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Article sticky sidebars become inline — release sticky so the
     narrow layout doesn't leave empty space. */
  aside[style*="position: sticky"],
  aside[style*="position:sticky"] {
    position: static !important;
  }

  /* Sticky category bar offset (blog/news) — the header shrinks, so
     the hard-coded top value overlaps content. */
  [style*="position: sticky"][style*="top: 81"] {
    top: 64px !important;
  }
}

/* ===== Small phones (<= 480px) ===== */
@media (max-width: 480px) {
  .brand-mark { font-size: 20px; }
  .brand { gap: 6px; }
  .nl h3 { font-size: 24px; }
  .stat .stat-value { font-size: 28px; }
}
