/* ================================================================
   landing.css — minimalist, binary-vibe mode selector
   ================================================================ */

body.landing {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* whole-page tint follows the hovered / focused choice */
body.landing::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity .6s var(--ease-out);
  background:
    radial-gradient(ellipse 70% 60% at var(--tint-x, 30%) 50%, rgba(var(--tint-rgb, var(--red-rgb)), .13), transparent 70%);
}
body.landing[data-mode="engineering"]::before { --tint-rgb: var(--red-rgb);   --tint-x: 30%; opacity: 1; }
body.landing[data-mode="creative"]::before    { --tint-rgb: var(--amber-rgb); --tint-x: 72%; opacity: 1; }

/* ---------- bit-stream backdrop ---------- */
.bits {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;   /* two rows land in the panels' empty thirds, never behind text */
  overflow: hidden;
  font-family: var(--font-m);
  font-size: .62rem;
  letter-spacing: .18em;
  color: rgba(255,255,255,.034);
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
.bits-row {
  display: inline-block;
  will-change: transform;
  animation: bits-drift 90s linear infinite;
}
.bits-row:nth-child(2) { animation-duration: 120s; animation-direction: reverse; }
.bits-row:nth-child(3) { animation-duration: 75s; }
@keyframes bits-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- top bar ---------- */
.ld-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem 4vw 0;
  animation: ld-fade .7s var(--ease-out) .1s both;
}
.ld-brand { display: inline-flex; align-items: center; gap: .8rem; }
.ld-brand-mark {
  font-family: var(--font-h);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: .2rem .5rem;
  transition: color .2s, border-color .2s;
}
.ld-brand:hover .ld-brand-mark { color: var(--red); border-color: rgba(var(--red-rgb), .5); }
.ld-brand-name {
  font-family: var(--font-b);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  line-height: 1.4;
  color: var(--mid);
}
.ld-sys {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .62rem;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
}
.ld-sys-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px rgba(var(--red-rgb), .6);
  animation: ld-blink 1.6s steps(2) infinite;
}
.ld-sys-sep { color: var(--border2); }

/* ---------- main ---------- */
.ld-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 4vw 1.2rem;
  min-height: 0;
}

.ld-prompt {
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--mid);
  margin: 0 0 1rem .1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 1.4em;
  animation: ld-fade .6s var(--ease-out) .25s both;
}
.ld-prompt-arrow { color: var(--red); }
.ld-caret {
  display: inline-block;
  width: .55em; height: 1.05em;
  background: var(--text);
  margin-left: .05em;
  animation: ld-blink .9s steps(2) infinite;
  vertical-align: text-bottom;
}

/* ---------- choices ---------- */
.ld-choices {
  flex: 1;
  display: flex;
  gap: 1rem;
  min-height: 0;
}

.ld-choice {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13,13,13,.55);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  --c: var(--red);
  --c-rgb: var(--red-rgb);
  transition:
    flex-grow .6s var(--ease-out),
    border-color .35s,
    background .35s,
    box-shadow .5s;
  animation: ld-rise .8s var(--ease-out) both;
}
.ld-eng { flex-grow: 1.45; animation-delay: .35s; }
.ld-cre { flex-grow: 1;    animation-delay: .5s; --c: var(--amber); --c-rgb: var(--amber-rgb); }
.ld-eng .ld-title { --em: 8.4; }   /* "Engineering" */
.ld-cre .ld-title { --em: 6.3; }   /* "Creative" */

.ld-choice:hover, .ld-choice:focus-visible, .ld-choice.is-active {
  flex-grow: 1.7;
  border-color: rgba(var(--c-rgb), .55);
  background: rgba(13,13,13,.8);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 0 0 1px rgba(var(--c-rgb), .08);
  outline: none;
}
.ld-choices:has(.ld-choice:hover) .ld-choice:not(:hover),
.ld-choices:has(.ld-choice:focus-visible) .ld-choice:not(:focus-visible) { flex-grow: 1; }

