/* =====================================================================
   xarc.dev — landing page
   Tokens mirror blog.xarc.dev; light is the default, dark follows the
   OS (or data-theme). The cyber bits stay faint: dot grid, glow, a
   softly pulsing cursor and the name decoding from noise.
   ===================================================================== */

@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Hack";
  src: url("fonts/hack-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Hack";
  src: url("fonts/hack-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ===== TOKENS ===== */

:root {
  --bg: #fbfbfa;
  --text: #34363b;
  --text-strong: #111214;
  --muted: #6b6e76;
  --faint: #9a9da4;
  --line: rgba(17, 18, 20, 0.09);
  --line-strong: rgba(17, 18, 20, 0.16);
  --accent: #0b6fc2;
  --accent-soft: rgba(11, 111, 194, 0.09);
  --selection: rgba(11, 111, 194, 0.16);
  --grid-dot: rgba(17, 18, 20, 0.11);
  --glow: rgba(11, 111, 194, 0.1);
  --ok: #1f9d55;
  --signal: #cc0848;

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Hack", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141517;
    --text: #b9bbc1;
    --text-strong: #ecedf0;
    --muted: #868991;
    --faint: #5f626a;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.13);
    --accent: #6bb8ff;
    --accent-soft: rgba(107, 184, 255, 0.1);
    --selection: rgba(107, 184, 255, 0.22);
    --grid-dot: rgba(255, 255, 255, 0.07);
    --glow: rgba(107, 184, 255, 0.08);
      --ok: #4cc38a;
  }
}

:root[data-theme="dark"] {
  --bg: #141517;
  --text: #b9bbc1;
  --text-strong: #ecedf0;
  --muted: #868991;
  --faint: #5f626a;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --accent: #6bb8ff;
  --accent-soft: rgba(107, 184, 255, 0.1);
  --selection: rgba(107, 184, 255, 0.22);
  --grid-dot: rgba(255, 255, 255, 0.07);
  --glow: rgba(107, 184, 255, 0.08);
  --ok: #4cc38a;
}

/* ===== BASE ===== */

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

body {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 48px 16px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-sans);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--selection);
}

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

/* Backdrop: dot grid and accent glow fading out from the centre */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 45% 40% at 50% 35%, var(--glow), transparent 70%),
    radial-gradient(circle, var(--grid-dot) 1px, transparent 1.4px) center / 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
}

/* ===== LAYOUT ===== */

.page {
  width: 100%;
  max-width: 560px;
}

.reveal {
  animation: rise 0.7s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

/* ===== INTRO ===== */

.prompt {
  display: flex;
  align-items: center;
  margin: 0 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--muted);
}

.prompt__sym {
  margin-right: 0.6em;
  color: var(--faint);
}

.cursor {
  width: 0.55em;
  height: 1.15em;
  margin-left: 0.3em;
  background: var(--signal);
  opacity: 0.6;
  animation: blink 2.2s ease-in-out infinite;
}

.name {
  margin: 0;
  font-size: clamp(2.5rem, 11vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text-strong);
  white-space: nowrap;
  text-transform: uppercase;
}

.name__dot {
  color: var(--signal);
}

.lede {
  max-width: 44ch;
  margin: 0.8rem 0 0;
  text-wrap: balance;
  font-size: 1.05rem;
  color: var(--muted);
}

/* ===== LINKS ===== */

.links {
  margin-top: 3.5rem;
}

.links__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
}

.links__title {
  margin: 0;
  font: inherit;
  color: var(--muted);
}

/* Rows bleed past the column so the hover sweep has room; dividers stay aligned with the text */
.rows {
  margin: 0.35rem -0.75rem 0;
  padding: 0;
  list-style: none;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0.75rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 90%) no-repeat left / 0% 100%;
  transition: background-size 0.4s var(--ease);
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 1px;
  background: var(--line);
}

.row:hover,
.row:focus-within {
  background-size: 100% 100%;
}

.row:has(.row__val:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.row__key {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  transition: color 0.15s var(--ease);
}

.row__val {
  overflow: hidden;
  color: var(--text-strong);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s var(--ease);
}

.row__val:focus-visible {
  outline: none;
}

/* The link covers the whole row; the copy button sits above it */
.row__val::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.row__val .x {
  display: none;
}

.row:hover .row__key,
.row:hover .row__val,
.row:focus-within .row__val {
  color: var(--accent);
}

.row__end {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--faint);
}

.row__arrow {
  font-size: 0.95rem;
  transition: transform 0.2s var(--ease), color 0.15s var(--ease);
}

.row:hover .row__arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.row__copy {
  position: relative;
  z-index: 1;
  align-self: center;
  margin: 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg);
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.row__copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.row__copy.is-done {
  color: var(--ok);
  border-color: var(--ok);
}

/* ===== FOOTER ===== */

.foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
}

.foot__right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.4s var(--ease) infinite;
}

/* Light / dark switch: moon in light mode, sun in dark mode */
.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.theme-switch:hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
}

.theme-switch__sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch__sun { display: block; }
  :root:not([data-theme="light"]) .theme-switch__moon { display: none; }
}

:root[data-theme="dark"] .theme-switch__sun { display: block; }
:root[data-theme="dark"] .theme-switch__moon { display: none; }

/* ===== SMALL SCREENS ===== */

@media screen and (max-width: 420px) {
  .row {
    grid-template-columns: 3.75rem minmax(0, 1fr) auto;
    gap: 0.75rem;
  }

  .row__val {
    font-size: 0.95rem;
  }
}

/* ===== MOTION ===== */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes blink {
  50% { opacity: 0.15; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--ok); }
  70%, 100% { box-shadow: 0 0 0 5px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
