/* Workspace passcode gate, designed as a magazine cover. Served before the
   workspace session exists, so it cannot use the app stylesheet. Palette and
   type follow latelyinprint.com: dark first, Archivo Black, a serif italic. */
@font-face { font-family: GateArchivo; src: url("/fonts/Archivo_400Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: GateArchivo; src: url("/fonts/Archivo_700Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: GateArchivoBlack; src: url("/fonts/ArchivoBlack_400Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --ink: #fbfbf8;
  --paper: #050505;
  --muted: #aaa8a2;
  --line: #3b3a37;
  --field: rgba(255, 255, 255, .04);
  --misprint-a: #e0452f;
  --misprint-b: #2fb5e0;
  --mark-filter: invert(1);
  color-scheme: dark;
}
/* A saved choice from the sun/moon switch (public/theme.js) wins over the system setting. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink: #14110e;
    --paper: #f5f3ef;
    --muted: #706c66;
    --line: #cecac3;
    --field: rgba(20, 17, 14, .03);
    --mark-filter: none;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ink: #14110e;
  --paper: #f5f3ef;
  --muted: #706c66;
  --line: #cecac3;
  --field: rgba(20, 17, 14, .03);
  --mark-filter: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { font: 400 16px/1.55 GateArchivo, Arial, sans-serif; -webkit-font-smoothing: antialiased; }

.cover {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding: clamp(28px, 4vw, 56px) clamp(28px, 6vw, 96px) clamp(24px, 3vw, 40px);
  overflow: hidden;
}

/* Printer's crop marks */
.crop { position: absolute; width: 22px; height: 22px; pointer-events: none; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--muted); }
.crop::before { width: 22px; height: 1px; }
.crop::after { width: 1px; height: 22px; }
.crop-tl { top: 12px; left: 12px; }
.crop-tl::before { top: 0; left: 0; } .crop-tl::after { top: 0; left: 0; }
.crop-tr { top: 12px; right: 12px; }
.crop-tr::before { top: 0; right: 0; } .crop-tr::after { top: 0; right: 0; }
.crop-bl { bottom: 12px; left: 12px; }
.crop-bl::before { bottom: 0; left: 0; } .crop-bl::after { bottom: 0; left: 0; }
.crop-br { right: 12px; bottom: 12px; }
.crop-br::before { right: 0; bottom: 0; } .crop-br::after { right: 0; bottom: 0; }

/* Press colour bar down the right edge */
.color-bar { position: absolute; top: 50%; right: 14px; display: grid; gap: 3px; transform: translateY(-50%); }
.color-bar i { display: block; width: 8px; height: 22px; }
.color-bar i:nth-child(1) { background: #00a3e0; }
.color-bar i:nth-child(2) { background: #e0007a; }
.color-bar i:nth-child(3) { background: #ffe100; }
.color-bar i:nth-child(4) { background: #111; outline: 1px solid var(--line); }
.color-bar i:nth-child(5) { background: #444; }
.color-bar i:nth-child(6) { background: #888; }
.color-bar i:nth-child(7) { background: #ccc; }
.color-bar i:nth-child(8) { background: #fff; outline: 1px solid var(--line); }

.issue-line-end { display: inline-flex; align-items: center; gap: 12px; }
.theme-switch { display: inline-grid; width: 30px; height: 30px; margin: -8px 0; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: border-color 180ms ease, transform 180ms ease; }
.theme-switch:hover { border-color: var(--ink); transform: rotate(8deg); }
.theme-switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.theme-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch .theme-moon { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .theme-sun { display: none; } :root:not([data-theme="dark"]) .theme-moon { display: block; } }
:root[data-theme="light"] .theme-sun { display: none; }
:root[data-theme="light"] .theme-moon { display: block; }

/* Masthead: the word runs off the page like a real cover. */
.masthead { position: relative; z-index: 0; }
.issue-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.masthead-word {
  margin: 0 0 0 -0.04em;
  font: 400 clamp(92px, min(24vw, 30vh), 360px)/.78 GateArchivoBlack, GateArchivo, Arial, sans-serif;
  letter-spacing: -.065em;
  text-transform: uppercase;
  white-space: nowrap;
  transform-origin: left top;
}

/* Cover lines: the passcode is the main headline. */
.cover-lines {
  position: relative;
  z-index: 1;
  align-self: center;
  display: grid;
  gap: 22px;
  width: min(100%, 560px);
  padding: clamp(28px, 6vh, 64px) 0;
}
.kicker { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.mark { width: 28px; height: 28px; object-fit: contain; filter: var(--mark-filter); }
h1 {
  margin: 0;
  font: 400 clamp(44px, 6.4vw, 84px)/.92 GateArchivoBlack, GateArchivo, Arial, sans-serif;
  letter-spacing: -.05em;
  text-transform: uppercase;
}
h1 em { font: italic 400 1.02em/1 "Times New Roman", Times, serif; letter-spacing: -.02em; text-transform: none; }
h1[data-misprint="true"] { animation: misprint 620ms steps(2, end); }
@keyframes misprint {
  0% { text-shadow: 6px 0 var(--misprint-a), -6px 0 var(--misprint-b); transform: translateX(-3px); }
  40% { text-shadow: -4px 2px var(--misprint-a), 4px -2px var(--misprint-b); transform: translateX(3px); }
  100% { text-shadow: none; transform: none; }
}
.intro { margin: 0; max-width: 46ch; color: var(--muted); font-size: 17px; }

form { display: grid; gap: 12px; margin-top: 6px; }
label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.passcode-field { display: flex; align-items: stretch; border-bottom: 2px solid var(--ink); background: var(--field); }
input {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 26px/1.2 GateArchivo, Arial, sans-serif;
  letter-spacing: .12em;
}
input::placeholder { color: var(--muted); }
input:focus-visible { outline: none; }
.passcode-field:focus-within { box-shadow: 0 2px 0 var(--ink); }
.passcode-toggle {
  min-width: 72px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 12px/1 GateArchivo, Arial, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.passcode-toggle:hover { color: var(--ink); }
button[type="submit"] {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 6px;
  padding: 0 26px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 700 15px/1 GateArchivo, Arial, sans-serif;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}
button[type="submit"]::after { content: "→"; font-size: 18px; transition: transform 140ms ease; }
button[type="submit"]:hover::after { transform: translateX(4px); }
button[type="submit"]:disabled { opacity: .6; cursor: progress; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.error { margin: 0; padding-left: 12px; border-left: 3px solid var(--misprint-a); font-size: 14px; }
.signin-help { margin: 0; max-width: 52ch; color: var(--muted); font-size: 13px; }
.signin-help a { color: var(--ink); text-underline-offset: 4px; }

/* Cover teasers, wide screens only */
.cover-teasers { display: none; }
@media (min-width: 980px) {
  .cover { grid-template-columns: minmax(0, 1fr) auto; }
  .masthead, .cover-foot { grid-column: 1 / -1; }
  .cover-teasers { display: grid; align-self: end; gap: 6px; padding: 0 28px clamp(28px, 6vh, 64px) 0; text-align: right; }
  .cover-teasers p { display: flex; align-items: baseline; justify-content: flex-end; gap: 14px; margin: 0; }
  .cover-teasers span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
  .cover-teasers em { font: italic 400 clamp(38px, 4.4vw, 68px)/1 "Times New Roman", Times, serif; letter-spacing: -.02em; }
}

/* Foot: tagline and barcode */
.cover-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.cover-tag { margin: 0; color: var(--muted); font-size: 14px; }
.cover-tag em { color: var(--ink); font: italic 400 20px/1 "Times New Roman", Times, serif; }
.barcode { display: grid; justify-items: end; gap: 6px; }
.barcode span {
  display: block;
  width: 150px;
  height: 44px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 16px);
}
.barcode small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .22em; }

/* Page turn into sign-in */
.cover[data-turning="true"] { animation: page-turn 420ms cubic-bezier(.6, 0, .4, 1) forwards; transform-origin: left center; }
@keyframes page-turn { to { transform: perspective(1600px) rotateY(-24deg) translateX(-8%); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  h1[data-misprint="true"] { animation: none; text-decoration: underline wavy var(--misprint-a) 2px; text-underline-offset: 10px; }
  .cover[data-turning="true"] { animation: fade-out 160ms linear forwards; }
  @keyframes fade-out { to { opacity: 0; } }
}

@media (min-width: 980px) {
  .cover-lines { margin-top: -4vw; }
}
@media (max-width: 640px) {
  .cover { padding: 26px 22px 20px; }
  .color-bar { right: 6px; }
  .color-bar i { width: 5px; height: 14px; }
  .issue-line span:first-child { display: none; }
  .masthead-word { font-size: 31vw; }
  .intro { font-size: 15px; }
  input { font-size: 22px; }
  button[type="submit"] { justify-self: stretch; justify-content: center; }
  .cover-foot { flex-direction: column; align-items: flex-start; }
  .barcode { justify-items: start; }
}
