/*
 * The KIS introduction page (kiswave.com and /ko/). Plain CSS on top of styles.css, no script
 * (the site's CSP has script-src 'none'). Motion is CSS only: the hero's KIOSK → KIS on load, and
 * scroll-driven reveals where the browser supports animation-timeline. Without that support, or
 * with reduced motion, every element simply shows in its final state.
 */

.home {
  --ink: #1b1a18;
  --brand-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --brand-line: color-mix(in srgb, var(--primary) 35%, transparent);
  overflow-x: clip;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.center {
  text-align: center;
  margin-inline: auto;
}

/* Sticky header */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9375rem;
}

.bar nav a:not(.button) {
  text-decoration: none;
  color: var(--muted);
}

.bar nav a:not(.button):hover {
  color: var(--text);
}

.button.small {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.875rem;
}

@media (max-width: 420px) {
  .bar nav {
    gap: 12px;
  }
  .bar nav a[href$='/login'] {
    display: none;
  }
}

/* Hero */
.home .hero-kis {
  position: relative;
  padding-block: 56px 72px;
}

.hero-grid {
  display: grid;
  gap: 48px;
  align-items: center;
}

@media (min-width: 900px) {
  .home .hero-kis {
    min-height: calc(100svh - 61px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 48px;
  }
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.hero-copy h1 {
  margin: 0 0 20px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.morph {
  display: flex;
  font-size: clamp(4.5rem, 18vw, 9.5rem);
  font-weight: 800;
  color: var(--primary);
}

.morph > span {
  display: inline-block;
  overflow: hidden;
}

.morph .gone {
  /* Final state: gone. The animation below starts them visible. */
  max-width: 0;
  opacity: 0;
}

.morph-tail {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-copy .lede {
  font-size: 1.1875rem;
  max-width: 32ch;
}

.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 380px;
}

/* A faint kiosk behind the phone: what KIS replaces. */
.kiosk-ghost {
  position: absolute;
  inset-inline-start: 6%;
  top: 0;
  display: grid;
  justify-items: center;
  opacity: 0.35;
}

.kiosk-screen {
  width: 150px;
  height: 230px;
  border: 3px dashed var(--muted);
  border-radius: 14px;
}

.kiosk-stand {
  width: 26px;
  height: 120px;
  border-inline: 3px dashed var(--muted);
}

/* Devices drawn in CSS */
.device {
  position: relative;
  background: var(--ink);
  box-shadow:
    0 30px 60px -20px rgb(0 0 0 / 0.35),
    0 0 0 1px rgb(255 255 255 / 0.06) inset;
}

.device .screen {
  height: 100%;
  background: #ffffff;
  color: #1b1a18;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 14px 14px;
  font-size: 0.75rem;
  line-height: 1.3;
}

.device .screen span,
.device .screen b {
  white-space: nowrap;
}

.s-card span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone {
  width: 240px;
  height: 460px;
  padding: 10px;
  border-radius: 38px;
}

.phone .screen {
  border-radius: 30px;
}

.phone::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 70px;
  height: 18px;
  translate: -50% 0;
  border-radius: 10px;
  background: var(--ink);
  z-index: 1;
}

.tablet {
  width: min(340px, 100%);
  height: 250px;
  padding: 10px;
  border-radius: 22px;
}

.tablet .screen {
  border-radius: 14px;
  padding: 14px;
}

.hero-phone {
  rotate: -4deg;
}

.s-store {
  margin: 8px 0 4px;
  font-weight: 700;
  font-size: 1rem;
}

.s-sub {
  margin: -6px 0 4px;
  color: #67625a;
}

.s-line {
  display: flex;
  justify-content: space-between;
  padding-inline: 12px;
  color: #67625a;
}

.s-item,
.s-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1efea;
}

.s-item.total {
  background: transparent;
  border-top: 1px solid #e4e1da;
  border-radius: 0;
  font-weight: 700;
}

.s-card span {
  flex: 1;
}

.s-card b {
  font-weight: 600;
}

.s-card.off {
  opacity: 0.5;
}

.dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
}