/* engineering is the primary option — a resting glow even when idle */
.ld-eng { border-color: rgba(var(--red-rgb), .4); }
.ld-eng::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 8px;
  pointer-events: none;
  z-index: -1;
  box-shadow: 0 0 0 1px rgba(var(--red-rgb), .22), 0 0 70px rgba(var(--red-rgb), .16);
  animation: ld-pulse 3.2s ease-in-out infinite;
}
.ld-eng:hover::after, .ld-eng.is-active::after { animation: none; box-shadow: 0 0 0 1px rgba(var(--red-rgb), .45), 0 0 90px rgba(var(--red-rgb), .22); }

/* backgrounds */
.ld-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .28;
  transition: opacity .5s, transform 1.2s var(--ease-out);
}
.ld-choice:hover .ld-bg, .ld-choice.is-active .ld-bg { opacity: 1; }

.ld-bg-grid {
  background-image: radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 60% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 80% at 60% 40%, #000 20%, transparent 75%);
}
.ld-eng:hover .ld-bg-grid, .ld-eng.is-active .ld-bg-grid { transform: scale(1.06); }

/* scan line sweeps the primary option */
.ld-scan {
  position: absolute;
  left: 0; right: 0;
  top: -20%;
  height: 18%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(var(--red-rgb), .07), transparent);
  animation: ld-scan 5.5s var(--ease-io) infinite;
}

.ld-bg-film {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.06) 22px 34px, transparent 34px 56px);
  background-size: 56px 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 0 9%, transparent 9% 91%, #000 91% 100%);
  mask-image: linear-gradient(to bottom, #000 0 9%, transparent 9% 91%, #000 91% 100%);
}
.ld-cre:hover .ld-bg-film, .ld-cre.is-active .ld-bg-film { animation: ld-film 1.8s linear infinite; }

/* rows inside a choice */
.ld-choice-top, .ld-choice-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
/* key hints rest quietly, wake on hover / focus */
.ld-choice-bot { opacity: .5; transition: opacity .3s; }
.ld-choice:hover .ld-choice-bot, .ld-choice:focus-visible .ld-choice-bot, .ld-choice.is-active .ld-choice-bot { opacity: 1; }
.ld-bit {
  font-size: .8rem;
  letter-spacing: .3em;
  color: var(--c);
}
.ld-tag { display: inline-flex; align-items: center; gap: .45rem; }
.ld-tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px rgba(var(--c-rgb), .6); }
.ld-tag-rec { animation: ld-blink 1.1s steps(2) infinite; }

.ld-choice-mid { display: flex; flex-direction: column; gap: 1rem; }
.ld-title {
  display: block;
  font-family: var(--font-h);
  font-weight: 800;
  font-size: clamp(2.4rem, 5.4vw, 6rem);
  /* fit the word to the panel: (panel width − padding) / approx em-width of the word */
  font-size: clamp(1.8rem, calc((100cqw - 4.6rem) / var(--em, 8.4)), 7rem);
  letter-spacing: -0.045em;
  line-height: .95;
  color: var(--text);
  transition: color .3s, transform .6s var(--ease-out);
  transform-origin: left center;
}
.ld-choice:hover .ld-title, .ld-choice.is-active .ld-title { color: var(--c); transform: translateX(6px); }
.ld-desc {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--mid);
  max-width: 34ch;
  transition: color .3s;
}
.ld-choice:hover .ld-desc { color: var(--text); }

.ld-key { display: inline-flex; align-items: center; gap: .5rem; }
.ld-key kbd {
  font-family: inherit;
  font-size: .62rem;
  color: var(--text);
  border: 1px solid var(--border2);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: .12rem .42rem;
  background: rgba(255,255,255,.03);
}
.ld-enter { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); transition: color .25s; }
.ld-arrow { display: inline-block; transition: transform .35s var(--ease-out); font-family: var(--font-b); }
.ld-choice:hover .ld-enter, .ld-choice.is-active .ld-enter { color: var(--c); }
.ld-choice:hover .ld-arrow, .ld-choice.is-active .ld-arrow { transform: translateX(6px); }

