:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f9;
  --text: #162033;
  --muted: #5d687b;
  --line: #d8e0eb;
  --brand: #315da8;
  --brand-strong: #21447e;
  --accent: #7156b5;
  --success: #23745b;
  --warning: #9a5b13;
  --shadow: 0 18px 50px rgba(37, 54, 84, 0.1);
  --focus: #e45c25;
  --max: 1180px;
  --radius: 22px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101620;
  --surface: #171f2c;
  --surface-soft: #1d2838;
  --text: #e6ebf3;
  --muted: #aab5c5;
  --line: #303d50;
  --brand: #8eb4ef;
  --brand-strong: #b9d0f4;
  --accent: #b7a1ed;
  --success: #79c9ad;
  --warning: #e7b56f;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.24);
  --focus: #ff986d;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.menu-open { overflow: hidden; }

a { color: var(--brand-strong); }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
button, input, select { font: inherit; }

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

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -5rem;
  padding: .7rem 1rem;
  border-radius: .6rem;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.header-inner,
.container {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}

.header-inner {
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.site-header .brand img {
  width: 88px;
  height: 88px;
  filter: brightness(0) saturate(100%) opacity(.88);
  transform: scale(1.36);
}

:root[data-theme="dark"] .brand img {
  filter: none;
}

.site-header .brand {
  width: 88px;
  height: 88px;
  overflow: hidden;
}

.site-footer .brand img {
  width: 76px;
  height: 76px;
  filter: brightness(0) saturate(100%) opacity(.88);
  transform: scale(1.26);
  margin-right: .25rem;
}

:root[data-theme="dark"] .site-footer .brand img {
  filter: none;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: .42rem;
  margin-left: auto;
}

.desktop-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: .55rem .72rem;
  border-radius: .55rem;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a[aria-current="page"] {
  background: var(--surface-soft);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--surface);
  color: var(--text);
}

.icon-button {
  min-width: 42px;
  display: inline-grid;
  place-items: center;
  padding: .55rem;
  cursor: pointer;
}

.theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-dark { fill: currentColor; stroke: none; }
.theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: block; }

.theme-toggle:hover {
  background: var(--surface-soft);
}

.menu-button { display: none; }

.mobile-panel {
  display: none;
  position: fixed;
  z-index: 45;
  inset: 98px 0 0;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg);
}

.mobile-panel[hidden] { display: none; }

.mobile-panel nav {
  display: grid;
  gap: .4rem;
}

