:root {
  --bg: #c9dff3;
  --bg-strong: #9fc1e1;
  --surface: rgba(235, 241, 247, 0.78);
  --surface-strong: #f5f8fc;
  --ink: #101a28;
  --muted: #516070;
  --line: rgba(16, 26, 40, 0.46);
  --line-soft: rgba(16, 26, 40, 0.16);
  --stroke: 2px;
  --accent: #215d8f;
  --accent-soft: #4d8fc4;
  --shadow: 0 18px 52px rgba(16, 26, 40, 0.14);
  --radius-lg: 0;
  --radius-md: 0;
  --radius-sm: 4px;
  --panel-edge: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  --button-edge: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Roboto Condensed", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 26, 40, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 26, 40, 0.06) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(88, 164, 224, 0.42), transparent 36%),
    radial-gradient(circle at top right, rgba(40, 111, 174, 0.3), transparent 30%),
    radial-gradient(circle at bottom center, rgba(126, 181, 231, 0.22), transparent 42%),
    linear-gradient(180deg, #ecf5ff 0%, var(--bg) 52%, var(--bg-strong) 100%);
  background-size: 28px 28px, 28px 28px, auto, auto, auto, auto;
}

body[data-device="mobile"] {
  --device-mode: mobile;
}

body[data-device="desktop"] {
  --device-mode: desktop;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero,
.section,
.post-view {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: var(--stroke) solid rgba(16, 26, 40, 0.58);
  box-shadow:
    1px 1px 0 rgba(16, 26, 40, 0.34),
    var(--shadow);
}

.hero {
  padding: 48px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.top-banner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin: 0 0 20px;
  padding: 10px 16px;
  background: rgba(235, 241, 247, 0.82);
  border: var(--stroke) solid rgba(16, 26, 40, 0.5);
  box-shadow: 1px 1px 0 rgba(16, 26, 40, 0.28);
  border-left: 0;
  border-right: 0;
}

.top-banner-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(16, 26, 40, 0.22);
  background: rgba(245, 248, 252, 0.38);
  color: var(--ink);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.top-banner-button {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.top-banner-link[aria-current="page"] {
  background: rgba(16, 26, 40, 0.16);
  border-color: rgba(16, 26, 40, 0.5);
  font-weight: 700;
}

.hero > *,
.section > *,
.post-view > * {
  position: relative;
  z-index: 1;
}

.hero::after {
  content: "";
  position: absolute;
  left: 108px;
  top: 50%;
  width: 300px;
  height: 300px;
  background:
    linear-gradient(135deg, rgba(245, 248, 252, 0.78), rgba(77, 143, 196, 0.2)),
    linear-gradient(180deg, rgba(33, 93, 143, 0.34), rgba(16, 26, 40, 0.1));
  transform: translateY(-50%) rotate(16deg);
  clip-path: polygon(16% 0, 100% 0, 100% 84%, 84% 100%, 0 100%, 0 16%);
  z-index: 0;
}

.hero-nav,
.hero-actions,
.category-meta,
.post-meta,
.post-tags,
.archive-controls,
.post-nav,
.about-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions-intro {
  margin-top: auto;
  justify-content: flex-end;
}

.hero-next-button {
  min-height: 56px;
  padding: 0 24px;
  font-size: 0.98rem;
}

.hero-nav {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 56px;
}

.hero-carousel-arrows {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-arrow {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(16, 26, 40, 0.32);
  background: rgba(245, 248, 252, 0.46);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.brand-mark,
.eyebrow,
.post-chip,
.tag {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.brand-mark,
.eyebrow,
.post-chip {
  color: var(--muted);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-turtle {
  object-fit: contain;
  transform-origin: center;
  transition: transform 220ms ease;
}

.brand-turtle.is-flipped {
  transform: scaleX(-1);
}

.brand-turtle-mobile {
  width: clamp(88px, 18vw, 148px);
  height: auto;
}

.turtle-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.turtle-spin {
  display: inline-flex;
  animation: spin-right var(--spin-duration, 10s) linear infinite;
  transform-origin: center;
}

.turtle-button-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-turtle-wrap {
  position: absolute;
  left: 88px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.brand-turtle-desktop {
  width: min(30vw, 360px);
  height: min(30vw, 360px);
  opacity: 0.92;
  filter: drop-shadow(0 18px 30px rgba(31, 36, 48, 0.12));
}

.hero h1,
.section-heading h2,
.post-title,
.post-body h2,
.post-body h3 {
  font-family: "Roboto Condensed", sans-serif;
  line-height: 0.95;
}

.post-title {
  line-height: 1.08;
}

.hero h1 {
  max-width: min(10ch, 100%);
  margin: 0 0 20px;
  font-size: clamp(3.2rem, 7vw, 6.8rem);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.hero-copy {
  width: min(58ch, 100%);
  max-width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
}

.hero-with-decoration .hero-copy {
  max-width: min(56ch, calc(100% - 280px));
}

.post-hero-cover {
  position: absolute;
  right: 44px;
  top: 50%;
  width: clamp(180px, 26vw, 360px);
  transform: translateY(-50%);
  z-index: 1;
}

.post-hero-cover-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 24px 48px rgba(31, 36, 48, 0.14);
}

.category-hero-decoration {
  position: absolute;
  right: 44px;
  top: 50%;
  width: clamp(140px, 18vw, 220px);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.category-hero-decoration-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(31, 36, 48, 0.15));
}

.hero p {
  max-width: 42ch;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.pill-link,
.ghost-link,
.post-card,
.category-card {
  text-decoration: none;
}

.pill-link,
.ghost-link,
button,
input,
select,
textarea {
  font: inherit;
}

.pill-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius-sm);
  clip-path: var(--button-edge);
}

.pill-link {
  background: var(--ink);
  color: white;
  border-color: transparent;
}

.ghost-link {
  background: rgba(245, 248, 252, 0.5);
}

.hero-contact-link {
  border-color: rgba(16, 26, 40, 0.62);
  background: rgba(33, 93, 143, 0.12);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 1px 1px 0 rgba(16, 26, 40, 0.28);
}

.hero-contact-link:hover {
  background: rgba(33, 93, 143, 0.18);
  border-color: rgba(16, 26, 40, 0.72);
}

.main-layout {
  display: grid;
  gap: 24px;
}

.section-stack {
  display: grid;
  gap: 24px;
}

.hero-carousel {
  display: grid;
  gap: 6px;
}

.hero-carousel-track {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
  transition: height 220ms ease;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.hero-carousel-track::-webkit-scrollbar {
  display: none;
}

.hero-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  min-height: 360px;
  padding: 4px 0;
  scroll-snap-align: start;
  display: grid;
  align-content: start;
}

.hero-slide-intro {
  position: relative;
  display: flex;
  justify-content: flex-end;
  padding-left: clamp(120px, 20vw, 260px);
  padding-right: clamp(24px, 4vw, 48px);
}

.hero-slide-panel {
  padding: 22px;
  background: var(--surface-strong);
  border: var(--stroke) solid var(--line);
  clip-path: var(--panel-edge);
  gap: 16px;
}

.hero-slide-mobile-turtle {
  display: none;
}

.hero-slide-head h2,
.hero-slide-head h3 {
  margin: 0;
}

.hero-slide p {
  margin: 0;
}

.hero-slide-category-grid,
.hero-slide-featured-grid {
  display: grid;
  gap: 16px;
}

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

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

.hero-carousel-dots {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.hero-dot {
  width: 36px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 26, 40, 0.22);
  cursor: pointer;
}

.hero-dot.is-active {
  width: 112px;
  background: rgba(16, 26, 40, 0.68);
}

.hero-carousel-page-indicator {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.92rem;
}

.section,
.post-view {
  padding: 28px;
  border-radius: var(--radius-lg);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 22px;
}

.section-heading h2,
.post-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.section-copy,
.custom-panel-body p,
.custom-panel-body li {
  max-width: 62ch;
  line-height: 1.7;
  color: var(--muted);
}

.category-grid,
.featured-grid,
.post-grid {
  gap: 18px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.featured-grid,
.post-grid {
  column-count: 2;
  column-gap: 18px;
  align-items: start;
}

.category-card,
.post-card {
  display: block;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: var(--stroke) solid var(--line);
  clip-path: var(--panel-edge);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.featured-grid > *,
.post-grid > * {
  break-inside: avoid;
  display: block;
  margin-bottom: 18px;
}

.category-card:hover,
.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 26, 40, 0.68);
  box-shadow: 0 16px 36px rgba(16, 26, 40, 0.1);
}

.post-card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(31, 36, 48, 0.08);
}

.category-card h3,
.post-card h3 {
  margin: 12px 0 10px;
  font-size: 1.5rem;
  font-family: "Roboto Condensed", sans-serif;
}

.category-card p,
.post-card p,
.post-body p,
.post-body li {
  line-height: 1.7;
  color: var(--muted);
}

.archive-heading {
  align-items: center;
}

.archive-controls {
  align-items: center;
}

.search-field input,
.filter-field select {
  min-width: 280px;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: var(--stroke) solid var(--line);
  background: rgba(245, 248, 252, 0.76);
  padding: 0 16px;
  color: var(--ink);
  clip-path: var(--button-edge);
}

.filter-field select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a5d66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

.post-meta,
.post-tags,
.category-meta,
.post-nav {
  margin-top: 14px;
}

.post-audio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.post-audio-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.post-audio-button {
  min-width: 160px;
  border-color: rgba(16, 26, 40, 0.58);
  background: rgba(33, 93, 143, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.post-voice-picker {
  display: inline-flex;
}

.post-voice-select {
  min-height: 46px;
  min-width: 210px;
  border-radius: var(--radius-sm);
  border: var(--stroke) solid var(--line);
  background: rgba(245, 248, 252, 0.76);
  padding: 0 42px 0 16px;
  color: var(--ink);
  font: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a5d66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  clip-path: var(--button-edge);
}

.post-voice-select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.post-audio-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.post-chip,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: rgba(33, 93, 143, 0.1);
  color: var(--accent);
  clip-path: var(--button-edge);
  border: 1px solid rgba(16, 26, 40, 0.42);
}

.tag {
  background: rgba(16, 26, 40, 0.08);
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.post-view.hidden {
  display: none;
}

.post-view {
  background: rgba(242, 246, 251, 0.94);
}

.preview-cover-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  margin: 18px 0 4px;
  border-radius: 18px;
}

.post-lead {
  font-size: 1.16rem;
  line-height: 1.75;
  color: var(--muted);
}

.post-body {
  margin-top: 28px;
}

.post-body h2,
.post-body h3 {
  margin: 32px 0 10px;
}

.post-body h2 {
  font-size: 2rem;
}

.post-body h3 {
  font-size: 1.45rem;
  line-height: 1.15;
}

.post-body ul {
  padding-left: 22px;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
}

.post-body .formula-sheet-page {
  margin: 10px 0 28px;
}

.post-body .formula-sheet-page img {
  width: min(100%, 920px);
  margin: 0;
  border: 1px solid rgba(16, 26, 40, 0.18);
  box-shadow: 0 12px 28px rgba(16, 26, 40, 0.1);
  background: #fff;
}

.post-body .formula-card-stack {
  display: grid;
  gap: 34px;
  margin-top: 22px;
}

.post-body .formula-visual-card {
  margin: 0;
}

.post-body .formula-visual-card img {
  width: min(100%, 980px);
  margin: 0 auto;
  border: 1px solid rgba(16, 26, 40, 0.16);
  box-shadow: 0 18px 36px rgba(16, 26, 40, 0.1);
  background: #fff;
}

.post-body .post-link-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #f5f8fc;
  color: var(--ink);
  text-decoration: none;
  border: var(--stroke) solid var(--ink);
  font-weight: 700;
  clip-path: var(--button-edge);
  box-shadow: 1px 1px 0 rgba(16, 26, 40, 0.26);
}

.post-body .post-link-button:hover {
  background: rgba(31, 36, 48, 0.06);
}

.post-body .post-link-button-logo {
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  border-radius: 0;
  vertical-align: middle;
}

.post-body .post-citation {
  margin-left: 0.18em;
  font-size: 0.72em;
  line-height: 1;
  vertical-align: super;
  white-space: nowrap;
}

.post-body .post-citation a {
  color: rgba(31, 36, 48, 0.62);
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 36, 48, 0.22);
}

.post-body .post-citation a:hover {
  color: var(--accent);
  border-bottom-color: rgba(184, 86, 42, 0.45);
}

.post-body blockquote {
  margin: 22px 0;
  padding-left: 18px;
  border-left: 4px solid rgba(33, 93, 143, 0.48);
  color: var(--muted);
}

.custom-panel-body {
  display: grid;
  gap: 6px;
}

.custom-panel-body h2,
.custom-panel-body h3 {
  margin: 24px 0 8px;
  font-family: "Roboto Condensed", sans-serif;
}

.custom-panel-body ul {
  padding-left: 22px;
}

@keyframes spin-right {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  margin: 0;
  padding: 30px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--muted);
  background: rgba(245, 248, 252, 0.58);
  border: var(--stroke) dashed rgba(16, 26, 40, 0.56);
  clip-path: var(--panel-edge);
}

.about-strip {
  justify-content: space-between;
  align-items: center;
}

.about-copy {
  max-width: 70ch;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

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

body.debug-panels .debug-panel-target {
  outline: 2px dashed rgba(217, 59, 31, 0.95);
  outline-offset: -2px;
}

body.debug-panels .debug-panel-target.debug-panel-anchor {
  position: relative;
}

.debug-panel-label {
  display: none;
}

body.debug-panels .debug-panel-label {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 20;
  display: inline-flex;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  background: rgba(217, 59, 31, 0.92);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

@media (max-width: 960px) {
  .post-hero-cover {
    position: relative;
    top: auto;
    right: auto;
    width: min(100%, 360px);
    margin-top: 24px;
    transform: none;
  }

  .category-grid,
  .featured-grid,
  .post-grid {
    column-count: 2;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .section-heading,
  .archive-heading,
  .about-strip {
    align-items: start;
    flex-direction: column;
  }

  .hero-turtle-wrap {
    display: none;
  }

  .hero-slide-mobile-turtle {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 18px;
  }

  .hero-slide-intro {
    display: block;
    min-height: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .hero-slide {
    min-height: auto;
  }

  .hero-copy {
    width: min(58ch, 100%);
    min-height: 0;
  }

  .hero-actions-intro {
    margin-top: 18px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero,
  .section,
  .post-view {
    padding: 22px;
    border-radius: var(--radius-lg);
  }

  .hero-nav {
    margin-bottom: 36px;
  }

  .hero-carousel-arrows {
    align-self: stretch;
    justify-content: flex-end;
  }

  .top-banner {
    justify-content: flex-end;
  }

  .hero-slide-intro {
    display: block;
    min-height: 0;
    padding-bottom: 0;
  }

  .hero-with-decoration .hero-copy {
    max-width: 100%;
  }

  .hero-copy,
  .hero-slide-intro {
    max-width: 100%;
    padding-right: 0;
  }

  .hero-copy {
    width: 100%;
    min-height: 0;
    position: relative;
    z-index: 1;
  }

  .hero-actions-intro {
    margin-top: 18px;
    padding-top: 0;
  }

  .category-hero-decoration {
    display: none;
  }

  .category-grid,
  .featured-grid,
  .post-grid {
    grid-template-columns: 1fr;
    column-count: 1;
  }

  .hero-slide-category-grid,
  .hero-slide-featured-grid {
    grid-template-columns: 1fr;
  }

  .search-field input,
  .filter-field select,
  .post-voice-select {
    min-width: min(100%, 280px);
    width: 100%;
  }
}
