:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-alt: #eef1f5;
  --text: #17202a;
  --muted: #5d6773;
  --border: #d8dee7;
  --react: #087ea4;
  --redux: #764abc;
  --success: #166534;
  --warning-bg: #fff7ed;
  --warning-border: #fdba74;
  --code-bg: #111827;
  --shadow: 0 12px 28px rgba(24, 32, 44, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}

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

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: #111827;
  color: #fff;
  padding: 4rem 0 3.25rem;
}

.header-inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.site-header h1 {
  margin: 0.15rem 0 0.7rem;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.header-copy {
  max-width: 760px;
  margin: 0;
  color: #cfd6df;
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tool-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.react-pill {
  background: rgba(8, 126, 164, 0.22);
}

.redux-pill {
  background: rgba(118, 74, 188, 0.24);
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-inner {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-inner a {
  padding: 0.9rem 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 700;
  border-bottom: 3px solid transparent;
}

.nav-inner a:hover,
.nav-inner a:focus-visible {
  border-bottom-color: var(--react);
}

.section {
  padding: 5rem 0;
}

.section-muted {
  background: var(--surface-alt);
  border-block: 1px solid var(--border);
}

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

.section-heading h2 {
  margin: 0.1rem 0 0.65rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.section-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.two-col,
.three-col {
  display: grid;
  gap: 1rem;
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0.2rem;
  margin-bottom: 0.55rem;
  font-size: 1.3rem;
}

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

.card-topline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.tool-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #e6f6fb;
  color: var(--react);
  font-weight: 900;
}

.redux-mark {
  background: #efe9f9;
  color: var(--redux);
}

.kicker {
  font-weight: 800;
  font-size: 0.9rem;
}

.check-list {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.check-list li + li {
  margin-top: 0.45rem;
}

.callout {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid #9dd4e3;
  background: #eaf8fc;
}

.callout.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.demo-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.5fr;
  gap: 1.2rem;
  align-items: start;
}

.demo-copy h3 {
  margin-top: 0;
}

.steps {
  display: grid;
  gap: 0.7rem;
}

.steps > div {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.7rem;
  align-items: start;
}

.steps span {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.steps p {
  margin: 0.2rem 0 0;
}

kbd {
  border: 1px solid #b9c1cc;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  background: #fff;
  font-size: 0.82em;
}

.devtools-window {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #1f2937;
  background: #1f2937;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.18);
}

.window-bar {
  min-height: 2.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.8rem;
  background: #111827;
  color: #d1d5db;
  font-size: 0.84rem;
}

.window-bar span {
  width: 0.66rem;
  height: 0.66rem;
  border-radius: 999px;
  background: #4b5563;
}

.window-bar strong {
  margin-left: 0.4rem;
}

.react-demo,
.redux-demo {
  display: grid;
  min-height: 390px;
  background: #18202b;
  color: #e5e7eb;
}

.react-demo {
  grid-template-columns: 0.9fr 1.3fr;
}

.component-tree,
.action-list {
  border-right: 1px solid #374151;
  padding: 0.7rem;
}

.tree-row,
.action-row,
.redux-tab {
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.tree-row,
.action-row {
  width: 100%;
  text-align: left;
  padding: 0.52rem 0.6rem;
  border-radius: 7px;
}

.tree-row:hover,
.tree-row:focus-visible,
.action-row:hover,
.action-row:focus-visible {
  background: #263244;
  outline: none;
}

.tree-row.active {
  background: rgba(8, 126, 164, 0.32);
}

.action-row.active {
  background: rgba(118, 74, 188, 0.38);
}

.tree-row.child {
  padding-left: 1.5rem;
}

.inspector {
  padding: 1rem;
  overflow: auto;
}

.inspector-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #374151;
  margin-bottom: 0.7rem;
}

.inspector-title span {
  color: #9ca3af;
}

.inspector-group {
  margin-bottom: 1rem;
}

.inspector-group h4 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
}

.inspector-grid {
  display: grid;
  grid-template-columns: minmax(100px, 0.65fr) 1fr;
  gap: 0.35rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.inspector-grid .key {
  color: #c4b5fd;
}

.inspector-grid .value {
  color: #f9fafb;
  overflow-wrap: anywhere;
}

.compact-card {
  box-shadow: none;
}

.mini-demo {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.mini-demo h3 {
  margin: 0.1rem 0 0.35rem;
}

.mini-demo p {
  margin: 0;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  width: 2.7rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #9ca3af;
  position: relative;
  transition: 0.2s ease;
}

.switch::after {
  content: "";
  width: 1.05rem;
  height: 1.05rem;
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s ease;
}

.switch-row input:checked + .switch {
  background: var(--react);
}

.switch-row input:checked + .switch::after {
  transform: translateX(1.25rem);
}

.primary-button {
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.primary-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.demo-result {
  grid-column: 1 / -1;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.redux-demo {
  grid-template-columns: 0.8fr 1.5fr;
}

.panel-title {
  color: #9ca3af;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.6rem 0.6rem;
}

.redux-inspector {
  min-width: 0;
}

.tab-list {
  display: flex;
  border-bottom: 1px solid #374151;
  padding-left: 0.4rem;
}

.redux-tab {
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid transparent;
}

.redux-tab.active {
  border-bottom-color: #c4b5fd;
  color: #fff;
}

#reduxOutput {
  margin: 0;
  min-height: 340px;
  padding: 1rem;
  overflow: auto;
  color: #dbeafe;
  font-size: 0.84rem;
  line-height: 1.55;
  background: #18202b;
}

.top-gap {
  margin-top: 1rem;
}

.flow {
  max-width: 760px;
}

.flow-step {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.9rem;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.flow-step > span {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.flow-step p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.flow-arrow {
  margin-left: 1.2rem;
  height: 2rem;
  display: grid;
  align-items: center;
  font-size: 1.35rem;
}

.scenario {
  margin-top: 2rem;
}

.scenario-copy h3 {
  margin: 0.15rem 0 0.4rem;
}

.scenario-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0;
}

.scenario-steps button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 9px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
}

.scenario-steps button:hover,
.scenario-steps button:focus-visible {
  border-color: var(--react);
  outline: none;
}

.scenario-result {
  padding: 1rem;
  border-left: 4px solid var(--react);
  background: #eef9fc;
  border-radius: 0 10px 10px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: #111827;
  color: #fff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(even) {
  background: #f7f8fb;
}

.final-rule {
  margin-top: 2rem;
  max-width: 760px;
}

.final-rule h3 {
  font-size: 1.7rem;
  margin: 0.1rem 0 0.45rem;
}

.site-footer {
  background: #111827;
  color: #cfd6df;
  padding: 1.4rem 0;
  font-size: 0.9rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef1f5;
  padding: 0.08rem 0.25rem;
  border-radius: 4px;
}

.devtools-window code {
  background: transparent;
}

@media (max-width: 860px) {
  .header-inner,
  .demo-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tool-pills {
    justify-content: flex-start;
  }

  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .mini-demo {
    grid-template-columns: 1fr;
  }

  .demo-result {
    grid-column: auto;
  }
}

@media (max-width: 650px) {
  .site-header {
    padding-top: 3rem;
  }

  .section {
    padding: 3.7rem 0;
  }

  .react-demo,
  .redux-demo {
    grid-template-columns: 1fr;
  }

  .component-tree,
  .action-list {
    border-right: 0;
    border-bottom: 1px solid #374151;
  }

  .inspector-title {
    flex-direction: column;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