.mobile-panel a {
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.search-dialog {
  width: min(92vw, 720px);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.search-dialog::backdrop {
  background: rgba(8, 14, 25, .6);
  backdrop-filter: blur(4px);
}

.search-head {
  display: flex;
  gap: .6rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.search-head input {
  flex: 1;
  min-width: 0;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--bg);
  color: var(--text);
}

.search-results {
  min-height: 8rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 1rem;
}

.search-result {
  display: block;
  padding: .8rem;
  border-radius: .7rem;
  color: var(--text);
  text-decoration: none;
}

.search-result:hover { background: var(--surface-soft); }
.search-result small { color: var(--muted); }

.search-skeleton {
  display: grid;
  gap: .7rem;
  padding: .3rem;
}

.search-skeleton span {
  height: 3.2rem;
  border-radius: .7rem;
  background: linear-gradient(100deg, var(--surface-soft) 20%, var(--line) 40%, var(--surface-soft) 60%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}

@keyframes skeleton {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 5.5vw, 4.75rem) 0 3.5rem;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(1px);
}

.hero::before {
  width: 34rem;
  height: 34rem;
  right: -9rem;
  top: -14rem;
  background:
    radial-gradient(circle at 35% 35%, rgba(113, 86, 181, .25), transparent 48%),
    radial-gradient(circle at 70% 68%, rgba(49, 93, 168, .18), transparent 54%);
}

.hero::after {
  inset: 1rem 3% auto auto;
  width: 42%;
  height: 85%;
  opacity: .42;
  background-image:
    radial-gradient(circle, var(--brand) 0 1px, transparent 1.5px),
    radial-gradient(circle, var(--accent) 0 1px, transparent 1.5px);
  background-position: 0 0, 23px 31px;
  background-size: 54px 54px, 71px 71px;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.eyebrow {
  margin: 0 0 .8rem;
  color: var(--brand-strong);
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -.035em;
}

h1 { max-width: 15ch; font-size: clamp(2.35rem, 5.2vw, 4.35rem); }
h2 { font-size: clamp(1.65rem, 3vw, 2.55rem); }
h3 { font-size: 1.14rem; }

.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.7rem);
}

.hero-copy {
  max-width: 62ch;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .72rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: .78rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 780;
  text-decoration: none;
  box-shadow: 0 5px 18px rgba(31, 54, 94, .07);
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

:root[data-theme="dark"] .button.primary { color: #0b1728; }

.hero-card,
.panel,
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 1.5rem;
  border-radius: 2rem;
}

.hero-card img {
  display: block;
  width: min(100%, 220px);
  margin: 0 auto 1rem;
  filter: drop-shadow(0 14px 18px rgba(26, 42, 76, .16));
}

.hero-card strong {
  display: block;
  font-size: 1.1rem;
}

.hero-card p {
  margin: .5rem 0 0;
  color: var(--muted);
}

.pixinsight-card {
  text-align: center;
}

.pixinsight-card img {
  width: min(100%, 180px);
}

.pixinsight-card .button {
  margin-top: .35rem;
}

.portal-motto {
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.portal-motto .container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .7rem 1.1rem;
  padding-block: 1rem;
  text-align: center;
}

.portal-motto span { color: var(--muted); }

.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section.compact { padding-block: 2.5rem; }
.section.alt { background: var(--surface-soft); }

.section-heading {
  max-width: 760px;
  margin-bottom: 1.8rem;
}

.section-heading p {
  margin: .75rem 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.object-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  min-width: 0;
  padding: 1.3rem;
  border-radius: var(--radius);
}

a.card {
  color: var(--text);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease;
}

a.card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
}

.card p {
  margin: .7rem 0 0;
  color: var(--muted);
}

.card .meta,
.tag {
  color: var(--brand-strong);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.object-card {
  padding: 0;
  overflow: hidden;
}

.object-card > img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #080b12;
}

.object-card-body {
  padding: 1.25rem 1.35rem 1.4rem;
}

.object-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .65rem;
  margin-top: .35rem;
}

.object-card h3 small,
.page-hero h1 small {
  color: var(--muted);
  font-size: .62em;
  font-weight: 600;
  letter-spacing: 0;
}

.object-season {
  display: block;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .86rem;
}

.tag {
  display: inline-flex;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: var(--surface-soft);
}

.placeholder-block {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.placeholder-block .card { box-shadow: none; }

.notice {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--brand);
  border-radius: .6rem;
  background: var(--surface-soft);
}

.notice.warning { border-left-color: var(--warning); }

.promotion-slot {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0;
}

.promotion {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 54, 94, .08);
}

.promotion--advertisement {
  border-left-color: #b56a16;
}

.promotion--sponsor {
  border-left-color: #7351a3;
}

.promotion--banner {
  border: 0;
  background: #080b12;
}

.promotion-link {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
  min-height: 180px;
  color: var(--text);
  text-decoration: none;
}

.promotion-media {
  display: block;
  min-height: 180px;
  background: #080b12;
}

.promotion-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.promotion--banner .promotion-link,
.promotion--banner .promotion-media,
.promotion--banner .promotion-media img {
  display: block;
  min-height: 0;
}

.promotion--banner .promotion-media img {
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.promotion--banner .promotion-link:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.promotion-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .55rem;
  padding: 1.4rem;
}

.promotion-content strong {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.2;
}

.promotion-content > span:last-child:not(.promotion-label) {
  color: var(--muted);
}

