/* ────────────────────────────────────────────────────────
   sonos-remote-eink — project page
   Instrument Serif · Outfit · JetBrains Mono
   ──────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  --bg: #FAF9F6;
  --fg: #18150F;
  --text: #46413A;
  --muted: #736D65;
  --dim: #B0AAA0;
  --border: #DDD9D1;
  --surface: #EFECE6;
  --code-bg: #1A1816;
  --code-fg: #A39D94;
  --code-comment: #5E5950;

  --device-bg: #1A1816;
  --device-ring: #302D28;
  --lift: 0 2px 8px rgba(20, 17, 12, 0.07),
          0 0 0 1px rgba(20, 17, 12, 0.04);
  --lift-up: 0 8px 24px rgba(20, 17, 12, 0.12),
             0 0 0 1px rgba(20, 17, 12, 0.06);

  --display: 'Instrument Serif', Georgia, serif;
  --sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', 'Consolas', monospace;
}

/* ── Dark theme (system) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100F0D;
    --fg: #E8E4DC;
    --text: #B0ABA2;
    --muted: #908A82;
    --dim: #3E3A35;
    --border: #262320;
    --surface: #1A1816;
    --code-bg: #0B0A09;
    --code-fg: #8A8478;

    --device-bg: #1E1C19;
    --device-ring: #353230;

    --lift: 0 2px 8px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.04);
    --lift-up: 0 8px 24px rgba(0, 0, 0, 0.4),
               0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}

/* ── Dark mode: thicken Instrument Serif hairlines ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) h1 {
    text-shadow: 0 0 0.6px currentColor;
  }
  :root:not([data-theme="light"]) .lead {
    font-weight: 350;
  }
}

/* ── Dark theme (manual) ── */
:root[data-theme="dark"] {
  --bg: #100F0D;
  --fg: #E8E4DC;
  --text: #B0ABA2;
  --muted: #908A82;
  --dim: #3E3A35;
  --border: #262320;
  --surface: #1A1816;
  --code-bg: #0B0A09;
  --code-fg: #8A8478;

  --device-bg: #1E1C19;
  --device-ring: #353230;
  --lift: 0 2px 8px rgba(0, 0, 0, 0.3),
          0 0 0 1px rgba(255, 255, 255, 0.04);
  --lift-up: 0 8px 24px rgba(0, 0, 0, 0.4),
             0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] h1 {
  text-shadow: 0 0 0.6px currentColor;
}
[data-theme="dark"] .lead {
  font-weight: 350;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  top: 16px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s ease, color 0.35s ease;
}

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

/* ── Paper grain ── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.025;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grain { mix-blend-mode: screen; opacity: 0.04; }
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.04; }
[data-theme="light"] .grain { mix-blend-mode: multiply; opacity: 0.025; }

/* ── Page container ── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── Header ── */
header {
  padding: 80px 0 48px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  animation: rise 0.7s ease-out both;
}

header h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.5vw, 2.85rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-wrap: balance;
  margin-bottom: 20px;
  animation: rise 0.7s ease-out 0.07s both;
}

.lead {
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 300;
  color: var(--text);
  max-width: 540px;
  margin-bottom: 28px;
  animation: rise 0.7s ease-out 0.14s both;
}

.specs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--muted);
  animation: rise 0.7s ease-out 0.22s both;
}

.specs li {
  display: flex;
  align-items: center;
}

.specs li + li::before {
  content: '\00b7';
  margin: 0 10px;
  color: var(--dim);
}

/* ── Sections ── */
section {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 20px;
}

.note {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 24px;
}

pre + .note {
  margin-top: 16px;
}

/* ── Features ── */
.features {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.features > div {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.features > div:nth-child(odd) {
  padding-right: 28px;
  border-right: 1px solid var(--border);
}

.features > div:nth-child(even) {
  padding-left: 28px;
}

.features > div:nth-last-child(-n+2) {
  border-bottom: none;
}

.features dt {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--fg);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.features dd {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

@media (max-width: 540px) {
  .features {
    grid-template-columns: 1fr;
  }
  .features > div:nth-child(odd) {
    padding-right: 0;
    border-right: none;
  }
  .features > div:nth-child(even) {
    padding-left: 0;
  }
  .features > div:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  .features > div:last-child {
    border-bottom: none;
  }
}

/* ── Screenshots ── */
#screenshots {
  padding: 48px 0;
}

.frame {
  background: var(--device-bg);
  border-radius: 10px;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--lift);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  position: relative;
}

.frame::after {
  content: '';
  position: absolute;
  inset: 8px 10px;
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.frame:hover {
  box-shadow: var(--lift-up);
  transform: translateY(-2px);
}

.frame img {
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  position: relative;
  z-index: 1;
}

figcaption {
  text-align: center;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.hero-shot {
  text-align: center;
  margin-bottom: 28px;
}

.hero-shot .frame {
  padding: 18px 22px;
}

.hero-shot .frame img {
  width: 500px;
  max-width: 100%;
  height: auto;
}

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.shots figure {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in .shots figure {
  opacity: 1;
  transform: none;
}

.reveal.in .shots figure:nth-child(1) { transition-delay: 0.06s; }
.reveal.in .shots figure:nth-child(2) { transition-delay: 0.12s; }
.reveal.in .shots figure:nth-child(3) { transition-delay: 0.18s; }
.reveal.in .shots figure:nth-child(4) { transition-delay: 0.24s; }
.reveal.in .shots figure:nth-child(5) { transition-delay: 0.30s; }
.reveal.in .shots figure:nth-child(6) { transition-delay: 0.36s; }

.shots .frame {
  width: 100%;
  padding: 10px 12px;
}

.shots .frame img {
  width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  .shots {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 420px) {
  .shots {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ── Hardware table ── */
#hardware {
  padding: 36px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: left;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

td:first-child {
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  padding-right: 28px;
  width: 1%;
}

/* ── Code block ── */
#get-started {
  padding: 36px 0;
}

pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.8;
  position: relative;
}

pre::before {
  content: 'pi@raspberrypi';
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--code-comment);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

code {
  font-family: var(--mono);
}

pre code {
  color: var(--code-fg);
}

/* ── CTA ── */
.cta-wrap {
  margin-top: 24px;
}

.cta {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-block;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.cta:hover {
  background: var(--surface);
  border-color: var(--muted);
  transform: translateY(-1px);
}

/* ── Theme toggle ── */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s, transform 0.2s, opacity 0.2s;
  opacity: 0.7;
  font-size: 0;
}

.theme-toggle:hover {
  opacity: 1;
  border-color: var(--muted);
  transform: scale(1.08);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s;
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
}
[data-theme="dark"] .theme-toggle .icon-moon { display: none !important; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block !important; }
[data-theme="light"] .theme-toggle .icon-moon { display: block !important; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none !important; }

/* ── Footer ── */
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 28px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

footer a:hover {
  color: var(--fg);
  border-color: var(--fg);
}

footer .disclaimer {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 0.65rem;
  color: var(--dim);
}

/* ── Animations ── */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .shots figure { opacity: 1; transform: none; }
}
