/* Hallmark · pre-emit critique: P4 H5 E5 S4 R5 V4
 * Hallmark · genre: atmospheric · macrostructure: Index-First · theme: Paper
 * nav: N9 edge-aligned minimal · footer: Ft2 inline rule · enrichment: none
 */

:root {
  /* Palette — white paper, one cool signal */
  --color-paper:        oklch(99% 0.002 250);
  --color-paper-2:      oklch(97% 0.003 250);
  --color-paper-3:      oklch(94.5% 0.004 250);
  --color-rule:         oklch(87% 0.006 250);
  --color-neutral:      oklch(48% 0.008 250);
  --color-muted:        oklch(38% 0.008 250);
  --color-ink:          oklch(18% 0.01 250);
  --color-accent:       oklch(44% 0.11 255);
  --color-accent-hover: oklch(37% 0.12 255);
  --color-accent-ink:   oklch(99% 0 0);
  --color-status-idle:  oklch(68% 0.09 230);
  --color-status-dnd:   oklch(58% 0.16 25);
  --color-focus:        var(--color-accent);

  /* Type — Geist display/body, Geist Mono as the two-slot technical outlier */
  --font-display: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.25rem;
  --text-lg: 1.5625rem;
  --text-xl: 1.9531rem;
  --text-2xl: 2.4414rem;
  --text-display: clamp(2.25rem, 4vw + 1rem, 3.5rem);

  /* Space — 4pt scale */
  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --radius-control: 6px;
  --radius-card: 10px;
  --container: 46rem;
  --page-gutter: clamp(1rem, 4vw, 1.5rem);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long: 420ms;

  /* Depth */
  --z-base: 1;
  --z-sticky: 200;
  --z-modal: 400;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  overflow-x: clip;
  background: var(--color-paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: var(--z-modal);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-radius: var(--radius-control);
  font-weight: 500;
  transform: translateY(-200%);
}

.skip-link:focus { transform: translateY(0); }

/* Backdrop — ambient, never the subject */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-base);
  overflow: hidden;
  pointer-events: none;
}

.backdrop__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  transition: opacity var(--dur-long) var(--ease-out);
}

.backdrop__video.is-active { opacity: 0.72; }

.backdrop__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--color-paper) 30%, transparent),
    color-mix(in oklch, var(--color-paper) 55%, transparent)
  );
}

/* Audio element — hidden, still plays */
#v1 {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Page shell */
.shell {
  position: relative;
  z-index: var(--z-base);
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-lg) var(--page-gutter) calc(var(--space-3xl) + 4rem);
}

/* N9 — edge-aligned minimal */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.masthead__mark {
  color: var(--color-ink);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.masthead__action {
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out);
}

.masthead__action:hover,
.masthead__action[data-state="copied"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Frosted entry screen */
.gate {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-lg);
  background:
    radial-gradient(circle at 50% 35%, color-mix(in oklch, var(--color-paper) 38%, transparent), transparent 65%),
    color-mix(in oklch, var(--color-paper) 58%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
  transition: opacity var(--dur-long) var(--ease-out);
}

.gate.is-dismissed {
  opacity: 0;
  pointer-events: none;
}

.gate__panel {
  width: min(100%, 28rem);
  padding: clamp(1.5rem, 5vw, 2.75rem);
  border: 1px solid color-mix(in oklch, var(--color-rule) 70%, transparent);
  border-radius: 14px;
  background: color-mix(in oklch, var(--color-paper-2) 86%, transparent);
  box-shadow:
    0 24px 80px oklch(20% 0.02 250 / 0.14),
    inset 0 1px 0 oklch(100% 0 0 / 0.8);
  animation: enter var(--dur-long) var(--ease-out) both;
}

.gate__eyebrow {
  margin: 0 0 var(--space-lg);
  color: var(--color-neutral);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gate__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.gate__note {
  max-width: 34ch;
  margin: var(--space-md) 0 var(--space-xl);
  color: var(--color-muted);
}

.gate__enter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0 var(--space-lg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-control);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color var(--dur-micro) var(--ease-out),
    transform 100ms var(--ease-out);
}

.gate__enter:hover { background: var(--color-accent-hover); }
.gate__enter:active { transform: translateY(1px); }
.gate__enter span { font-size: 1.1em; letter-spacing: 0; }

/* Identity */
.main { outline: none; }

.identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  animation: enter var(--dur-long) var(--ease-out) both;
}

.identity__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-paper-3);
  box-shadow: 0 0 0 1px var(--color-rule);
  object-fit: cover;
}

