/* rubrique.dev: one page, no build step, no JavaScript.
   Palette: the app's Indigo theme (themes/dark.theme in the rubrique repo),
   plus the explorer's status colors. Dark only, like the theme. */

:root {
  --bg: #1d1f23;
  --bg-sidebar: #17191c;
  --surface: #2a2d33;
  --hover: #353941;
  --border: #2c2f35;
  --text: #d7dae0;
  --text-strong: #f4f5f7;
  --text-weak: #8a9099;
  --accent: #a79bff;
  --selection: #38336f;
  --code-bg: #26292e;
  --warning: #e0b252;
  --error: #f07272;
  --ok: #34a853;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "New York", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-small: 8px;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: dark;
}

/* Reset */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* An indigo glow at the top, fading into the plain background. */
  background-image:
    radial-gradient(ellipse 70% 50% at 70% -10%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 40% at 10% 10%, color-mix(in oklab, var(--selection) 60%, transparent), transparent 70%);
  background-repeat: no-repeat;
}

/* Film grain over everything, so the big flat areas do not look like a template. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--selection);
  color: var(--text-strong);
}

h1, h2, h3 {
  margin: 0;
  color: var(--text-strong);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  font-weight: 600;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0;
}

p + p {
  margin-top: 1em;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

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

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code, kbd {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  color: var(--text-strong);
}

kbd {
  border: 1px solid var(--hover);
  border-bottom-width: 2px;
}

pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

.muted {
  color: var(--text-weak);
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-small);
}

.skip:focus {
  top: 16px;
}

/* Eyebrow labels: monospace, small, spaced out. */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-weak);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-strong);
  font-weight: 550;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:hover {
  background: var(--hover);
  border-color: var(--hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #15132a;
}

.button.primary:hover {
  background: color-mix(in oklab, var(--accent) 88%, white);
  border-color: color-mix(in oklab, var(--accent) 88%, white);
}

.button.ghost {
  background: transparent;
  border-color: var(--hover);
}

.button.small {
  padding: 8px 14px;
  font-size: 0.95rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

/* Navigation: sticky, blurred, a hairline under it. */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  border-radius: 7px;
}

.nav nav {
  display: flex;
  gap: 4px 22px;
  margin-left: auto;
  font-size: 0.95rem;
}

.nav nav a {
  color: var(--text);
}

.nav nav a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

/* Layout */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
}

section {
  padding: clamp(56px, 8vw, 104px) 0 0;
}

.section-head {
  max-width: 34em;
  margin-bottom: 36px;
}

/* Hero: copy on the left, the screenshot leaning in from the right. */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  padding-top: clamp(40px, 7vw, 96px);
  min-height: min(calc(100dvh - 64px), 720px);
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.hero h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.lede {
  max-width: 34em;
  margin-bottom: 28px;
  font-size: 1.15rem;
  color: var(--text);
}

.hero-shot {
  margin: 0;
  perspective: 1400px;
}

.hero-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--hover);
  transform: rotateY(-10deg) rotateX(3deg) scale(1.06);
  transform-origin: left center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    -30px 0 80px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-shot:hover img {
  transform: rotateY(-3deg) rotateX(1deg) scale(1.06);
}

/* Manifesto: three numbered columns. */

.manifesto ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.manifesto li {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.manifesto .num {
  display: block;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
}

.manifesto h3 {
  margin-bottom: 8px;
}

.manifesto p {
  color: var(--text-weak);
}

/* Bento grid */

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

/* A faint light from the top-left corner, so each card reads as a surface. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 40% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  opacity: 0.8;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-2px);
}

.card > * {
  position: relative;
}

.card p {
  color: var(--text-weak);
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.card .plain {
  margin: 0;
  padding-left: 1.1em;
  color: var(--text-weak);
}

.card .plain li + li {
  margin-top: 6px;
}

/* The Ask demo: a prompt typed out, a diff, then Accept lit up. Pure CSS. */

.demo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  padding: 14px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
}

.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--hover);
  border-radius: 6px;
  color: var(--text-strong);
}

.demo-typed {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  border-right: 1px solid var(--accent);
  max-width: 100%;
  animation: typing 9s steps(16) infinite;
}

.demo-agent {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--selection);
  color: var(--text-strong);
  font-size: 0.72rem;
}

.demo-diff .line {
  margin: 0;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-weak);
}