.promotion-label {
  align-self: flex-start;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-strong);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.promotion--advertisement .promotion-label { color: #9a570d; }
.promotion--sponsor .promotion-label { color: #7351a3; }

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

.page-hero h1 { max-width: 20ch; font-size: clamp(2.15rem, 4.5vw, 3.85rem); }
.page-hero h1 small { margin-left: .65rem; white-space: nowrap; }
.page-hero p { max-width: 68ch; margin: 1rem 0 0; color: var(--muted); font-size: 1.12rem; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: .9rem;
}

.breadcrumb a { color: inherit; }

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 3rem;
}

.prose { max-width: 760px; }
.prose h2 { margin-top: 2.4rem; font-size: 1.7rem; }
.prose h3 { margin-top: 1.7rem; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }

.object-figure {
  margin: 0 0 2rem;
}

.object-figure img,
.educational-media img {
  display: block;
  width: 100%;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #080b12;
  object-fit: cover;
}

.object-figure figcaption,
.educational-media figcaption {
  margin-top: .55rem;
  color: var(--muted);
  font-size: .82rem;
}

.educational-media {
  max-width: 660px;
  margin: 1.4rem 0 2rem;
}

.educational-media.media-grid {
  display: grid;
  max-width: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.educational-media figure {
  min-width: 0;
  margin: 0;
}

.educational-media.media-grid img {
  aspect-ratio: 4 / 3;
  max-height: 190px;
}

.media-thumb {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  cursor: zoom-in;
}

.media-thumb span {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  padding: .3rem .55rem;
  border-radius: .5rem;
  background: rgba(5, 9, 16, .78);
  font-size: .72rem;
  font-weight: 750;
  opacity: 0;
  transition: opacity .16s ease;
}

.media-thumb:hover span,
.media-thumb:focus-visible span {
  opacity: 1;
}

.lightbox {
  width: min(94vw, 1180px);
  max-width: none;
  max-height: 92vh;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 3.2rem 1rem 1rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.lightbox::backdrop {
  background: rgba(2, 5, 10, .88);
  backdrop-filter: blur(5px);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 7rem);
  margin: 0 auto;
  object-fit: contain;
}

.lightbox p {
  margin: .75rem auto 0;
  color: var(--muted);
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .4rem .7rem;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { padding: .7rem; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--surface-soft); }

.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 1rem;
  border-left: 1px solid var(--line);
}

.toc strong { display: block; margin-bottom: .6rem; }
.toc a { display: block; padding: .28rem 0; color: var(--muted); font-size: .9rem; text-decoration: none; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: 1.3rem;
}

.filter-row input,
.filter-row select,
.calculator input {
  min-height: 46px;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  color: var(--text);
}

.filter-row input { flex: 1 1 260px; }

.calculator {
  display: grid;
  gap: .85rem;
}

.calculator label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .9rem;
}

.calculator button {
  min-height: 46px;
  border: 0;
  border-radius: .68rem;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.calculator-output {
  min-height: 3.3rem;
  padding: .8rem;
  border-radius: .68rem;
  background: var(--surface-soft);
  color: var(--text);
}

.calculator-output[data-state="error"] { color: #b43b35; }

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 2rem;
}

.footer-grid p { color: var(--muted); }
.footer-links { display: grid; gap: .45rem; }
.footer-links a { color: var(--muted); text-decoration: none; }

.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;
}

@media (max-width: 1040px) {
  .desktop-nav { display: none; }
  .menu-button { display: inline-grid; }
  .mobile-panel:not([hidden]) { display: block; }
  .header-actions { margin-left: auto; }
  .grid.object-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .placeholder-block { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .header-inner, .container { width: min(calc(100% - 1.25rem), var(--max)); }
  .header-inner { min-height: 82px; }
  .site-header .brand { width: 72px; height: 72px; }
  .site-header .brand img { width: 72px; height: 72px; }
  .mobile-panel { inset: 82px 0 0; }
  .portal-motto .container { align-items: center; flex-direction: column; gap: .15rem; }
  .promotion-link { grid-template-columns: 1fr; }
  .promotion-media,
  .promotion-media img {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .hero { padding-top: 3rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { max-width: 420px; }
  .grid, .grid.two, .grid.four, .grid.object-grid { grid-template-columns: 1fr; }
  .educational-media.media-grid { grid-template-columns: 1fr; }
  .educational-media.media-grid img { max-height: 240px; }
  .placeholder-block { grid-template-columns: 1fr; }
  .content-layout { grid-template-columns: 1fr; }
  .toc { position: static; border: 1px solid var(--line); border-radius: 1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .hero-actions .button { width: auto; flex: 1 1 180px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
