/* IMD 404: what the protocol adds on top of the base. Same tokens, same strips, same blocks. */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.mark-top {
  fill: var(--mark-top, #d2fc52);
  transition: fill 250ms ease;
}

.mark-wall {
  fill: var(--mark-wall, #fff);
  transition: fill 250ms ease;
}

/* ---------------------------------------------------------------------------------------------
   Logo: the cube and the name, set in the page font
   --------------------------------------------------------------------------------------------- */

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: 56px;
  color: var(--lime);
  transition: color 250ms ease;
}

.logo-mark {
  flex: none;
  width: 46px;
  height: 56px;
}

.logo-word {
  font: 500 23.1px/56px var(--mono);
  white-space: nowrap;
}

.site-logo.is-on-light {
  --mark-top: #050505;
  --mark-wall: #050505;
  color: #050505;
}

/* ---------------------------------------------------------------------------------------------
   Hero: the name, the three lines, the two doors
   --------------------------------------------------------------------------------------------- */

.hero-lines {
  margin: 0;
  font: inherit;
}

.hero-row-name {
  margin-bottom: 10px;
}

.hero-row-name .hero-strip {
  padding: 0 18px;
  font-size: 72px;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.hero-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
}

.hero-actions > *,
.closing-actions > * {
  pointer-events: auto;
}

.hero-open,
.closing-open {
  grid-column: auto;
}

.hero-read,
.closing-read {
  display: grid;
  place-items: center;
  height: 56px;
  padding: 0 20px;
  background: #1d1e1a;
  color: #fff;
  font: 500 14px/1.4 var(--mono);
  white-space: nowrap;
  transition: background-color 250ms ease, color 250ms ease;
}

.hero-read:hover,
.closing-read:hover {
  background: #2b2d26;
  color: var(--lime);
}

/* ---------------------------------------------------------------------------------------------
   The X button: one more block in the header, beside the one that opens vault.md
   --------------------------------------------------------------------------------------------- */

.site-header:not(.page-header) {
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 6px;
}

.site-header:not(.page-header) .cta {
  grid-column: 3;
}

.x-link {
  grid-column: 2;
  display: grid;
  flex: none;
  place-items: center;
  width: 56px;
  height: 56px;
  background: #1d1e1a;
  color: #fff;
  transition: background-color 250ms ease, color 250ms ease;
}

.x-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.x-link:hover {
  background: var(--lime);
  color: #050505;
}

.x-link.is-on-light {
  background: #050505;
  color: var(--lime);
}

.x-link.is-on-light:hover {
  background: #2b2d26;
}

/* ---------------------------------------------------------------------------------------------
   Marquee: sentences instead of logos
   --------------------------------------------------------------------------------------------- */

.marquee-group svg {
  flex: none;
  width: 25px;
  height: 30px;
  --mark-wall: #8d8d8d;
}

/* ---------------------------------------------------------------------------------------------
   Menu cards are links
   --------------------------------------------------------------------------------------------- */

.menu-card-image {
  display: block;
}

.menu-card-caption {
  color: #bbbdb4;
  font-size: 9px;
  line-height: 1.3;
  text-transform: uppercase;
  transition: color 250ms ease;
}

.menu-card:hover .menu-card-caption,
.menu-card:focus-visible .menu-card-caption {
  color: var(--lime);
}

/* ---------------------------------------------------------------------------------------------
   Said plainly
   --------------------------------------------------------------------------------------------- */

.plain {
  padding: calc(170px * var(--content-scale)) 0;
  background: var(--paper);
  color: var(--ink);
}

.plain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(48px * var(--content-scale));
  margin-top: calc(72px * var(--content-scale));
}

.plain-card {
  position: relative;
  padding-top: calc(24px * var(--content-scale));
  border-top: 1px solid #080a0426;
}

.plain-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: calc(12px * var(--content-scale));
  height: calc(12px * var(--content-scale));
  background: var(--lime);
  transform: translateY(-50%) rotate(12deg);
}

.plain-card p {
  max-width: 34ch;
  margin-top: calc(12px * var(--content-scale));
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------------------------------
   Closing
   --------------------------------------------------------------------------------------------- */

.closing {
  padding: calc(170px * var(--content-scale)) 0;
  background: var(--black);
  color: var(--text);
}

.closing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: calc(120px * var(--content-scale));
}

.closing-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #050505;
}

.closing-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.closing-live {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  background: transparent;
}

.closing-line {
  max-width: 44ch;
  margin-top: calc(24px * var(--content-scale));
  color: var(--muted);
}

.closing-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-top: calc(44px * var(--content-scale));
}

