/*
 * Labratorium homepage.
 * Dark first, with a light variant that follows prefers-color-scheme.
 * Mobile first: base rules are for phones; min-width queries add room.
 * No external fonts: system UI for text, the system monospace for the wordmark and labels.
 */

/* Tokens ------------------------------------------------------------------ */

:root {
  color-scheme: dark;

  --bg: #0c0c0b;
  --surface: #141413;
  --surface-hover: #1a1a18;
  --line: #2a2926;
  --line-strong: #47443e;
  --text: #edeae3;
  --text-2: #c8c4b9;
  --muted: #9b968b;
  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.1);
  --accent-line: rgba(245, 165, 36, 0.35);
  /* Decorative only (the wordmark cursor), never text, so it stays the same amber in both schemes. */
  --accent-mark: #f5a524;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  --gutter: 1rem;
  --measure: 40rem;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #f6f4ee;
    --surface: #fffefb;
    --surface-hover: #fbf9f3;
    --line: #dedace;
    --line-strong: #bdb7a9;
    --text: #191815;
    --text-2: #3a3833;
    --muted: #625e55;
    --accent: #935700;
    --accent-soft: rgba(147, 87, 0, 0.08);
    --accent-line: rgba(147, 87, 0, 0.3);
  }
}

/* Base -------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0 var(--gutter);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
}

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

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

/* Layout: one centered column; the body padding is the phone gutter. ------ */

.masthead,
.content,
.site-footer {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
}

.content {
  flex: 1 0 auto;
  padding-top: 2rem;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
  padding-top: clamp(3rem, 12vh, 7rem);
}

.wordmark {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(2.25rem, 1.6rem + 3vw, 3.25rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* A block cursor after the name. It blinks three times on load, then rests. */
.wordmark::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.72em;
  margin-left: 0.12em;
  background-color: var(--accent-mark);
}

.wordmark a {
  text-decoration: none;
}

.wordmark a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.tagline {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  line-height: 1.4;
}

/* Intro ------------------------------------------------------------------- */

.intro {
  max-width: 34rem;
  margin: 0;
  color: var(--text-2);
  font-size: 1.125rem;
  line-height: 1.65;
}

/* Experiments ------------------------------------------------------------- */

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 3.5rem 0 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--line);
}

.experiments {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.experiment {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.experiment:hover {
  border-color: var(--line-strong);
  background-color: var(--surface-hover);
}

.experiment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.experiment-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.experiment-title a {
  text-decoration: none;
}

/* The title link stretches over the whole card: one click target, one accessible name. */
.experiment-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.experiment-title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.experiment-title a:focus-visible {
  outline: none;
}

.experiment-title a:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.7em;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background-color: currentColor;
}

.experiment-desc {
  margin: 0.75rem 0 0;
  color: var(--text-2);
}

.experiment-link {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 1rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.experiment-link .arrow {
  color: var(--accent);
}

/* Not found page ---------------------------------------------------------- */

.masthead--compact {
  padding-top: 1.5rem;
}

.wordmark--small {
  font-size: 1.25rem;
}

.content--notfound {
  padding-top: clamp(3rem, 14vh, 7rem);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-title {
  margin: 0.75rem 0 0;
  font-size: clamp(1.75rem, 1.4rem + 1.75vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: var(--text-2);
  font-size: 1.125rem;
  line-height: 1.65;
}

.lede a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.lede a:hover {
  text-decoration-thickness: 2px;
}

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

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 0.375rem;
}

/* Motion: only when the reader has not asked for less. -------------------- */

@media (prefers-reduced-motion: no-preference) {
  .wordmark::after {
    animation: blink 1.1s steps(1, end) 3;
  }

  .experiment-link .arrow {
    transition: transform 0.15s ease;
  }

  .experiment:hover .arrow {
    transform: translateX(3px);
  }
}

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

/* Wider screens ----------------------------------------------------------- */

@media (min-width: 40em) {
  :root {
    --gutter: 1.5rem;
  }

  .masthead--compact {
    padding-top: 2rem;
  }

  .experiment {
    padding: 1.5rem;
  }
}
