:root {
  --ink: #14213d;
  --muted: #5f6b7e;
  --line: #dfe5ee;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --blue: #2454c4;
  --blue-soft: #eaf0ff;
  --green: #19775d;
  --green-soft: #e8f5f0;
  --coral: #bd4c3d;
  --coral-soft: #fff0ed;
  --violet: #6450a5;
  --violet-soft: #f0edfb;
  --focus: #67a8ff;
  --shadow: 0 16px 40px rgba(30, 47, 77, 0.09);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

body.dialog-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 30px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 4px solid var(--blue);
  background: #ffffff;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 26px 24px;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.8rem;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7vw, 2rem);
  line-height: 1.12;
}

.brand-copy > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.subject-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-block: 30px 24px;
}

.subject-tab {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-height: 82px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.subject-tab:hover {
  border-color: #aebbd0;
  transform: translateY(-1px);
}

.subject-tab.is-active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue), 0 10px 24px rgba(36, 84, 196, 0.1);
}

.subject-tab-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  font-size: 1.3rem;
}

.subject-all {
  background: var(--violet-soft);
  color: var(--violet);
}

.subject-physics {
  background: var(--blue-soft);
  color: var(--blue);
}

.subject-biology {
  background: var(--green-soft);
  color: var(--green);
}

.subject-chemistry {
  background: var(--coral-soft);
  color: var(--coral);
}

.subject-tab span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.subject-tab strong {
  font-size: 0.94rem;
  line-height: 1.25;
}

.subject-tab small {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.3;
}

.filter-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field > span:first-child {
  color: #44506a;
  font-size: 0.75rem;
  font-weight: 700;
}

.input-wrap {
  position: relative;
  display: block;
}

.input-wrap i {
  position: absolute;
  top: 50%;
  left: 14px;
  color: #78849a;
  font-size: 1rem;
  transform: translateY(-50%);
  pointer-events: none;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cdd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.86rem;
  outline: none;
}

input {
  padding: 0 14px 0 42px;
}

select {
  padding: 0 38px 0 13px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(103, 168, 255, 0.42);
  outline-offset: 2px;
}

.reset-button {
  align-self: end;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid #bcc6d5;
  border-radius: 6px;
  background: #ffffff;
  color: #34425a;
  font-size: 0.82rem;
  font-weight: 700;
}

.reset-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-block: 34px 18px;
}

.catalog-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  line-height: 1.2;
}

.result-count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: right;
}

.experiment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding-bottom: 54px;
}

.experiment-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(78px, auto) auto auto auto 1fr auto;
  gap: 13px;
  min-height: 440px;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(30, 47, 77, 0.06);
}

.experiment-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
}

.experiment-card[data-subject="Physics"]::before {
  background: var(--blue);
}

.experiment-card[data-subject="Biology"]::before {
  background: var(--green);
}

.experiment-card[data-subject="Chemistry"]::before {
  background: var(--coral);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subject-label,
.grade-badge,
.code-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
}

.subject-label {
  gap: 6px;
  padding: 6px 9px;
  font-size: 0.69rem;
}

.subject-label.physics {
  background: var(--blue-soft);
  color: var(--blue);
}

.subject-label.biology {
  background: var(--green-soft);
  color: var(--green);
}

.subject-label.chemistry {
  background: var(--coral-soft);
  color: var(--coral);
}

.experiment-number {
  color: #778399;
  font-size: 0.72rem;
  font-weight: 800;
}

.experiment-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
}

.card-concept {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.58;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 13px;
  color: #536077;
  font-size: 0.72rem;
  font-weight: 600;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-meta .area-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row,
.ngss-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.grade-badge {
  padding: 5px 8px;
  background: #eef2f6;
  color: #455168;
  font-size: 0.62rem;
}

.code-badge {
  padding: 5px 8px;
  border: 1px solid #d5dceb;
  background: #ffffff;
  color: #35425a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.62rem;
}

.card-actions {
  align-self: end;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.primary-button,
.secondary-button,
.download-button,
.empty-state button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 800;
  text-decoration: none;
}

.primary-button,
.download-button,
.empty-state button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.primary-button:hover,
.download-button:hover,
.empty-state button:hover {
  border-color: #173e9b;
  background: #173e9b;
}

.secondary-button {
  border: 1px solid #c7d0dd;
  background: #ffffff;
  color: #34425a;
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 54px;
  padding: 48px 20px;
  border: 1px dashed #bac5d5;
  border-radius: 8px;
  text-align: center;
}

.empty-state > i {
  color: #768399;
  font-size: 2rem;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty-state button {
  margin-top: 8px;
}

.detail-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.detail-dialog::backdrop {
  background: rgba(15, 27, 50, 0.58);
  backdrop-filter: blur(3px);
}

.detail-panel {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 28px 15px 48px;
  overflow-y: auto;
  background: #ffffff;
}

.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.close-button {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin: 0 0 -44px auto;
  box-shadow: 0 8px 20px rgba(30, 47, 77, 0.1);
}

#detailContent {
  width: min(100%, 850px);
  margin-inline: auto;
}

.detail-hero {
  padding: 10px 56px 26px 0;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-hero h2 {
  margin: 0;
  font-size: clamp(1.65rem, 8vw, 2.55rem);
  line-height: 1.16;
}

.detail-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.68;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  margin-top: 18px;
  color: #455168;
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.detail-section {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-heading i {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.detail-section p,
.detail-section li {
  color: #445168;
  font-size: 0.86rem;
  line-height: 1.7;
}

.detail-section p {
  margin: 0;
}

.detail-section ul,
.detail-section ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 23px;
}

.standards-block {
  display: grid;
  gap: 14px;
}

.standards-label {
  margin: 0 0 7px !important;
  color: #36435b !important;
  font-size: 0.7rem !important;
  font-weight: 800;
  text-transform: uppercase;
}

.alignment-note {
  padding-left: 13px;
  border-left: 3px solid var(--blue);
  color: #5c687c !important;
  font-size: 0.78rem !important;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--soft);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
  padding-block: 42px;
}

.support-copy h2,
.standards-copy h2 {
  margin: 0;
  font-size: 1.15rem;
}

.support-copy > p:not(.eyebrow),
.standards-copy > p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.support-link {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  padding: 11px 14px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #ffffff;
  text-decoration: none;
}

.support-link > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.support-link strong {
  font-size: 0.79rem;
}

.support-link small {
  overflow-wrap: anywhere;
  font-size: 0.66rem;
  opacity: 0.82;
}

.standards-copy a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
}

@media (min-width: 520px) {
  .subject-tabs,
  .experiment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 760px) {
  .header-inner {
    padding-block: 34px 30px;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
    font-size: 2rem;
  }

  .brand-copy h1 {
    font-size: 2.35rem;
  }

  .subject-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-block: 38px 28px;
  }

  .filter-panel {
    grid-template-columns: minmax(260px, 1.7fr) minmax(180px, 0.85fr) minmax(180px, 0.85fr) auto;
    align-items: end;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 70px;
    padding-block: 54px;
  }

  .detail-dialog {
    width: min(920px, calc(100% - 50px));
    height: min(90vh, 920px);
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(15, 27, 50, 0.25);
  }

  .detail-panel {
    padding: 34px 42px 54px;
  }
}

@media (min-width: 1040px) {
  .experiment-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