.identity__copy { min-width: 0; }

.identity__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.identity__guild {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-inline-start: 0.15em;
  padding: 0.24em 0.5em 0.28em;
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  background: var(--color-paper-3);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 0.34em;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: 0.18em;
  white-space: nowrap;
}

.identity__guild-badge {
  width: 1.25em;
  height: 1.25em;
  border-radius: 3px;
  object-fit: contain;
}

.identity__tagline {
  max-width: 48ch;
  min-height: 1.55em;
  margin: var(--space-xs) 0 0;
  color: var(--color-muted);
  font-size: var(--text-base);
  overflow-wrap: anywhere;
}

.identity__tagline.is-typing::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-inline-start: 2px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: caret 1s steps(1) infinite;
}

/* Live presence */
.presence {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-paper-2);
}

.presence__dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-neutral);
}

.presence__dot[data-status="online"] { background: var(--color-accent); }
.presence__dot[data-status="idle"] { background: var(--color-status-idle); }
.presence__dot[data-status="dnd"] { background: var(--color-status-dnd); }

.presence__copy {
  flex: 1;
  min-width: 0;
}

.presence__label {
  margin: 0 0 var(--space-2xs);
  color: var(--color-neutral);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.presence__activity {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.presence__detail {
  margin: var(--space-3xs) 0 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.presence__detail:empty { display: none; }

.presence__avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-paper-3);
  object-fit: cover;
}

/* Link index */
.index { margin-top: var(--space-2xl); }

.index__title {
  margin: 0 0 var(--space-md);
  color: var(--color-neutral);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.index__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-rule);
}

.index__item + .index__item { border-top: 1px solid var(--color-rule); }

.index__link {
  display: grid;
  grid-template-columns: 1.5rem minmax(5.5rem, auto) minmax(0, 1fr) 1.25rem;
  align-items: center;
  gap: var(--space-sm);
  min-height: 56px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-control);
  color: var(--color-ink);
  text-decoration: none;
  transition: background-color var(--dur-micro) var(--ease-out);
}

.index__link:hover { background: var(--color-paper-2); }

.index__icon {
  color: var(--color-neutral);
  font-size: 1rem;
  text-align: center;
}

.index__name {
  font-weight: 500;
  white-space: nowrap;
}

.index__meta {
  min-width: 0;
  overflow: hidden;
  color: var(--color-muted);
  font-size: var(--text-sm);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index__arrow {
  justify-self: end;
  color: var(--color-neutral);
  transition: transform var(--dur-micro) var(--ease-out);
}

.index__link:hover .index__arrow { transform: translate(2px, -2px); }

/* Ft2 — inline rule */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-2xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
  color: var(--color-neutral);
  font-size: var(--text-sm);
}

.footer p { margin: 0; }

.footer a {
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
}

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

/* One compact player for every viewport */
.player {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--page-gutter) calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-rule);
  background: var(--color-paper-2);
}

.player__control {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-2xs);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-body);
  cursor: pointer;
}

.player__vinyl {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--color-paper-3), var(--color-paper));
  box-shadow: 0 0 0 1px var(--color-rule);
}

.player__control.is-playing .player__vinyl {
  animation: spin 5s linear infinite;
}

.player__vinyl-light {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, color-mix(in oklch, var(--color-ink) 8%, transparent), transparent 60%);
  pointer-events: none;
}

.player__cover {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.player__hole {
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-paper);
}

.player__state {
  min-width: 3.25rem;
  color: var(--color-neutral);
  font-size: var(--text-sm);
  text-align: left;
}

.player__info {
  flex: 1;
  min-width: 0;
}

.player__label {
  margin: 0 0 var(--space-3xs);
  color: var(--color-neutral);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player__track {
  margin: 0;
  overflow: hidden;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player__volume {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-neutral);
  font-size: 0.85rem;
}

.player__volume input {
  width: 64px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (min-width: 40rem) {
  .identity__avatar { width: 88px; height: 88px; }
  .player__vinyl { width: 44px; height: 44px; }
  .player__cover { width: 22px; height: 22px; }
  .player__volume input { width: 88px; }
}

@media (min-width: 60rem) {
  .shell { padding-top: var(--space-xl); }
  .masthead { margin-bottom: var(--space-3xl); }
  .identity__avatar { width: 104px; height: 104px; }
  .index { margin-top: var(--space-3xl); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }

  .identity { animation: none; }
  .gate__panel { animation: none; }
  .identity__tagline.is-typing::after { animation: none; }
  .player__control.is-playing .player__vinyl { animation: none; }
}
