/* Notes: editorial index and article templates */
.notes-page {
  --notes-bg: #FCFBF8;
  --notes-header: rgba(247, 245, 241, 0.94);
  --notes-text: #07111B;
  --notes-body: #24364A;
  --notes-muted: #446080;
  --notes-line: rgba(13, 27, 42, 0.14);
  --notes-line-soft: rgba(13, 27, 42, 0.08);
  --notes-progress-start: rgba(214, 228, 242, 0.52);
  --notes-progress-end: rgba(198, 217, 235, 0.34);
  --notes-progress-shadow: rgba(184, 207, 229, 0.34);
  background: var(--notes-bg);
  color: var(--notes-text);
  color-scheme: light;
}

html[data-notes-theme="dark"] .notes-page {
  --notes-bg: #0C141D;
  --notes-header: rgba(12, 20, 29, 0.94);
  --notes-text: #E9EFF5;
  --notes-body: #C7D3DE;
  --notes-muted: #9FB0C1;
  --notes-line: rgba(214, 228, 242, 0.15);
  --notes-line-soft: rgba(214, 228, 242, 0.09);
  --notes-progress-start: rgba(68, 96, 128, 0.56);
  --notes-progress-end: rgba(49, 72, 96, 0.38);
  --notes-progress-shadow: rgba(83, 112, 140, 0.32);
  color-scheme: dark;
}

.notes-page .bg-glow,
.notes-page .bg-grid { display: none; }