.demo-diff .del,
.demo-diff .add {
  opacity: 0;
  animation: appear 9s ease infinite;
}

.demo-diff .del {
  background: color-mix(in srgb, var(--error) 14%, transparent);
  color: var(--error);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--error) 60%, transparent);
}

.demo-diff .add {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: color-mix(in srgb, var(--ok) 70%, white);
  animation-delay: 0.4s;
}

.demo-actions {
  display: flex;
  gap: 8px;
}

.demo-actions span {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--hover);
  color: var(--text-weak);
}

.demo-accept {
  animation: accept 9s ease infinite;
}

@keyframes typing {
  0% { width: 0; }
  28% { width: 100%; }
  100% { width: 100%; }
}

@keyframes appear {
  0%, 22% { opacity: 0; transform: translateY(4px); }
  30%, 100% { opacity: 1; transform: none; }
}

@keyframes accept {
  0%, 45% { background: transparent; color: var(--text-weak); border-color: var(--hover); }
  52%, 94% { background: var(--accent); color: #15132a; border-color: var(--accent); }
  100% { background: transparent; color: var(--text-weak); border-color: var(--hover); }
}

/* Terminal status list, like the explorer's sidebar. */

.status-list {
  margin: 0 0 6px;
  padding: 10px 12px;
  list-style: none;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-strong);
}

.status-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.status-list .muted {
  margin-left: auto;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-weak);
}

.dot.working {
  background: var(--warning);
  animation: blink 1.4s ease-in-out infinite;
}

.dot.needs { background: var(--accent); }
.dot.idle { background: var(--ok); }

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

/* Agents */

.agents {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.agents h2 {
  margin-bottom: 16px;
}

.agents p:not(.eyebrow) {
  color: var(--text-weak);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  justify-content: flex-end;
}

.chips li {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sidebar);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

/* Themes */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  color: var(--text);
}

.swatches li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--swatch, var(--surface));
  border: 1px solid var(--hover);
}

.frame {
  margin: 0;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--hover);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* Install tabs: radio inputs, no script. */

.tabs {
  margin-bottom: 28px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  width: fit-content;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab-list input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tab-list label {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-weak);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-list label:hover {
  color: var(--text-strong);
}

.tab-list input:checked + label {
  background: var(--surface);
  color: var(--text-strong);
}

.tab-list input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel {
  display: none;
  color: var(--text);
}

.tabs:has(#os-mac:checked) #panel-mac,
.tabs:has(#os-deb:checked) #panel-deb,
.tabs:has(#os-linux:checked) #panel-linux {
  display: block;
}

/* About */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 40px;
  padding-bottom: 24px;
}

.about h2 {
  margin-bottom: 20px;
}

.about-copy {
  font-size: 1.15rem;
  color: var(--text);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-strong);
  font-size: 0.95rem;
}

.links a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--border);
  color: var(--text-weak);
  font-size: 0.95rem;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--text);
  margin-left: 20px;
}

.footer a:first-child {
  margin-left: 0;
}

/* Scroll-driven reveal: sections rise as they enter the viewport.
   Only where supported and only when motion is welcome. */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .pulse, .dot.working, .demo-typed, .demo-diff .del, .demo-diff .add, .demo-accept {
    animation: none;
  }

  .demo-diff .del, .demo-diff .add {
    opacity: 1;
  }

  .hero-shot img {
    transform: none;
  }
}

/* Tablet */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 32px;
  }

  .hero-shot img {
    transform: none;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  }

  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-2, .span-3, .span-4 {
    grid-column: span 1;
  }

  .span-4 {
    grid-column: span 2;
  }

  .agents, .about {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .chips {
    justify-content: flex-start;
  }
}

/* Phones */

@media (max-width: 640px) {
  .nav nav {
    display: none;
  }

  .nav .button.small {
    margin-left: auto;
  }

  .manifesto ol, .bento {
    grid-template-columns: 1fr;
  }

  .span-4 {
    grid-column: span 1;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
  }

  .footer a {
    margin-left: 14px;
  }
}

/* Theme swatches: each built-in theme's background color. */
.swatch.light { --swatch: #fdfcfa; }
.swatch.indigo { --swatch: #1d1f23; }
.swatch.sepia { --swatch: #f6efe1; }
.swatch.midnight { --swatch: #0f1626; }
.swatch.contrast { --swatch: #000000; }
