/* ExtraTime — Electric Editorial design system */
@import url('https://fonts.googleapis.com/css2?family=Tiro+Bangla:ital@0;1&display=swap');

:root {
  /* Brand */
  --brand-purple: #68548e;
  --brand-purple-light: #9a84c2;
  --brand-lavender: #b9a7d8;
  --brand-purple-dark: #493864;

  /* Backgrounds */
  --bg: #0c0a10;
  --bg-surface: #15111c;
  --bg-elevated: #1d1727;

  /* Text */
  --text-primary: #f7f5fa;
  --text-secondary: #c7c0d0;
  --text-muted: #8f879a;

  /* Borders */
  --border: #30283c;
  --border-light: #443851;

  /* Interaction */
  --accent: #9a84c2;
  --accent-soft: rgba(104, 84, 142, 0.18);
  --focus: #d4c7e7;

  /* Charts */
  --chart-primary: #8e73b7;
  --chart-secondary: #b09bd1;
  --chart-light: #d4c7e7;
  --chart-neutral-1: #77717f;
  --chart-neutral-2: #55505c;
  --chart-gold: #d8af55;
  --chart-red: #c56f7a;
  --chart-blue: #7795c6;
  --chart-teal: #6faaa4;

  /* Typography and layout */
  --font-bn: 'Tiro Bangla', 'Noto Serif Bengali', Georgia, serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --container-max: 1180px;
  --narrative-max: 790px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 18% -10%, rgba(104, 84, 142, 0.13), transparent 31rem),
    var(--bg);
  color: var(--text-primary);
  font-family: var(--font-bn);
  font-size: 17px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand-lavender);
  text-decoration: none;
  text-underline-offset: 0.22em;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

::selection {
  background: var(--brand-purple);
  color: var(--text-primary);
}

/* Publication header */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px 28px 22px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-lockup {
  display: grid;
  gap: 1px;
}

.brand-title,
.footer-title {
  font-family: var(--font-display);
  font-size: 1.03rem;
  font-weight: 780;
  line-height: 1;
  letter-spacing: 0.13em;
}

.brand-by {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.69rem;
  line-height: 1.2;
}

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

/* Editorial hero */
.hero {
  max-width: var(--container-max);
  margin: 92px auto 140px;
  padding: 0 28px;
}

.hero-title {
  max-width: 950px;
  color: var(--text-primary);
  font-size: clamp(3.4rem, 6.3vw, 6.25rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.hero-argument-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  gap: clamp(48px, 8vw, 108px);
  align-items: start;
  margin-top: 70px;
}

.hero-intro {
  max-width: 610px;
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1.9;
}

.hero-thesis {
  position: relative;
  padding: 30px 10px 30px 44px;
  border-top: 1px solid var(--brand-purple-light);
  border-bottom: 1px solid var(--border-light);
}

.hero-thesis::before {
  position: absolute;
  inset: 30px auto 30px 0;
  width: 3px;
  background: var(--brand-purple);
  content: '';
}

.hero-thesis p {
  color: var(--text-primary);
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.48;
}

/* Open metric rail */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 76px;
  padding: 30px 0 28px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border);
}

.stat-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0 28px;
  border-left: 1px solid var(--border);
}

.stat-item:first-child {
  padding-left: 0;
  border-left: 0;
}

.stat-num {
  color: var(--brand-purple-light);
  font-size: clamp(1.8rem, 2.8vw, 2.7rem);
  font-weight: 400;
  line-height: 1.25;
}