.notes-page .site-header {
  background: var(--notes-header);
  border-bottom: 1px solid var(--notes-line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.notes-page .brand-logo-on-hero { display: none; }
.notes-page .brand-logo-on-white { display: block; }
.notes-page .site-header .site-nav a,
.notes-page .site-header .link-quiet { color: var(--notes-muted); }
.notes-page .site-header .site-nav a:hover,
.notes-page .site-header .site-nav a[aria-current="page"],
.notes-page .site-header .link-quiet:hover { color: var(--notes-text); }
.notes-page .site-header .header-actions .btn-primary {
  background: var(--notes-text);
  border-color: var(--notes-text);
  color: var(--notes-bg);
  box-shadow: none;
}
.notes-page .site-header .header-actions .btn-primary:hover {
  background: var(--notes-muted);
  border-color: var(--notes-muted);
  color: var(--notes-bg);
}

.notes-theme-toggle {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--notes-line);
  border-radius: 50%;
  color: var(--notes-muted);
  background: transparent;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.notes-theme-toggle:hover {
  color: var(--notes-text);
  background: var(--notes-line-soft);
  border-color: var(--notes-muted);
}

.notes-theme-toggle-icon {
  font-size: 0.98rem;
  line-height: 1;
  transform: translateY(-0.02rem);
}

.notes-theme-toggle-mobile { display: none; }

html[data-notes-theme="dark"] .notes-page .brand-logo-on-hero { display: block; }
html[data-notes-theme="dark"] .notes-page .brand-logo-on-white { display: none; }

.notes-main { background: var(--notes-bg); }

.notes-hero {
  padding: clamp(6rem, 10vw, 10rem) 0 clamp(4rem, 7vw, 7rem);
  border-bottom: 1px solid var(--notes-line);
}

.notes-hero-inner { max-width: none; }
.notes-title {
  font-family: var(--font-display);
  max-width: 14ch;
  font-size: clamp(4rem, 6.5vw, 6.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.notes-intro {
  max-width: 48rem;
  margin-top: clamp(1.75rem, 3vw, 2.75rem);
  color: var(--notes-muted);
  font-size: clamp(1.05rem, 1.4vw, 1.22rem);
  line-height: 1.6;
  letter-spacing: -0.02em;
}

.notes-index { padding: clamp(4.5rem, 8vw, 8rem) 0 clamp(7rem, 11vw, 11rem); }

.notes-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
}
.note-row { min-width: 0; }
.note-row-link {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: stretch;
  transition: color 220ms ease;
}
.note-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1.08;
  margin-bottom: 1.4rem;
  border-radius: 0.3rem;
  background: var(--sky);
}
.note-image::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--notes-line-soft);
  border-radius: inherit;
  pointer-events: none;
}
.note-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease), filter 300ms ease;
}
.note-image-placeholder {
  background:
    radial-gradient(circle at 18% 8%, rgba(214, 228, 242, 0.92), transparent 34%),
    radial-gradient(circle at 78% 26%, rgba(68, 96, 128, 0.72), transparent 42%),
    linear-gradient(145deg, #183a66 0%, #111d45 52%, #0b1327 100%);
}
.note-image-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image: radial-gradient(rgba(255, 255, 255, 0.42) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}
.note-row-link:hover .note-image img {
  transform: scale(1.04);
  filter: brightness(1.08) saturate(1.08);
}
.note-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin-bottom: 0.9rem;
  color: var(--notes-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.note-row-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 2.7vw, 2.85rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.note-description {
  margin-top: 0.9rem;
  color: var(--notes-muted);
  font-size: 1rem;
  line-height: 1.6;
}
.note-arrow {
  display: inline-grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  margin-top: auto;
  margin-left: auto;
  border: 1px solid var(--notes-line);
  border-radius: 50%;
  transition: transform 220ms ease, background 220ms ease;
}
.note-arrow::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateX(-0.08rem) rotate(45deg);
}
.notes-page .cta-section {
  color: var(--stone);
}
.notes-page .cta-section::before { opacity: 0.42; }
.notes-page .cta-section .cta-sub { color: var(--sky); }

/* Article template */
.article-page-main { background: var(--notes-bg); }
.article-reading-progress { display: none; }
.article-header { padding: clamp(5rem, 10vw, 10rem) 0 clamp(4rem, 8vw, 8rem); }
.article-header-inner { max-width: 92rem; }
.notes-back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: clamp(4rem, 8vw, 8rem);
  color: var(--notes-muted);
  font-size: 0.92rem;
  transition: color 180ms ease, gap 180ms ease;
}
.notes-back:hover { color: var(--notes-text); gap: 0.8rem; }
.notes-back-icon {
  font-size: 1.35rem;
  font-weight: 300;
  line-height: 0.8;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
  margin-bottom: 1.75rem;
  color: var(--notes-muted);
  font-size: 0.84rem;
}
.article-title {
  max-width: 64rem;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 6.5vw, 6rem);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.04em;
}
.article-dek {
  max-width: 48rem;
  margin-top: clamp(2rem, 4vw, 3.5rem);
  color: var(--notes-muted);
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1.55;
  letter-spacing: -0.02em;
}
.article-share-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}
.article-share-button {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  color: var(--notes-muted);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-text);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-transform: none;
  transition:
    color 220ms ease,
    transform 220ms var(--ease);
}
.article-share-label { white-space: nowrap; }
.article-share-icon {
  display: inline-flex;
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
  align-items: center;
  color: currentColor;
  transition: transform 280ms var(--ease);
}
.article-share-icon svg {
  width: 100%;
  height: 100%;
}
.article-share-button:hover {
  color: var(--notes-text);
  transform: translateY(-1px);
}
.article-share-button:hover .article-share-icon { transform: translate(1px, -1px); }
.article-share-button:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}
.article-share-button[data-state="copied"] {
  color: var(--notes-text);
}
.article-share-button[data-state="error"] { color: #A95555; }
.article-author { margin-top: 2rem; font-size: 0.92rem; }
.article-visual {
  max-width: 96rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.article-visual img {
  width: 100%;
  max-height: min(72svh, 54rem);
  object-fit: cover;
  border-radius: 0.35rem;
}
.article-visual figcaption {
  margin-top: 0.75rem;
  color: var(--notes-muted);
  font-size: 0.78rem;
}
.article-content-wrap {
  display: grid;
  grid-template-columns: minmax(8rem, 0.5fr) minmax(0, 46rem) minmax(8rem, 0.5fr);
  gap: clamp(2rem, 5vw, 6rem);
  padding: clamp(5rem, 10vw, 10rem) var(--gutter);
}
.article-aside {
  position: sticky;
  top: 7rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-self: start;
  color: var(--notes-muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.article-author-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
}
.article-author-lockup img {
  display: block;
  width: clamp(3.5rem, 4.5vw, 4.4rem);
  height: clamp(6.5rem, 8vw, 8rem);
  flex: 0 0 auto;
  padding: 0.85rem 2.25rem;
  border: 1px solid var(--notes-line);
  border-radius: 0.35rem;
  background: #11104b;
  object-fit: contain;
}
.article-author-name {
  color: var(--notes-text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
}
.article-tags {
  margin-top: clamp(4rem, 8vw, 6rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--notes-line);
  color: var(--notes-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
.article-tags-label {
  margin-right: 0.25rem;
  font-weight: 500;
}
.article-tags > div + div { margin-top: 0.45rem; }
.article-faq h3 {
  font-size: clamp(1.2rem, 1.5vw, 1.35rem);
  line-height: 1.35;
}
.article-body { grid-column: 2; }
.article-body > * + * { margin-top: 1.6rem; }
.article-body p,
.article-body li {
  color: var(--notes-body);
  font-size: clamp(1.08rem, 1.45vw, 1.22rem);
  line-height: 1.78;
  letter-spacing: -0.012em;
}
.article-body h2 {
  margin-top: clamp(4rem, 7vw, 6.5rem);
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 5vw, 4.6rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
}
.article-body h3 {
  margin-top: 3rem;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 500;
  line-height: 1.25;
}
.article-body ul,
.article-body ol { padding-left: 1.4rem; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li + li { margin-top: 0.7rem; }
.article-body blockquote {
  margin-block: clamp(3.5rem, 6vw, 5.5rem);
  padding-left: clamp(1.5rem, 3vw, 2.5rem);
  border-left: 2px solid var(--brass);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.8vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.article-body a {
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: 0.2em;
}
.article-body figure { margin-block: clamp(3.5rem, 6vw, 5.5rem); }
.article-body figure.article-plot { margin-block: clamp(2rem, 3.5vw, 3rem); }
.article-body figure img { width: 100%; height: auto; border-radius: 0.35rem; }
.article-body figure.article-plot figcaption { margin-top: 0.55rem; }
.article-body figcaption { margin-top: 0.75rem; color: var(--notes-muted); font-size: 0.78rem; }

.article-next {
  color: var(--stone);
  background: var(--navy);
  border-bottom: 1px solid rgba(214, 228, 242, 0.16);
}
.article-next-link {
  display: grid;
  grid-template-columns: 0.5fr 2fr auto;
  gap: clamp(2rem, 5vw, 6rem);
  align-items: center;
  padding-block: clamp(4.5rem, 9vw, 8rem);
}
.article-next-label { color: var(--sky); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.article-next-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 400;
  line-height: 1;
}
.article-next .note-arrow {
  width: 3rem;
  height: 3rem;
  color: var(--navy);
  background: var(--stone);
  border-color: var(--stone);
  transition: transform 220ms var(--ease), background 220ms ease, border-color 220ms ease;
}
.article-next-link:hover .note-arrow {
  transform: translateX(0.22rem);
  background: var(--sky);
  border-color: var(--sky);
}

@media (max-width: 900px) {
  .notes-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-content-wrap { grid-template-columns: minmax(0, 46rem); justify-content: center; }
  .article-aside { display: none; }
  .article-body { grid-column: 1; }
}

@media (max-width: 700px) {
  .notes-page .header-inner { gap: 1rem; }
  .notes-page .header-actions .link-quiet { display: none; }
  .notes-page .header-actions .btn { padding-inline: 1rem; font-size: 0.85rem; }
  .notes-hero { padding-top: 6rem; }
  .notes-title { font-size: clamp(3.75rem, 18vw, 5.5rem); }
  .notes-list { grid-template-columns: 1fr; gap: 3.75rem; }
  .note-image { aspect-ratio: 1.15 / 1; }
  .note-description { margin-top: 0.85rem; }
  .article-header { padding-top: 7.5rem; }
  .notes-back { margin-bottom: 4rem; }
  .article-title { font-size: clamp(3.25rem, 14vw, 5rem); }
  .article-next-link { grid-template-columns: 1fr auto; }
  .article-next-label { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .notes-page .site-header > .header-inner {
    position: relative;
    z-index: 2;
  }

  .notes-page .notes-theme-toggle-mobile { display: inline-grid; }

  .notes-page .mobile-menu-footer {
    width: 100%;
    align-items: center;
    justify-content: space-between;
  }

  .notes-page .mobile-menu-actions { margin-left: auto; }

  .notes-page .article-reading-progress {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    display: block;
    overflow: hidden;
    pointer-events: none;
  }

  .notes-page .article-reading-progress-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      var(--notes-progress-start),
      var(--notes-progress-end)
    );
    box-shadow: 0.8rem 0 1.2rem var(--notes-progress-shadow);
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
  }

  .notes-page .site-header.menu-open .article-reading-progress { display: none; }

  html[data-notes-theme="dark"] .notes-page .site-header:not(.menu-open) .mobile-menu-toggle {
    color: var(--notes-text);
  }

  html[data-notes-theme="dark"] .notes-page .site-header.menu-open {
    color: var(--notes-text);
    background: var(--notes-bg) !important;
    border-bottom-color: var(--notes-line) !important;
  }

  html[data-notes-theme="dark"] .notes-page .site-header.menu-open .mobile-menu-toggle {
    color: var(--notes-text);
  }

  html[data-notes-theme="dark"] .notes-page .site-header.menu-open .brand-logo-on-hero { display: block; }
  html[data-notes-theme="dark"] .notes-page .site-header.menu-open .brand-logo-on-white { display: none; }

  html[data-notes-theme="dark"] .notes-page .mobile-menu {
    color: var(--notes-text);
    background:
      radial-gradient(circle at 100% 100%, rgba(68, 96, 128, 0.28), transparent 38%),
      var(--notes-bg);
  }

  html[data-notes-theme="dark"] .notes-page .mobile-menu-nav,
  html[data-notes-theme="dark"] .notes-page .mobile-menu-nav a {
    border-color: var(--notes-line);
  }

  html[data-notes-theme="dark"] .notes-page .mobile-menu-nav a { color: var(--notes-text); }
  html[data-notes-theme="dark"] .notes-page .mobile-menu-nav a[aria-current="page"] strong,
  html[data-notes-theme="dark"] .notes-page .mobile-menu-login { color: var(--notes-muted); }

  html[data-notes-theme="dark"] .notes-page .mobile-menu-actions .btn {
    color: var(--notes-bg);
    background: var(--notes-text);
    border-color: var(--notes-text);
  }
}

@media (min-width: 761px) {
  .notes-page .site-nav { display: flex; }

  .notes-page .header-actions { position: relative; }

  .notes-page .notes-theme-toggle-desktop {
    position: absolute;
    top: 50%;
    right: calc(100% + clamp(1.5rem, 2vw, 2.5rem));
    transform: translateY(-50%);
  }
}

@media (min-width: 841px) and (max-width: 960px) {
  .notes-page .notes-theme-toggle-desktop {
    width: 1.5rem;
    height: 1.5rem;
    right: calc(100% + 0.75rem);
  }

  .notes-page .notes-theme-toggle-desktop .notes-theme-toggle-icon { font-size: 0.78rem; }
}

@media (min-width: 761px) and (max-width: 840px) {
  .notes-page .notes-theme-toggle-desktop {
    width: 1.25rem;
    height: 1.25rem;
    right: calc(100% + 0.4rem);
  }

  .notes-page .notes-theme-toggle-desktop .notes-theme-toggle-icon { font-size: 0.68rem; }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes notes-rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes notes-image-in {
    from {
      opacity: 0;
      transform: scale(0.985);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  .notes-title,
  .notes-intro,
  .note-row,
  .article-header .notes-back,
  .article-header .article-meta,
  .article-header .article-title,
  .article-header .article-dek,
  .article-header .article-author {
    opacity: 0;
    animation: notes-rise 680ms var(--ease) forwards;
  }

  .notes-intro { animation-delay: 90ms; }
  .note-row:nth-child(1) { animation-delay: 150ms; }
  .note-row:nth-child(2) { animation-delay: 230ms; }
  .note-row:nth-child(3) { animation-delay: 310ms; }
  .note-row:nth-child(4) { animation-delay: 390ms; }

  .note-image img { animation: notes-image-in 800ms var(--ease) both; }
  .note-row:nth-child(2) .note-image img { animation-delay: 80ms; }
  .note-row:nth-child(3) .note-image img { animation-delay: 160ms; }
  .note-row:nth-child(4) .note-image img { animation-delay: 240ms; }

  .article-header .article-meta { animation-delay: 70ms; }
  .article-header .article-title { animation-delay: 120ms; }
  .article-header .article-dek { animation-delay: 190ms; }
  .article-header .article-author { animation-delay: 240ms; }

  .note-row-link:hover .note-row-title { transform: translateY(-2px); }
  .note-row-title { transition: transform 260ms var(--ease); }
}

@media (prefers-reduced-motion: reduce) {
  .note-row-link,
  .note-image img,
  .note-arrow,
  .notes-back,
  .notes-theme-toggle,
  .article-share-button,
  .article-share-icon { transition: none; }
}