/* choice made: chosen panel swallows the screen, the other collapses */
.ld-choices.is-choosing .ld-choice { transition: flex-grow .55s var(--ease-io), opacity .35s, border-color .3s; }
.ld-choices.is-choosing .ld-choice.is-chosen { flex-grow: 8; border-color: var(--c); }
.ld-choices.is-choosing .ld-choice:not(.is-chosen) { flex-grow: 0.0001; opacity: 0; padding-inline: 0; }
.ld-choices.is-choosing .ld-choice.is-chosen .ld-title { color: var(--c); }

/* ---------- footer ---------- */
.ld-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem 4vw 1.4rem;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  animation: ld-fade .7s var(--ease-out) .6s both;
}
.ld-foot-links { display: flex; gap: 1.6rem; }
.ld-foot-links a { transition: color .2s; }
.ld-foot-links a:hover { color: var(--text); }
.ld-foot-meta { display: flex; gap: .8rem; }
.ld-foot-sep { color: var(--border2); }

/* ---------- keyframes ---------- */
@keyframes ld-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes ld-rise  { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes ld-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes ld-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ld-scan  { 0% { top: -20%; } 60%, 100% { top: 120%; } }
@keyframes ld-film  { from { background-position: 0 0; } to { background-position: 56px 0; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .ld-choices { flex-direction: column; }
  .ld-eng { flex-grow: 1.25; }
  .ld-choice { padding: 1.4rem 1.5rem; }
  .ld-choice:hover, .ld-choice.is-active { flex-grow: 1.5; }
  .ld-title { font-size: clamp(2.2rem, 10vw, 4.6rem); font-size: clamp(2rem, calc((100cqw - 3.2rem) / var(--em, 8.4)), 4.6rem); }
  .ld-desc br { display: none; }
  .ld-bg-film {
    background-image: repeating-linear-gradient(180deg, transparent 0 18px, rgba(255,255,255,.06) 18px 28px, transparent 28px 46px);
    background-size: 100% 46px;
    -webkit-mask-image: linear-gradient(90deg, #000 0 7%, transparent 7% 93%, #000 93% 100%);
    mask-image: linear-gradient(90deg, #000 0 7%, transparent 7% 93%, #000 93% 100%);
  }
  @keyframes ld-film { from { background-position: 0 0; } to { background-position: 0 46px; } }
  .ld-brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ld-foot { flex-direction: column; gap: .6rem; align-items: flex-start; }
  .ld-foot-links { gap: 1.1rem; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .ld-top { padding-top: 1.1rem; }
  .ld-sys span:nth-child(2), .ld-sys-sep { display: none; }
  .ld-main { padding: 1rem 4vw .8rem; }
  .ld-prompt { margin-bottom: .7rem; }
  .ld-choices { gap: .7rem; }
  .ld-choice { padding: 1.1rem 1.15rem; border-radius: 6px; }
  .ld-title { font-size: clamp(1.8rem, 9.5vw, 3.4rem); font-size: clamp(1.8rem, calc((100cqw - 2.4rem) / var(--em, 8.4)), 3.4rem); }
  .ld-desc { font-size: .8rem; }
  .ld-key { display: none; }
  .ld-foot-meta { display: none; }
  .ld-foot { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}

@media (max-height: 560px) and (min-width: 901px) {
  .ld-title { font-size: clamp(2rem, 5vw, 4rem); }
  .ld-choice { padding: 1.3rem 1.6rem; }
}

/* short viewports (landscape phones): let the page scroll instead of clipping */
@media (max-height: 600px) {
  body.landing { height: auto; min-height: 100vh; min-height: 100dvh; overflow: auto; }
  .ld-main { flex: none; }
  .ld-choices { min-height: 0; }
  .ld-choice { min-height: 300px; }
}
@media (max-height: 600px) and (max-width: 900px) {
  .ld-choice { min-height: 230px; }
}
