:root[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #0B0B0C;
  --card: #141416;
  --card-2: #1A1A1D;
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #FFFFFF;
  --sub: rgba(255, 255, 255, 0.56);
  --faint: rgba(255, 255, 255, 0.40);
  --chip: rgba(255, 255, 255, 0.08);
  --btn-bg: #FFFFFF;
  --btn-text: #0A0A0A;
  --success: #34D399;
  --error: #F4737A;
  --warning: #FBBF24;
  --on-status: #04231A;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 48px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F5F5F6;
  --bg-2: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #FAFAFA;
  --border: rgba(0, 0, 0, 0.07);
  --border-2: rgba(0, 0, 0, 0.12);
  --text: #0A0A0A;
  --sub: #79797F;
  --faint: #A6A6AC;
  --chip: #EFEFF0;
  --btn-bg: #0A0A0A;
  --btn-text: #FFFFFF;
  --success: #12A06A;
  --error: #DC4C4C;
  --warning: #B7791F;
  --on-status: #FFFFFF;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 34px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

:root {
  --ui: "Plus Jakarta Sans", -apple-system, system-ui, sans-serif;
  --brand: "Afacad", sans-serif;
  --pad: clamp(20px, 5vw, 72px);
  --maxw: 1180px;
}

* {
  box-sizing: border-box
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.62;
  font-weight: 400;
  transition: background .35s ease, color .35s ease;
}

.mark use,
.mark path {
  fill: currentColor
}

/* ---------- type ---------- */
.kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sub)
}

h1,
h2,
h3 {
  font-family: var(--ui);
  font-weight: 800;
  margin: 0;
  line-height: 1.04;
  letter-spacing: -.03em
}

h2 {
  font-size: clamp(30px, 4.4vw, 56px)
}

h3 {
  font-size: clamp(19px, 2.2vw, 26px);
  letter-spacing: -.02em
}

p {
  margin: 0 0 1em;
  max-width: 64ch;
  color: var(--text)
}

p.lead {
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
  color: var(--text);
  max-width: 46ch;
  font-weight: 500;
  letter-spacing: -.01em
}

strong {
  font-weight: 700
}

.muted {
  color: var(--sub)
}

a {
  color: inherit
}

/* ---------- layout ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad)
}

section {
  padding-block: clamp(60px, 8.5vw, 120px);
  border-top: 1px solid var(--border)
}

.sec-head {
  display: flex;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 48px;
  flex-wrap: wrap
}

.sec-head .no {
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: .06em;
  padding-top: .55em;
  font-variant-numeric: tabular-nums
}

.sec-head .hgroup {
  flex: 1;
  min-width: 260px
}

.sec-head h2 {
  margin-bottom: .34em
}

.grid {
  display: grid;
  gap: clamp(20px, 3vw, 40px)
}

.g2 {
  grid-template-columns: repeat(2, 1fr)
}

.g3 {
  grid-template-columns: repeat(3, 1fr)
}

.g4 {
  grid-template-columns: repeat(4, 1fr)
}

@media(max-width:860px) {

  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr
  }

  .g4.keep,
  .g3.keep {
    grid-template-columns: 1fr 1fr
  }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border)
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 13px
}

.brandtag {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.brandtag .wm {
  height: 19px;
  width: auto;
  color: var(--text);
  display: block;
}

.topbar nav {
  display: flex;
  gap: 6px;
  align-items: center
}

.topbar nav a {
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  padding: 7px 11px;
  border-radius: 999px;
  transition: color .2s, background .2s;
  white-space: nowrap
}

.topbar nav a:hover {
  color: var(--text);
  background: var(--chip)
}

.topbar nav a.active {
  color: var(--text)
}

.topbar .right {
  display: flex;
  align-items: center;
  gap: 10px
}

.ver {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  font-variant-numeric: tabular-nums
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s, border-color .2s, transform .14s
}

.theme-toggle:hover {
  background: var(--chip)
}

.theme-toggle:active {
  transform: scale(.94)
}

.theme-toggle svg {
  width: 17px;
  height: 17px
}

[data-theme="dark"] .theme-toggle .moon {
  display: none
}

[data-theme="light"] .theme-toggle .sun {
  display: none
}

@media(max-width:920px) {
  .topbar nav {
    display: none
  }
}

/* ---------- hero ---------- */
.hero {
  border-top: none;
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding-top: clamp(48px, 8vw, 92px);
}

.hero .wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.hero-content {
  margin-block: auto;
}

.hero .word {
  display: block;
  margin-top: 26px;
}

.hero .word .wm {
  height: auto;
  width: clamp(280px, 86vw, 490px);
  max-width: 100%;
  color: var(--text);
  display: block;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: clamp(30px, 5vw, 46px)
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  white-space: nowrap;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: var(--ui);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform .14s cubic-bezier(.2, .7, .3, 1), opacity .2s
}

.btn:hover {
  opacity: .9
}

.btn:active {
  transform: scale(.975)
}

.btn svg {
  width: 16px;
  height: 16px
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-2)
}

