/* Engraved light, Evangelion-grade. Rules: .arena-implementation/sauce/DESIGN_ENGRAVED_LIGHT.md */
@font-face {
  font-family: "Shippori Mincho B1";
  src: url("/fonts/shippori-mincho-b1-latin-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Share Tech Mono";
  src: url("/fonts/share-tech-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --el-ink: #040302;
  --el-hair: rgba(214, 182, 116, 0.16);
  --el-gold: #d6b674;
  --el-white: #f4efe6;
  --el-signal: #ff6a1a;
  --serif: "Shippori Mincho B1", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --mono: "Share Tech Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--el-ink); }
body {
  min-height: 100svh;
  color: var(--el-white);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 680px at 14% -12%, rgba(214, 182, 116, 0.1), transparent 62%),
    radial-gradient(800px 520px at 104% 118%, rgba(255, 106, 26, 0.05), transparent 60%),
    url("/hex.svg"),
    var(--el-ink);
}

/* The case back: one great engraved rosette behind the page, cropped by the edge, turning
   too slowly to notice. Same mask as the doors, so light only lands on engraved lines. */
body::before {
  content: "";
  position: fixed;
  top: -34vmin;
  right: -30vmin;
  width: 96vmin;
  aspect-ratio: 1;
  pointer-events: none;
  -webkit-mask: url("/dial.svg") center / contain no-repeat;
  mask: url("/dial.svg") center / contain no-repeat;
  background: radial-gradient(circle at 30% 70%, rgba(214, 182, 116, 0.1), rgba(214, 182, 116, 0.04) 60%);
  animation: turn 900s linear infinite reverse;
}

/* Instrument frame: one hairline and four corner ticks. */
.shell {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(28px, 5vh, 56px);
  padding: clamp(40px, 6vw, 84px) clamp(28px, 5.5vw, 84px) clamp(36px, 5vw, 64px);
}
.shell::before,
.shell::after {
  content: "";
  position: absolute;
  inset: 16px;
  pointer-events: none;
}
.shell::before { border: 1px solid var(--el-hair); }
.shell::after {
  inset: 12px;
  --t: linear-gradient(var(--el-gold), var(--el-gold));
  background:
    var(--t) top left / 22px 1px no-repeat, var(--t) top left / 1px 22px no-repeat,
    var(--t) top right / 22px 1px no-repeat, var(--t) top right / 1px 22px no-repeat,
    var(--t) bottom left / 22px 1px no-repeat, var(--t) bottom left / 1px 22px no-repeat,
    var(--t) bottom right / 22px 1px no-repeat, var(--t) bottom right / 1px 22px no-repeat;
  opacity: 0.7;
}

/* Title card: huge, tightly set serif, the live cursor in signal orange. An engraved
   ruler runs from the cursor to the frame, fading out: the instrument under the name. */
.title {
  display: flex;
  align-items: flex-end;
  gap: clamp(20px, 2.4vw, 36px);
}
.title::after {
  content: "";
  flex: 1;
  min-width: 0;
  height: 9px;
  background:
    linear-gradient(rgba(214, 182, 116, 0.34), rgba(214, 182, 116, 0.34)) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, rgba(214, 182, 116, 0.5) 0 1px, transparent 1px 120px) left bottom / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, rgba(214, 182, 116, 0.32) 0 1px, transparent 1px 12px) left bottom / 100% 4px no-repeat;
  -webkit-mask: linear-gradient(90deg, #000 30%, transparent);
  mask: linear-gradient(90deg, #000 30%, transparent);
}
.title h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(72px, 11.5vw, 184px);
  line-height: 0.8;
  letter-spacing: -0.035em;
}
.title h1 b {
  display: inline-block;
  width: 0.4em;
  height: 0.05em;
  margin-left: 0.06em;
  vertical-align: baseline;
  overflow: hidden; /* baseline = bottom edge, so the cursor sits on the line */
  background: var(--el-signal);
  font-size: inherit;
  color: transparent;
  animation: blink 1.1s steps(1) infinite;
}

/* Doors: three glass plates, each with an engraved dial. */
.doors {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 26px);
}
.door {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: clamp(360px, 54vh, 520px);
  padding: 20px 22px 24px;
  color: inherit;
  text-decoration: none;
  background:
    linear-gradient(118deg, rgba(255, 248, 232, 0.05) 0%, transparent 34%),
    linear-gradient(180deg, rgba(255, 244, 222, 0.035), rgba(255, 244, 222, 0.006) 72%);
  border: 1px solid var(--el-hair);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 222, 0.07),
    inset 0 -40px 60px -40px rgba(0, 0, 0, 0.6),
    0 40px 80px -40px rgba(0, 0, 0, 0.9);
  transition: transform 0.6s var(--ease), border-color 0.4s, background 0.4s;
  isolation: isolate;
}
/* Instrument corner ticks on every plate. */
.door::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  --t: linear-gradient(rgba(214, 182, 116, 0.55), rgba(214, 182, 116, 0.55));
  background:
    var(--t) top right / 10px 1px no-repeat, var(--t) top right / 1px 10px no-repeat,
    var(--t) bottom left / 10px 1px no-repeat, var(--t) bottom left / 1px 10px no-repeat,
    var(--t) bottom right / 10px 1px no-repeat, var(--t) bottom right / 1px 10px no-repeat;
}
.door::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 40px;
  height: 1px;
  background: var(--el-gold);
  transition: width 0.7s var(--ease), background 0.4s;
}
/* Hover only where a pointer can hover, so a tap on a phone never leaves a door stuck lifted. */
@media (hover: hover) {
  .door:hover {
    transform: translateY(-4px);
    border-color: rgba(214, 182, 116, 0.34);
    background: linear-gradient(180deg, rgba(255, 244, 222, 0.06), rgba(255, 244, 222, 0.012) 70%);
  }
  .door:hover::before { width: calc(100% + 2px); background: var(--el-signal); }
  .door:hover .index { color: var(--el-signal); opacity: 1; }
  .door:hover .glint::before { animation: glint 1.25s cubic-bezier(0.45, 0, 0.2, 1) forwards; }
  .door:hover .plate::after {
    box-shadow: 0 0 0 1px rgba(243, 226, 179, 0.62), 0 0 0 5px rgba(4, 3, 2, 0.7), 0 0 0 6px rgba(214, 182, 116, 0.24);
  }
  /* Chosen: the engraving catches more light and the dial turns a few degrees, like a bezel. */
  .door:hover .engrave { filter: brightness(1.7); transform: rotate(9deg); }
}
.door:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(214, 182, 116, 0.34);
  outline: 1px solid var(--el-signal);
  outline-offset: 5px;
}
.door:focus-visible::before { width: calc(100% + 2px); background: var(--el-signal); }
.door:focus-visible .index { color: var(--el-signal); opacity: 1; }
.door:focus-visible .engrave { filter: brightness(1.7); transform: rotate(9deg); }
.door:active { transform: translateY(-1px); transition-duration: 0.12s; }

