/* Blocking styles for the once-per-tab editorial cover. They live outside
   app.css so the cover is opaque before SvelteKit paints the homepage. */
#boot-gate {
  --gate-canvas: #f3f0e8;
  --gate-ink: #171714;
  --gate-muted: rgba(23, 23, 20, 0.62);
  --gate-border: rgba(23, 23, 20, 0.18);
  --gate-primary: #3155d9;
  --gate-accent: #dc4a2b;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  overflow: hidden;
  background: var(--gate-canvas);
  color: var(--gate-ink);
  transition: opacity 380ms ease;
}

html[data-theme="dark"] #boot-gate {
  --gate-canvas: #171714;
  --gate-ink: #f3f0e8;
  --gate-muted: rgba(243, 240, 232, 0.66);
  --gate-border: rgba(243, 240, 232, 0.2);
  --gate-primary: #8aa1f2;
  --gate-accent: #f6836a;
}

#boot-gate.boot-gate-hide {
  opacity: 0;
  pointer-events: none;
}

.gate-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gate-border);
}

.gate-masthead p,
.gate-role {
  margin: 0;
  color: var(--gate-muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gate-cover {
  display: grid;
  flex: 1;
  grid-template-rows: 1fr auto;
}

.gate-name {
  align-self: center;
  margin: 0;
  font-family: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(4.5rem, 15vw, 12rem);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.78;
}

.gate-name > span {
  display: block;
}

.gate-accent {
  color: var(--gate-accent);
}

.gate-lower {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gate-border);
}

.gate-enter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--gate-primary);
  border-radius: 999px;
  background: var(--gate-primary);
  color: #fff;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 160ms ease;
}

html[data-theme="dark"] .gate-enter {
  color: #171714;
}

.gate-enter:hover {
  transform: translateY(-1px);
}

.gate-enter:focus-visible {
  outline: 2px solid var(--gate-primary);
  outline-offset: 3px;
}

.gate-enter span {
  display: inline-block;
  transition: transform 160ms ease;
}

.gate-enter:hover span {
  transform: translateX(2px);
}

/* Faithful to the header control, but coloured through the cover palette. */
.gate-theme-switch {
  display: grid;
  place-items: center;
}

.gate-theme-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.gate-theme-label {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  border: 1px solid var(--gate-border);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.gate-theme-label:hover {
  transform: translateY(-1px);
  border-color: var(--gate-primary);
}

.gate-theme-input:focus-visible + .gate-theme-label {
  outline: 2px solid var(--gate-primary);
  outline-offset: 2px;
}

.gate-theme-core {
  position: relative;
  width: 0.86rem;
  height: 0.86rem;
  border-radius: 999px;
  background: #f2c94c;
}

.gate-theme-core::after {
  position: absolute;
  top: -0.06rem;
  left: 0.28rem;
  width: 0.88rem;
  height: 0.88rem;
  border-radius: 999px;
  background: var(--gate-canvas);
  content: "";
  opacity: 0;
}

/* Ink, not primary: the header control's moon is drawn in ink since the
   redesign, and the gate's had stayed on the old accent. Same disc with a
   bite out of it, same colour, so the two toggles read as one control. */
.gate-theme-input:checked + .gate-theme-label .gate-theme-core {
  background: var(--gate-ink);
}

.gate-theme-input:checked + .gate-theme-label .gate-theme-core::after {
  opacity: 1;
}

@media (max-width: 520px) {
  .gate-name {
    font-size: clamp(4.25rem, 24vw, 7rem);
  }

  .gate-lower {
    align-items: flex-start;
    flex-direction: column;
  }

  .gate-enter {
    align-self: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  #boot-gate,
  .gate-enter,
  .gate-enter span,
  .gate-theme-label {
    transition: none;
  }
}