.hero-meta {
  position: relative;
  display: flex;
  gap: clamp(24px, 4vw, 52px);
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 26px;
  padding-bottom: clamp(20px, 3vw, 36px);
}

.hero-meta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  border-top: 1px solid var(--border);
}

.hero-gnomon {
  position: absolute;
  bottom: 100%;
  right: 0;
  width: clamp(240px, 30vw, 440px);
  height: auto;
  color: var(--text);
  z-index: 10;
  pointer-events: none;
  transform-origin: bottom right;
}

@media (max-width: 768px) {
  .hero .word {
    font-size: clamp(64px, 23vw, 150px);
    margin-top: 16px;
  }

  .hero-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
    padding-top: 22px;
    padding-bottom: 24px;
  }

  .hero-gnomon {
    display: none;
  }
}

.hero-meta div {
  font-size: 13px;
  color: var(--sub);
  letter-spacing: 0
}

.hero-meta b {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase
}

.hero-meta span {
  font-size: 14.5px;
  color: var(--sub)
}

/* ---------- stages / cards ---------- */
.stage {
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stage .m {
  width: 46%
}

.stage.pos {
  background: #FFFFFF
}

.stage.neg {
  background: #0A0A0A
}

.cap {
  font-size: 13px;
  letter-spacing: 0;
  color: var(--sub);
  margin-top: 13px;
  display: block;
  line-height: 1.5
}

.cap .lab {
  color: var(--text);
  margin-right: 7px;
  font-weight: 700
}

.cap .lab.ok {
  color: var(--success)
}

/* fig wrapper — tag above card */
.fig {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fig>.tag {
  position: static;
  align-self: flex-start;
  margin-bottom: 10px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--sub);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* tags inside figfond cells keep their original pill style + absolute position */
.figfond>div>.tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--chip);
  padding: 4px 9px;
  border-radius: 999px;
}

.figfond>div:first-child>.tag {
  color: #79797F;
  background: #EFEFF0;
}

.figfond>div:nth-child(2)>.tag {
  color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .1);
}

/* concept two-up */
.figfond {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow)
}

.figfond>div {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative
}

.figfond .m {
  width: 54%
}

.figfond>div:first-child .tag {
  color: #79797F;
  background: #EFEFF0
}

.figfond>div:nth-child(2) .tag {
  color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .1)
}

/* construction */
.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 14px;
  font-weight: 500
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px
}

.sw {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  display: inline-block
}

/* clear space / min size */
.minrow {
  display: flex;
  align-items: flex-end;
  gap: clamp(24px, 5vw, 64px);
  flex-wrap: wrap
}

.minrow .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px
}

.minrow .lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  font-variant-numeric: tabular-nums
}

/* color swatches */
.swatch {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card)
}

.swatch .chip {
  aspect-ratio: 16/10
}

.swatch .meta {
  padding: 13px 15px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center
}

.swatch .meta b {
  font-weight: 700
}

.swatch .meta span {
  color: var(--sub);
  font-variant-numeric: tabular-nums
}

/* do / dont */
.case .stage {
  aspect-ratio: 1
}

.case .badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-top: 13px
}

.case .badge .ic {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}

.case.ok .ic {
  background: var(--success);
  color: var(--on-status)
}

.case.no .ic {
  background: var(--error);
  color: #fff
}

.case .desc {
  color: var(--sub);
  font-size: 13.5px;
  margin-top: 5px;
  line-height: 1.5;
  font-weight: 400
}

/* secondary resource */
.particles {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 0 16px;
  gap: 4px;
}

.flatcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  gap: 18px;
  align-items: center
}

/* rule callout */
.rule {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  border-left: 2px solid var(--text);
  padding: 6px 0 6px 22px;
  margin: 8px 0
}

.rule .n {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  padding-top: 5px
}

.rule p {
  margin: 0;
  color: var(--sub)
}

.rule b {
  font-family: var(--ui);
  font-size: 17px;
  font-weight: 700;
  display: block;
  margin-bottom: 5px;
  letter-spacing: -.02em;
  color: var(--text)
}

/* semantic / status palette (UI only) */
.semantic {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card)
}

.seg-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sub);
  display: block;
  margin-bottom: 13px
}

.seg-row {
  display: flex;
  gap: 22px;
  flex-wrap: wrap
}

.seg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text)
}

.seg .dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0
}

.seg small {
  color: var(--sub);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-left: 2px
}

footer {
  border-top: 1px solid var(--border);
  padding-block: 44px
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--sub);
  letter-spacing: 0;
  font-weight: 500
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s ease
}

.reveal.in {
  opacity: 1;
  transform: none
}

@media(prefers-reduced-motion:reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none
  }
}

/* Modal Animación */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  position: relative;
  width: 90vw;
  height: 90vh;
  max-width: 1600px;
  max-height: 900px;
  background: #050505;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-container {
  transform: scale(1);
}

.modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #050505;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  transition: background 0.2s, transform 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5px;
}

@media (max-width: 768px) {
  .modal-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
  }

  .modal-close {
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
  }
}