.dot.a {
  background: #c9a27e;
}
.dot.b {
  background: #5b4636;
}
.dot.c {
  background: #7b8fd1;
}
.dot.d {
  background: #e3b45c;
}

.s-pay {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: #5138f5;
  color: #ffffff;
  text-align: center;
  font-weight: 700;
}

.s-pay.dark {
  margin-top: 8px;
  background: #000000;
}

.s-pay.dark + .s-pay {
  margin-top: 0;
}

.s-caption {
  margin: 0;
  text-align: center;
  color: #67625a;
  font-weight: 600;
}

.s-caption.ok {
  color: #5138f5;
}

.screen.scan {
  justify-content: center;
  align-items: center;
  background: #1b1a18;
}

.screen.scan .s-caption {
  color: #f2f0ec;
}

.qr {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 8px;
  padding: 18px;
  background: #ffffff;
  border-radius: 12px;
  outline: 3px solid #a99bff;
  outline-offset: 10px;
}

.qr span {
  height: 34px;
  border-radius: 4px;
  background: #1b1a18;
}

.qr span:nth-child(2),
.qr span:nth-child(5),
.qr span:nth-child(9) {
  background: transparent;
  border: 6px solid #1b1a18;
}

.qr::after {
  /* The scanning line. */
  content: '';
  position: absolute;
  inset-inline: 6px;
  top: 50%;
  height: 3px;
  border-radius: 2px;
  background: #a99bff;
  box-shadow: 0 0 12px #a99bff;
}

.screen.kds {
  background: #1c1b19;
  flex-direction: row;
  align-items: stretch;
}

.ticket-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  background: #262420;
  color: #f2f0ec;
  border-top: 4px solid #a7a198;
}

.ticket-card strong {
  font-size: 1rem;
}

.ticket-card span {
  color: #a7a198;
}

.ticket-card em {
  margin-top: auto;
  font-style: normal;
  font-weight: 700;
}

.ticket-card.new {
  border-top-color: #a99bff;
  box-shadow: 0 0 0 2px #a99bff;
}

.ticket-card.done {
  border-top-color: #79a6ff;
}

.scroll-cue {
  display: none;
}

/* Sections */
.home section {
  padding-block: 72px;
  border-top: 0;
}

