/* landing/rules.css — the "Six rules" section (#how): the tab strip and the ruled stage
   that turns its page when a tab is tapped. */

/* ── Section ── */
.rules {
  position: relative;
}

/* ── Tabs ── */
.rules__tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.rtab {
  position: relative;
  text-align: left;
  padding: clamp(12px, 1.3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ash);
  overflow: hidden;
  transition: border-color .3s, color .3s, transform .3s var(--spring);
}

.rtab .rn {
  font-family: "Death Note", var(--font-serif);
  font-size: clamp(20px, 1.7vw, 30px);
  color: var(--crimson);
  display: block;
  line-height: 1;
}

.rtab .rt {
  display: block;
  font-size: clamp(13px, 1.2vw, 22px);
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rtab .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--crimson);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.rtab.on {
  border-color: rgba(240, 6, 70, .55);
  color: var(--text);
  transform: translateY(-2px);
}

.rtab.on .bar {
  transform: scaleX(1);
}

/* ── Stage ── */
.rules__stage {
  position: relative;
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  min-height: 190px;
  overflow: hidden;
}

/* Ruled notebook lines behind the page. */
.rules__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  pointer-events: none;
}

/* Every rule shares the same grid cell; only the active one is visible. */
.rule {
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(18px, 4vw, 44px);
  align-items: center;
  padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 40px);
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease-out, transform .22s ease-out, visibility 0s .22s;
}

.rule.on {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .45s var(--ease) .18s, transform .55s var(--ease) .18s, visibility 0s;
}

.rule.on .rule__n {
  animation: rule-ink .7s var(--ease) both;
}

@keyframes rule-ink {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.94);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rule__n {
  font-family: "Death Note", var(--font-serif);
  font-size: clamp(64px, 9vw, 150px);
  line-height: .9;
  color: var(--crimson);
  text-shadow: 0 0 40px rgba(240, 6, 70, .35);
  min-width: 1.2em;
  text-align: center;
}

.rule__k {
  font-family: var(--font-hand);
  color: var(--crimson);
  font-size: clamp(22px, 1.8vw, 32px);
  line-height: 1;
  margin: 0 0 6px;
}

.rule h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(26px, 3vw, 52px);
  line-height: 1.1;
}

.rule h3 span {
  color: var(--ivory);
}

.rule p {
  color: var(--ash);
  margin: 8px 0 0;
  max-width: 52ch;
}

.rule a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: clamp(15px, 1.2vw, 22px);
  border-bottom: 1px solid var(--crimson);
  padding-bottom: 2px;
}

.rule a:hover {
  color: var(--crimson);
}

/* ── Tablet (≤760px) ── */
@media (max-width: 760px) {
  .rules__tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .rule {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .rule__n {
    text-align: left;
  }
}

/* ── Phone (≤700px): the tabs become a swipeable strip, the numeral goes ── */
@media (max-width: 700px) {
  /* #how keeps this heading ahead of the shared `.landing-atmosphere .section h2`. */
  #how .head h2 {
    font-size: 30px;
  }

  .rules__tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    gap: 8px;
    padding: 2px 0 12px;
    scrollbar-width: none;
  }

  .rtab {
    flex: 0 0 auto;
    min-height: 48px;
    min-width: 105px;
    scroll-snap-align: start;
    padding: 10px 14px;
    border-radius: 12px;
  }

  .rtab .rn {
    font-size: 14px;
  }

  .rtab .rt {
    font-size: 12px;
  }

  .rules__stage {
    border-radius: 20px;
    background: #100d11;
    border-color: #ffffff13;
    min-height: 255px;
  }

  .rule {
    padding: 22px;
    gap: 8px;
  }

  .rule__n {
    display: none;
  }

  .rule h3 {
    font-size: 26px;
  }

  .rule p {
    font-size: 14px;
    line-height: 1.7;
  }

  .rule a {
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .rule__n {
    font-size: 56px;
  }
}
