:root {
  --bg: #f3f4f6;
  --bg-soft: #e8ebf0;
  --ink: #12141a;
  --muted: #5c6370;
  --line: rgba(18, 20, 26, 0.12);
  --accent: #2f5d50;
  --orb: rgba(47, 93, 80, 0.22);
  --wash: rgba(180, 198, 210, 0.45);
  --mx: 50;
  --my: 42;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

[data-period="dawn"] {
  --bg: #f6f2ef;
  --bg-soft: #efe6df;
  --accent: #9a5b3c;
  --orb: rgba(214, 146, 98, 0.28);
  --wash: rgba(232, 196, 168, 0.5);
}

[data-period="day"] {
  --bg: #f3f4f6;
  --bg-soft: #e5eaf0;
  --accent: #2f5d50;
  --orb: rgba(47, 93, 80, 0.2);
  --wash: rgba(170, 190, 205, 0.42);
}

[data-period="dusk"] {
  --bg: #f4f1ef;
  --bg-soft: #ebe3dc;
  --accent: #8a4b3a;
  --orb: rgba(196, 120, 88, 0.26);
  --wash: rgba(220, 180, 150, 0.45);
}

[data-period="night"] {
  --bg: #eef1f5;
  --bg-soft: #dde4ec;
  --accent: #3a4f6a;
  --orb: rgba(90, 120, 160, 0.28);
  --wash: rgba(150, 170, 200, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  transition: background-color 1.2s var(--ease), color 0.6s ease;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient__wash {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(
      55% 45% at calc(var(--mx) * 1%) calc(var(--my) * 1%),
      var(--wash),
      transparent 58%
    ),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-soft) 52%, var(--bg) 100%);
  transition: background-color 1.2s var(--ease);
}

.ambient__orb {
  position: absolute;
  width: min(58vw, 34rem);
  aspect-ratio: 1;
  left: calc(var(--mx) * 1%);
  top: calc(var(--my) * 1%);
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orb) 0%, transparent 68%);
  filter: blur(8px);
  transition: width 0.8s var(--ease);
  will-change: left, top;
}

.ambient__grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.top,
.stage,
.foot {
  position: relative;
  z-index: 1;
}

.top,
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
}

.top__domain,
.foot__status,
.greeting,
.role,
.copy__bio,
.copy__prompt {
  margin: 0;
}

.top__domain {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top__meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.flip-clock {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.flip-clock__group {
  display: flex;
  align-items: center;
  gap: 0.12rem;
}

.flip-clock__unit {
  display: flex;
  gap: 0.08rem;
}

.flip-clock__sep {
  display: grid;
  place-items: center;
  min-width: 0.42rem;
  padding-inline: 0.02rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
}

.flip-clock__sep--colon {
  min-width: 0.34rem;
  animation: colon-blink 1s steps(1, end) infinite;
}

.flip {
  position: relative;
  width: 0.92rem;
  height: 1.28rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  perspective: 180px;
  border-radius: 0.22rem;
  background: color-mix(in srgb, #ffffff 78%, var(--bg-soft));
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 1px 1px rgba(18, 20, 26, 0.04);
  overflow: hidden;
}

.flip__static,
.flip__flap {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
}

.flip__half {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, #ffffff 86%, var(--bg-soft));
}

.flip__half span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: grid;
  place-items: center;
}

.flip__top span {
  top: 0;
}

.flip__bottom {
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.flip__bottom span {
  bottom: 0;
}

.flip__flap {
  z-index: 2;
  transform-style: preserve-3d;
  transform-origin: center;
  pointer-events: none;
  visibility: hidden;
}

.flip.is-flipping .flip__flap {
  visibility: visible;
}

.flip__flap-top,
.flip__flap-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  background: color-mix(in srgb, #ffffff 90%, var(--bg-soft));
}

.flip__flap-top {
  top: 0;
  transform-origin: bottom center;
  border-radius: 0.22rem 0.22rem 0 0;
  box-shadow: inset 0 0 0 1px transparent;
}

.flip__flap-bottom {
  bottom: 0;
  transform-origin: top center;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 0 0 0.22rem 0.22rem;
  transform: rotateX(90deg);
}

.flip__flap-top span,
.flip__flap-bottom span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: grid;
  place-items: center;
}

.flip__flap-top span {
  top: 0;
}

.flip__flap-bottom span {
  bottom: 0;
}

.flip.is-flipping .flip__flap-top {
  animation: flip-top 0.45s var(--ease) forwards;
}

.flip.is-flipping .flip__flap-bottom {
  animation: flip-bottom 0.45s var(--ease) forwards;
}

.flip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 0.5px);
  height: 1px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  z-index: 3;
  pointer-events: none;
}