h2.big {
  text-wrap: balance;
  font-size: clamp(1.875rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 20ch;
}

.eyebrow.center {
  margin-bottom: 8px;
}

/* Story */
.story {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.steps {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  gap: 72px;
  position: relative;
}

.step-row {
  display: grid;
  gap: 28px;
  align-items: center;
  justify-items: center;
}

@media (min-width: 800px) {
  .step-row {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
  }
  .step-row:nth-child(even) .step-text {
    order: 2;
  }
  .step-row .step-text {
    justify-self: stretch;
  }
}

.step-text {
  max-width: 420px;
}

.step-text h3 {
  margin: 12px 0 8px;
  line-height: 1.2;
  text-wrap: balance;
  font-size: 1.625rem;
  letter-spacing: -0.02em;
}

.step-text p {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

.step-no {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--primary);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.step-art .phone {
  width: 230px;
  height: 420px;
}

/* Benefits */
.benefit-grid {
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .benefit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .benefit-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.benefit {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}

.benefit svg {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 12px;
  background: var(--brand-soft);
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.benefit h3 {
  margin: 16px 0 6px;
  font-size: 1.1875rem;
}

.benefit p {
  margin: 0;
  color: var(--muted);
}

/* Kiosk vs KIS */
.versus .table-wrap {
  margin-top: 40px;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.vs {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.vs th,
.vs td {
  padding: 16px 18px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.vs tbody tr:last-child > * {
  border-bottom: 0;
}

.vs thead th {
  font-size: 1.125rem;
}

.vs tbody th {
  color: var(--muted);
  font-weight: 600;
  width: 22%;
}

.vs td:not(.win) {
  color: var(--muted);
}

.vs .win {
  background: var(--brand-soft);
  color: var(--text);
  font-weight: 600;
}

.vs thead .win {
  color: var(--primary);
}

/* Three steps */
.trio {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

@media (min-width: 800px) {
  .trio {
    grid-template-columns: repeat(3, 1fr);
  }
}

.trio li {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}

.trio h3 {
  margin: 14px 0 6px;
}

.trio p {
  margin: 0;
  color: var(--muted);
}

/* Closing call to action */
.home .cta {
  padding-block: 24px 72px;
}

.cta-inner {
  padding: 56px 28px;
  border-radius: 28px;
  background: #5138f5;
  color: #ffffff;
  text-align: center;
}

.cta-inner h2 {
  margin: 0 auto 12px;
}

.cta-inner p {
  margin: 0 auto 24px;
  max-width: 44ch;
  color: rgb(255 255 255 / 0.85);
}

.cta-inner a:not(.button) {
  color: #ffffff;
}

.cta-inner .actions {
  justify-content: center;
}

.button.primary.inverse {
  background: #ffffff;
  color: #5138f5;
}

.cta-inner a:focus-visible {
  outline-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .home {
    --ink: #050505;
  }
  .kiosk-ghost {
    opacity: 0.45;
  }
  .cta-inner {
    background: #3523b8;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* KIOSK → KIS: the O and the last K start visible and fold away. */
  .morph .gone {
    animation: fold 900ms cubic-bezier(0.7, 0, 0.2, 1) 900ms both;
  }
  .morph {
    animation: settle 900ms ease-out 900ms both;
  }
  .morph-tail,
  .hero-copy .lede,
  .hero-copy .actions,
  .hero-copy .note {
    animation: rise 700ms ease-out both;
  }
  .morph-tail {
    animation-delay: 1500ms;
  }
  .hero-copy .lede {
    animation-delay: 1650ms;
  }
  .hero-copy .actions,
  .hero-copy .note {
    animation-delay: 1800ms;
  }
  .hero-phone {
    animation: float-in 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 300ms both;
  }
  .kiosk-ghost {
    animation: fade-out-kiosk 1200ms ease-in 1200ms both;
  }
  .qr::after {
    animation: scan 2.4s ease-in-out infinite alternate;
  }
  .ticket-card.new {
    animation: pulse 2s ease-in-out infinite;
  }

  .scroll-cue {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 16px;
    translate: -50% 0;
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    animation: bob 1.8s ease-in-out infinite;
  }

  /* Scroll-driven: reveal as each block enters the viewport; the hero phone drifts on scroll. */
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 35%;
    }
    .step-row.reveal .device {
      animation: device-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 45%;
    }
    .step-row.reveal {
      animation: none;
    }
    .step-row .step-text {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 40%;
    }
    .benefit:nth-child(3n + 2) {
      animation-range: entry 10% cover 40%;
    }
    .benefit:nth-child(3n) {
      animation-range: entry 15% cover 45%;
    }
    .hero-art {
      animation: drift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes fold {
  from {
    max-width: 1em;
    opacity: 1;
  }
  45% {
    opacity: 0;
  }
  to {
    max-width: 0;
    opacity: 0;
  }
}

@keyframes settle {
  from {
    color: var(--text);
  }
  to {
    color: var(--primary);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 16px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    translate: 40px 60px;
    rotate: 6deg;
  }
  to {
    opacity: 1;
    translate: 0 0;
    rotate: -4deg;
  }
}

@keyframes fade-out-kiosk {
  from {
    opacity: 0.6;
    scale: 1.05;
  }
  to {
    opacity: 0.35;
    scale: 0.9;
  }
}

@keyframes scan {
  from {
    top: 10%;
  }
  to {
    top: 88%;
  }
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, #a99bff 35%, transparent);
  }
}

@keyframes bob {
  50% {
    translate: -50% 6px;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    translate: 0 48px;
    scale: 0.97;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

@keyframes device-in {
  from {
    opacity: 0;
    translate: 0 80px;
    rotate: 5deg;
  }
  to {
    opacity: 1;
    translate: 0 0;
    rotate: 0deg;
  }
}

@keyframes drift {
  to {
    translate: 0 -80px;
    scale: 0.94;
  }
}

.eyebrow abbr {
  text-decoration: none;
}
