/* Shell grid, columns, footer, responsive layout. Owner: menu/panel workstream (B).

   Desktop (> 920px): identity column on the left, the card on the right with the emblem
   behind it. The shell is exactly one viewport tall; the fixed footer has its own reserved
   strip at the bottom and the fixed HUD its own strip at the top right, so nothing overlaps.
   Mobile (<= 920px): a hero screen (name + menu) followed by one card per section. */

.shell,
.meta-bar {
  --footer-h: calc(44px * var(--k));
  --gutter: clamp(var(--s-5), 3.6vw, var(--s-8));
}

.shell {
  /* The fixed HUD (hud.css) covers roughly the top 120px of the right column. */
  --hud-clear: calc(120px * var(--k));
  --shell-pt: var(--s-6);
  position: relative;
  z-index: var(--z-shell);
  height: 100svh;
  min-height: 600px;
  display: grid;
  grid-template-columns: minmax(calc(300px * var(--k)), 0.84fr) minmax(0, 1.16fr);
  grid-template-rows: minmax(0, 1fr);
  column-gap: clamp(var(--s-5), 3vw, var(--s-7));
  padding: var(--shell-pt) var(--gutter) calc(var(--footer-h) + var(--s-2));
  isolation: isolate;
  overflow: clip;
}

/* Hidden until main.js marks the page ready (JS then runs the entrance). If scripts never
   finish, the fallback animation shows the page after 4s; <noscript> shows it at once. */
html:not(.is-ready) .shell,
html:not(.is-ready) .meta-bar {
  visibility: hidden;
  animation: shell-fallback 0s linear 4s forwards;
}

@keyframes shell-fallback {
  to {
    visibility: visible;
  }
}

/* Big outlined watermark word along the bottom of the screen. */
.shell::before {
  content: "Profile";
  position: absolute;
  left: calc(var(--gutter) * -0.5);
  bottom: calc(var(--fs-mega) * -0.2);
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--blue-soft) 14%, transparent);
  font-family: var(--font-display);
  font-size: calc(var(--fs-mega) * 1.12);
  line-height: 0.86;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(-4deg);
  transform-origin: 0 100%;
  pointer-events: none;
}

/* ------------------------------------------------------- identity column */

.identity {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: clamp(var(--s-4), 3.4vh, var(--s-6));
  min-width: 0;
  max-height: 100%;
}

.status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  margin: 0;
  color: var(--text-2);
  font-family: var(--font-hud);
  font-size: var(--fs-sm);
  font-style: italic;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-rule {
  width: var(--s-8);
  height: 4px;
  background: var(--red);
  /* Right end cut at -8deg: 4px * tan(8deg) ~ 0.6px, so lean it by a full step for legibility. */
  clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

.status-sep {
  color: var(--red);
  font-weight: 800;
}

.scroll-cue {
  display: none;
}

/* ---------------------------------------------------------- card column */

.panel-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  /* Bottom-aligned: spare height goes under the HUD, and the card's bottom edge sits a
     fixed distance above the footer (projects.js caps its list against that line). */
  align-items: end;
  justify-items: start;
  padding-top: calc(var(--hud-clear) - var(--shell-pt));
}

.card-stage {
  position: relative;
  width: min(100%, calc(700px * var(--k)));
  height: min(100%, calc(700px * var(--k)));
  min-height: 0;
}

/* The emblem behind the card is the time dial (js/timedial.js). The column's empty layout
   boxes let pointer events through to it; the card takes them back. */
@media (min-width: 921px) {
  .panel-wrap,
  .card-stage {
    pointer-events: none;
  }

  .card-stage > .content-card {
    pointer-events: auto;
  }
}

.mobile-section-stack {
  display: none;
}

/* ---------------------------------------------------------------- footer */

.meta-bar {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  z-index: calc(var(--z-shell) + 1);
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-family: var(--font-hud);
  font-size: var(--fs-sm);
  font-style: italic;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.meta-bar p {
  margin: 0;
}

.meta-quote {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-quote q {
  color: var(--text-2);
}

.meta-author {
  margin-left: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.meta-author::before {
  content: "";
  display: inline-block;
  width: var(--s-5);
  height: 1px;
  margin-right: var(--s-2);
  vertical-align: middle;
  background: var(--red);
}

.meta-sign {
  display: flex;
  flex: none;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.meta-sep {
  color: var(--red);
}

.noscript-note {
  position: relative;
  z-index: var(--z-shell);
  max-width: 640px;
  margin: 0 auto var(--s-7);
  padding: var(--s-5);
  color: var(--text-2);
  background: var(--abyss);
}

/* --------------------------------------------------- short desktop screens */

@media (min-width: 921px) and (max-height: 760px) {
  .shell {
    --hud-clear: 112px;
    --shell-pt: var(--s-5);
  }

  .identity {
    gap: var(--s-4);
  }
}

@media (min-width: 921px) and (max-width: 1180px) {
  .shell {
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  }
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 920px) {
  .shell {
    height: auto;
    min-height: 0;
    display: block;
    padding: var(--s-5) var(--gutter) var(--s-7);
    overflow: visible;
  }

  .shell::before {
    position: fixed;
    left: calc(var(--s-4) * -1);
    bottom: calc(var(--fs-mega) * -0.16);
    font-size: var(--fs-mega);
  }

  .status-line {
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
  }

  .status-rule {
    width: var(--s-6);
  }

  /* Hero: the name and the menu own the first screen. */
  .identity {
    min-height: calc(100svh - 120px);
    justify-content: center;
    gap: var(--s-5);
    padding-bottom: var(--s-8);
    position: relative;
  }

  .scroll-cue {
    position: absolute;
    left: 0;
    bottom: var(--s-4);
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 44px;
    color: var(--text-3);
    font-family: var(--font-hud);
    font-size: var(--fs-xs);
    font-style: italic;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-decoration: none;
    text-transform: uppercase;
  }

  .scroll-cue:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
  }

  .scroll-cue-line {
    width: var(--s-8);
    height: 1px;
    background: linear-gradient(90deg, var(--cyan), transparent);
  }

  .panel-wrap {
    display: block;
    padding-top: 0;
  }

  .panel-wrap > .card-stage {
    display: none;
  }

  .mobile-section-stack {
    display: grid;
    gap: var(--s-8);
  }

  .meta-bar {
    position: relative;
    left: auto;
    right: auto;
    height: auto;
    margin: 0 var(--gutter);
    padding: var(--s-5) 0 var(--s-6);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-3);
    pointer-events: auto;
  }

  .meta-quote {
    white-space: normal;
    line-height: 1.5;
  }

  .meta-author {
    display: block;
    margin: var(--s-2) 0 0;
  }
}