/* One pass of light across the glass when a door is chosen. */
.glint {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.glint::before {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -50%;
  width: 38%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 246, 226, 0.12) 50%, transparent 100%);
  transform: skewX(-14deg);
  opacity: 0;
}

.index {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--el-gold);
  opacity: 0.75;
  transition: color 0.4s, opacity 0.4s;
}

.plate {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}
.plate > * { grid-area: 1 / 1; }
/* A dark lens keeps the emblem clear of the engraving. */
.plate::after {
  content: "";
  grid-area: 1 / 1;
  width: min(48%, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--el-ink) 58%, rgba(4, 3, 2, 0.6) 66%, transparent 70%);
  box-shadow: 0 0 0 1px rgba(214, 182, 116, 0.3), 0 0 0 5px rgba(4, 3, 2, 0.7), 0 0 0 6px rgba(214, 182, 116, 0.12);
  transition: box-shadow 0.5s;
}

.dial {
  width: min(100%, 320px);
  aspect-ratio: 1;
  animation: turn 300s linear infinite;
}
.engrave {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-mask: url("/dial.svg") center / contain no-repeat;
  mask: url("/dial.svg") center / contain no-repeat;
  background: linear-gradient(105deg,
    rgba(214, 182, 116, 0.34) 0%, rgba(214, 182, 116, 0.34) 43%,
    rgba(255, 244, 216, 1) 50%,
    rgba(214, 182, 116, 0.34) 57%, rgba(214, 182, 116, 0.34) 100%);
  background-size: 340% 100%;
  background-position: 100% 0;
  animation: sweep 9s var(--ease) infinite;
  transition: filter 0.5s, transform 1.8s var(--ease);
}
.door:nth-child(2) .engrave { animation-delay: 3s; }
.door:nth-child(3) .engrave { animation-delay: 6s; }

.emblem { position: relative; z-index: 1; }
.mark {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(58px, 5.4vw, 88px);
  letter-spacing: -0.05em;
}
.mark b { font-family: var(--mono); font-weight: 400; font-size: 0.66em; color: var(--el-signal); }
.glyph {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(84px, 7.6vw, 124px);
  line-height: 1;
}
.seal {
  width: clamp(92px, 8.2vw, 132px);
  height: auto;
}

.name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--el-hair);
}
.name strong {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(30px, 2.7vw, 44px);
  letter-spacing: -0.025em;
}
.name small {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--el-gold);
}

@keyframes turn { to { transform: rotate(360deg); } }
@keyframes sweep {
  0% { background-position: 100% 0; }
  24%, 100% { background-position: 0% 0; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes glint {
  0% { opacity: 0; transform: translateX(0) skewX(-14deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateX(460%) skewX(-14deg); }
}

/* Phones: rows, not shrunken columns. */
@media (max-width: 720px) {
  .shell { gap: 26px; padding: 44px 22px 34px; }
  .title h1 { font-size: clamp(56px, 18vw, 76px); }
  .doors { align-self: end; grid-template-columns: 1fr; gap: 12px; } /* title top, doors in thumb reach */
  .door {
    min-height: 0;
    grid-template-columns: 104px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 18px;
    padding: 14px 16px;
  }
  .plate { grid-column: 1; grid-row: 1 / span 2; height: 104px; }
  .dial { width: 104px; }
  .index { grid-column: 2; align-self: end; }
  .name { grid-column: 2; align-self: start; flex-direction: column; gap: 4px; padding-top: 0; border-top: 0; }
  .mark { font-size: 34px; }
  .glyph { font-size: 50px; }
  .seal { width: 52px; }
  .plate::after { width: 58px; box-shadow: 0 0 0 1px rgba(214, 182, 116, 0.3); }
  .title::after { display: none; }
  body::before { top: 16svh; right: -52vw; width: 112vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .door:hover .engrave, .door:focus-visible .engrave { transform: none; }
}