.stat-label {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.method-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 20px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Story chapters */
.chapter {
  max-width: var(--container-max);
  margin: 0 auto 150px;
  padding: 76px 28px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
}

.chapter-header {
  max-width: var(--narrative-max);
  margin-bottom: 44px;
}

.chapter-eyebrow {
  margin-bottom: 18px;
  color: var(--brand-purple-light);
  font-size: 0.9rem;
  letter-spacing: 0.035em;
}

.chapter-title {
  color: var(--text-primary);
  font-size: clamp(2.35rem, 4.2vw, 4.35rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.018em;
}

.chapter-title-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.chapter-title-link:hover {
  color: inherit;
  text-decoration: none;
}

.chapter-title-link:focus-visible {
  outline: 2px solid var(--brand-purple-light);
  outline-offset: 6px;
}

.chapter-desc {
  max-width: 700px;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 1.08rem;
}

/* Editorial chart canvas */
.chart-box {
  position: relative;
  margin: 0;
  padding: 36px 28px;
  overflow-x: auto;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border);
  background: rgba(21, 17, 28, 0.74);
  scrollbar-color: var(--brand-purple) var(--bg-elevated);
  scrollbar-width: thin;
}

.chart-box::-webkit-scrollbar,
.method-table::-webkit-scrollbar {
  height: 7px;
}

.chart-box::-webkit-scrollbar-track,
.method-table::-webkit-scrollbar-track {
  background: var(--bg-elevated);
}

.chart-box::-webkit-scrollbar-thumb,
.method-table::-webkit-scrollbar-thumb {
  background: var(--brand-purple);
  border-radius: 999px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Chart sharing */
.chart-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 32px;
}

.share-button,
.copy-link-button {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: transparent;
  color: var(--brand-lavender);
  font-family: var(--font-bn);
  font-size: 0.86rem;
  line-height: 1.4;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.share-menu-wrap {
  position: relative;
  display: inline-flex;
}

.share-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  width: 176px;
  max-width: calc(100vw - 40px);
  padding: 6px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-elevated);
  box-shadow: 0 14px 34px rgba(5, 3, 8, 0.42);
}

.share-menu[hidden] {
  display: none;
}