@keyframes flip-top {
  0% {
    transform: rotateX(0deg);
    z-index: 3;
  }
  100% {
    transform: rotateX(-90deg);
    z-index: 3;
  }
}

@keyframes flip-bottom {
  0% {
    transform: rotateX(90deg);
    z-index: 2;
  }
  50% {
    transform: rotateX(90deg);
    z-index: 2;
  }
  100% {
    transform: rotateX(0deg);
    z-index: 4;
  }
}

@keyframes colon-blink {
  0%,
  49% {
    opacity: 0.75;
  }
  50%,
  100% {
    opacity: 0.2;
  }
}

.lang-toggle {
  min-width: 2.4rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition:
    color 0.25s ease,
    border-color 0.25s ease,
    background-color 0.25s ease;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
  color: var(--ink);
  border-color: rgba(18, 20, 26, 0.28);
  background: rgba(255, 255, 255, 0.45);
  outline: none;
}

.stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem)
    clamp(2rem, 6vw, 4rem);
  max-width: 72rem;
}

.greeting {
  margin-bottom: 1.1rem;
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transform: translateY(0.6rem);
  animation: rise 0.9s var(--ease) 0.05s forwards;
}

.brand {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.02em;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(4.4rem, 18vw, 11rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.06em;
  text-transform: lowercase;
}

.brand__letter {
  position: relative;
  display: inline-grid;
  place-items: center;
  isolation: isolate;
  will-change: transform;
  opacity: 0;
  transform: translateY(0.18em);
  animation: rise 0.95s var(--ease) forwards;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.brand__letter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.08em;
  border-radius: 0.08em;
}

.brand__letter:nth-child(1) {
  animation-delay: 0.08s;
}
.brand__letter:nth-child(2) {
  animation-delay: 0.14s;
}
.brand__letter:nth-child(3) {
  animation-delay: 0.2s;
}
.brand__letter:nth-child(4) {
  animation-delay: 0.26s;
}
.brand__letter:nth-child(5) {
  animation-delay: 0.32s;
}

.brand__glyph {
  position: relative;
  z-index: 1;
  display: inline-block;
  transform-origin: center bottom;
}

.brand__letter.is-m .brand__glyph {
  animation: letter-m 0.7s var(--ease);
}

.brand__letter.is-a .brand__glyph {
  animation: letter-a 0.75s var(--ease);
  color: var(--accent);
}

.brand__letter.is-t .brand__glyph {
  animation: letter-t 0.7s var(--ease);
}

.brand__letter.is-e .brand__glyph {
  animation: letter-e 0.8s var(--ease);
}

.brand__letter.is-o .brand__glyph {
  animation: letter-o 0.85s var(--ease);
}

.brand__ripple,
.brand__orbit,
.brand__spark,
.brand__echo {
  position: absolute;
  pointer-events: none;
}

.brand__ripple {
  inset: 18% 8%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 50%;
  opacity: 0;
  z-index: 0;
  animation: ripple-out 0.7s var(--ease) forwards;
}

.brand__orbit {
  width: 1.15em;
  height: 1.15em;
  border: 1.5px solid color-mix(in srgb, var(--accent) 65%, transparent);
  border-radius: 50%;
  opacity: 0;
  z-index: 0;
  animation: orbit-spin 0.85s var(--ease) forwards;
}

.brand__spark {
  width: 0.12em;
  height: 0.12em;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  z-index: 2;
  animation: spark-fly 0.7s var(--ease) forwards;
}

.brand__echo {
  z-index: 0;
  font: inherit;
  color: color-mix(in srgb, var(--accent) 55%, transparent);
  animation: echo-drift 0.85s var(--ease) forwards;
}

@keyframes letter-m {
  0% {
    transform: scale(1) translateY(0);
  }
  35% {
    transform: scale(0.86) translateY(0.05em);
  }
  70% {
    transform: scale(1.08) translateY(-0.04em);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

@keyframes letter-a {
  0% {
    transform: scale(1) rotate(0deg);
    filter: blur(0);
  }
  40% {
    transform: scale(1.12) rotate(-4deg);
    filter: blur(0.5px);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: blur(0);
  }
}

@keyframes letter-t {
  0% {
    transform: rotate(0deg) translateY(0);
  }
  30% {
    transform: rotate(-12deg) translateY(0.03em);
  }
  60% {
    transform: rotate(8deg) translateY(-0.05em);
  }
  100% {
    transform: rotate(0deg) translateY(0);
  }
}

@keyframes letter-e {
  0% {
    transform: scaleX(1);
    letter-spacing: 0;
  }
  40% {
    transform: scaleX(1.18);
  }
  100% {
    transform: scaleX(1);
  }
}

@keyframes letter-o {
  0% {
    transform: scale(1) rotate(0deg);
  }
  45% {
    transform: scale(0.9) rotate(18deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes ripple-out {
  0% {
    opacity: 0.7;
    transform: scale(0.55);
  }
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes orbit-spin {
  0% {
    opacity: 0.85;
    transform: scale(0.7) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.35) rotate(220deg);
  }
}

@keyframes spark-fly {
  0% {
    opacity: 0.95;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--sx), var(--sy)) scale(0.3);
  }
}

@keyframes echo-drift {
  0% {
    opacity: 0.7;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(0.12em, -0.55em) scale(1.25);
  }
}

body.is-letter-hit .ambient__orb {
  width: min(68vw, 40rem);
  transition: width 0.35s var(--ease);
}

.role {
  margin-top: 1.35rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  opacity: 0;
  transform: translateY(0.7rem);
  animation: rise 0.9s var(--ease) 0.42s forwards;
}

.copy {
  margin-top: 1.15rem;
  max-width: 34rem;
  opacity: 0;
  transform: translateY(0.7rem);
  animation: rise 0.9s var(--ease) 0.52s forwards;
}

.copy__bio {
  font-size: clamp(1.02rem, 2.1vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink);
}

.copy__prompt {
  margin-top: 0.55rem;
  font-size: clamp(1.02rem, 2.1vw, 1.2rem);
  line-height: 1.55;
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.35rem;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(0.7rem);
  animation: rise 0.9s var(--ease) 0.62s forwards;
}

.links[hidden] {
  display: none;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
  outline: none;
}

.foot__status {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  transition: color 0.35s ease, opacity 0.35s ease;
}

.foot__status.is-flash {
  color: var(--accent);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .top,
  .foot {
    padding-block: 1rem;
  }

  .top {
    align-items: flex-start;
  }

  .top__meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.55rem;
  }

  .flip-clock {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.28rem;
  }

  .flip {
    width: 0.84rem;
    height: 1.16rem;
    font-size: 0.66rem;
  }

  .stage {
    padding-top: 1.25rem;
  }

  .brand {
    max-width: 8.5ch;
  }
}

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

  .greeting,
  .brand__letter,
  .role,
  .copy,
  .links {
    opacity: 1;
    transform: none;
  }

  .ambient__orb,
  .brand__ripple,
  .brand__orbit,
  .brand__spark,
  .brand__echo {
    display: none;
  }

  .flip-clock__sep--colon {
    animation: none;
    opacity: 0.7;
  }

  .flip.is-flipping .flip__flap-top,
  .flip.is-flipping .flip__flap-bottom {
    animation: none;
  }

  .brand__letter.is-a .brand__glyph,
  .brand__letter.is-m .brand__glyph,
  .brand__letter.is-t .brand__glyph,
  .brand__letter.is-e .brand__glyph,
  .brand__letter.is-o .brand__glyph {
    color: var(--accent);
  }
}