.closing .cta :focus-visible,
.closing :focus-visible {
  outline-color: var(--lime);
}

/* ---------------------------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------------------------- */

.site-footer {
  padding: calc(56px * var(--content-scale)) 0 calc(72px * var(--content-scale));
  border-top: 1px solid #deded61f;
  background: var(--black);
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: calc(72px * var(--content-scale));
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--lime);
  font: 500 18.5px/45px var(--mono);
  white-space: nowrap;
}

.footer-logo svg {
  flex: none;
  width: 37px;
  height: 45px;
}

.footer-nav {
  display: flex;
  gap: 28px;
  white-space: nowrap;
}

.footer-nav a {
  color: var(--text);
  transition: color 250ms ease;
}

.footer-nav a:hover {
  color: var(--lime);
}

.footer-note {
  justify-self: end;
  max-width: 52ch;
  text-align: right;
}

.site-footer :focus-visible {
  outline-color: var(--lime);
}

/* ---------------------------------------------------------------------------------------------
   900px wide and under
   --------------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .site-header:not(.page-header) {
    justify-content: flex-start;
    gap: 6px;
  }

  .site-header:not(.page-header) .site-logo {
    margin-right: auto;
  }

  .site-header:not(.page-header) .x-link {
    order: 1;
    width: 44px;
    height: 44px;
  }

  .site-header:not(.page-header) .menu-button {
    order: 2;
  }

  .site-logo {
    gap: 6px;
    width: auto;
    height: 42px;
  }

  .logo-mark {
    width: 34.5px;
    height: 42px;
  }

  .logo-word {
    font-size: 17.3px;
    line-height: 42px;
  }

  .hero-row-name {
    margin-bottom: 4px;
  }

  .hero-row-name .hero-strip {
    padding: 2px 10px;
    font-size: clamp(42px, 12.4vw, 60px);
    line-height: 1.15;
  }

  .hero-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 18px;
  }

  .hero-open,
  .closing-open {
    display: flex;
  }

  /* No hover on a phone: the label sits against its plus. */
  .hero-open .cta-plus-start,
  .closing-open .cta-plus-start {
    display: none;
  }

  .hero-open .cta-label,
  .closing-open .cta-label {
    padding: 0 12px;
    transform: none;
  }

  .hero-open .cta-plus-end,
  .closing-open .cta-plus-end {
    position: static;
    transform: none;
  }

  .hero-read,
  .closing-read {
    padding: 0 12px;
  }

  .menu-card-image {
    aspect-ratio: 4 / 3;
  }

  .menu-card-caption {
    display: block;
    margin-top: 8px;
  }

  .plain,
  .closing {
    padding: 72px 0;
  }

  .plain-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    margin-top: 40px;
  }

  .plain-card {
    padding-top: 20px;
  }

  .plain-card::before {
    width: 12px;
    height: 12px;
  }

  .plain-card p {
    max-width: none;
    margin-top: 8px;
  }

  .closing-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .closing-line {
    margin-top: 16px;
  }

  .closing-actions {
    flex-wrap: wrap;
    margin-top: 28px;
  }

  .site-footer {
    padding: 40px 0 calc(48px + env(safe-area-inset-bottom));
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 24px;
  }

  .footer-nav {
    flex-wrap: wrap;
    gap: 12px 24px;
  }

  .footer-note {
    justify-self: start;
    max-width: none;
    text-align: left;
  }
}

/* Landscape phones: the name stays readable beside the model. */
@media (max-width: 900px) and (max-height: 500px) {
  .hero-row-name .hero-strip {
    font-size: 34px;
  }

  .hero-actions {
    margin-top: 12px;
  }
}

/* A narrow desktop window keeps the hover behaviour of the button. */
@media (max-width: 900px) and (hover: hover) and (pointer: fine) {
  .hero-open .cta-plus-start,
  .closing-open .cta-plus-start {
    display: grid;
  }

  .hero-open .cta-label,
  .closing-open .cta-label {
    transform: translateX(-62px);
  }

  .hero-open .cta-plus-end,
  .closing-open .cta-plus-end {
    position: absolute;
    transform: none;
  }

  .hero-open:hover .cta-label,
  .closing-open:hover .cta-label {
    transform: translateX(0);
  }

  .hero-open:hover .cta-plus-end,
  .closing-open:hover .cta-plus-end {
    transform: rotate(-45deg) scale(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mark-top,
  .mark-wall,
  .x-link,
  .site-logo,
  .hero-read,
  .closing-read,
  .menu-card-caption,
  .footer-nav a {
    transition: none;
  }
}