.share-menu-item {
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-bn);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.share-menu-item:hover,
.share-menu-item:focus-visible {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.share-button:hover,
.copy-link-button:hover,
.share-button[aria-expanded="true"] {
  border-color: var(--brand-purple-light);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.share-button::before {
  margin-right: 7px;
  content: '↗';
  font-family: var(--font-display);
}

.share-status {
  min-height: 1.5em;
  color: var(--brand-lavender);
  font-size: 0.84rem;
}

/* Finding signature */
.finding-box {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 28px;
  max-width: 910px;
  padding: 27px 0 0;
  border-top: 1px solid var(--brand-purple-light);
}

.finding-label {
  grid-row: 1 / span 2;
  padding-left: 14px;
  border-left: 3px solid var(--brand-purple);
  color: var(--brand-purple-light);
  font-size: 0.89rem;
  letter-spacing: 0.02em;
}

.finding-text {
  color: var(--text-primary);
  font-size: 1.14rem;
  line-height: 1.72;
}

.finding-note {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

/* Framing matrix */
.framing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.framing-grid {
  display: grid;
  min-width: 780px;
  grid-template-columns: 150px repeat(6, 1fr);
  gap: 7px;
  align-items: center;
  font-size: 0.86rem;
}

.framing-header {
  padding: 8px 3px;
  text-align: center;
  font-weight: 400;
}

.framing-outlet {
  color: var(--text-primary);
  font-weight: 400;
}

.framing-cell {
  padding: 9px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--bg-elevated);
  text-align: center;
  font-family: var(--font-bn);
  font-weight: 400;
}

/* Tooltip */
.chart-tooltip {
  position: absolute;
  z-index: 100;
  max-width: 280px;
  padding: 10px 13px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--bg-elevated);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
  color: var(--text-primary);
  font-size: 0.83rem;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

/* Shared data tables */
.method-table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.method-table th,
.method-table td {
  padding: 12px 14px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.method-table th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 400;
}

.method-table td {
  background: rgba(29, 23, 39, 0.76);
  color: var(--text-secondary);
}

/* Quieter methodology companion */
.method-container {
  max-width: 900px;
  margin: 88px auto 130px;
  padding: 0 28px;
}

.method-title {
  max-width: 760px;
  color: var(--text-primary);
  font-size: clamp(3.1rem, 6vw, 5.45rem);
  font-weight: 400;
  line-height: 1.12;
}

.method-lede {
  max-width: 620px;
  margin-top: 28px;
  color: var(--text-secondary);
  font-size: 1.18rem;
}

.method-meta {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.method-section {
  margin: 72px 0;
}

.method-section h2 {
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 400;
  line-height: 1.35;
}

.method-section p,
.method-list {
  color: var(--text-secondary);
}

.method-section p {
  margin-bottom: 18px;
}

.method-list {
  margin: 0 0 20px 24px;
}

.method-list li {
  margin-bottom: 9px;
  padding-left: 6px;
}

.method-note {
  margin-top: 10px;
  color: var(--text-muted) !important;
  font-size: 0.88rem;
}

code {
  padding: 0.08em 0.28em;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-surface);
  color: var(--brand-lavender);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78em;
}

/* Publication footer */
.footer {
  display: grid;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 44px 28px 54px;
  border-top: 1px solid var(--border-light);
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr) auto;
  gap: 38px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.footer-brand div {
  display: grid;
  gap: 3px;
}

.footer-title {
  color: var(--text-primary);
}

.footer-signoff {
  padding-left: 28px;
  border-left: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 1rem;
}

.footer-links {
  display: flex;
  gap: 20px;
  white-space: nowrap;
}

/* Responsive system */
@media (max-width: 1024px) {
  .hero {
    margin-top: 76px;
  }

  .hero-title {
    font-size: clamp(3.25rem, 7vw, 5rem);
  }

  .hero-argument-grid {
    gap: 48px;
  }

  .chapter {
    margin-bottom: 124px;
  }

  .footer {
    grid-template-columns: 1fr auto;
  }

  .footer-signoff {
    display: none;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .top-nav {
    padding-inline: 20px;
  }

  .nav-links {
    gap: 16px;
  }

  .hero {
    margin: 62px auto 105px;
    padding-inline: 20px;
  }

  .hero-title {
    font-size: clamp(2.8rem, 10vw, 4rem);
  }

  .hero-argument-grid {
    grid-template-columns: 1fr;
    gap: 42px;
    margin-top: 46px;
  }

  .hero-intro {
    max-width: 650px;
  }

  .hero-thesis {
    max-width: 570px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 54px;
    padding-block: 0;
  }

  .stat-item {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
  }

  .stat-item:first-child {
    padding-left: 0;
  }

  .stat-item:nth-child(3) {
    padding-left: 0;
    border-left: 0;
    border-bottom: 0;
  }

  .stat-item:nth-child(4) {
    border-bottom: 0;
  }

  .method-callout {
    align-items: flex-start;
  }

  .chapter {
    margin-bottom: 104px;
    padding: 58px 20px 0;
  }

  .chapter-title {
    font-size: clamp(2.15rem, 8vw, 3.2rem);
  }

  .chart-box {
    padding: 24px 18px;
  }

  .chart-svg {
    min-width: 660px;
  }

  .framing-grid {
    min-width: 780px;
    grid-template-columns: 120px repeat(6, 1fr);
    font-size: 0.77rem;
  }

  .finding-box {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px 18px;
  }

  .method-container {
    margin-top: 66px;
    padding-inline: 20px;
  }

  .method-table {
    display: block;
    overflow-x: auto;
  }

  .method-table th,
  .method-table td {
    min-width: 150px;
  }

  .footer {
    padding-inline: 20px;
  }
}

@media (max-width: 520px) {
  .top-nav {
    align-items: flex-start;
    gap: 18px;
    padding-top: 18px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-title {
    font-size: 0.86rem;
  }

  .brand-by {
    font-size: 0.62rem;
  }

  .nav-links {
    align-items: flex-end;
    flex-direction: column;
    gap: 2px;
    font-size: 0.84rem;
  }

  .hero-title {
    font-size: clamp(2.45rem, 12vw, 3.35rem);
    line-height: 1.12;
  }

  .hero-intro {
    font-size: 1.05rem;
  }

  .hero-thesis {
    padding: 24px 6px 24px 28px;
  }

  .hero-thesis::before {
    inset-block: 24px;
  }

  .hero-thesis p {
    font-size: 1.45rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-item {
    padding: 21px 12px;
  }

  .stat-num {
    font-size: 1.65rem;
  }

  .stat-label {
    font-size: 0.76rem;
  }

  .method-callout {
    flex-direction: column;
    gap: 7px;
    font-size: 0.82rem;
  }

  .chapter-desc {
    margin-top: 16px;
    font-size: 1rem;
  }

  .chart-box {
    padding-inline: 12px;
  }

  .chart-actions {
    gap: 8px;
  }

  .share-button,
  .copy-link-button {
    padding-inline: 10px;
    font-size: 0.82rem;
  }

  .share-status {
    flex-basis: 100%;
  }

  .finding-box {
    display: block;
  }

  .finding-label {
    margin-bottom: 16px;
  }

  .finding-note {
    margin-top: 8px;
  }

  .method-title {
    font-size: 2.85rem;
  }

  .method-lede {
    font-size: 1.05rem;
  }

  .method-section {
    margin-block: 58px;
  }

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

  .footer-links {
    padding-top: 20px;
    border-top: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
