/* Copyright 2024-2026 Michele Dallachiesa <michele.dallachiesa@sigforge.com>. */
/* Licensed under the Apache License, Version 2.0 (SPDX-License-Identifier: Apache-2.0). */

/* The layout of sigforge.com in a color of its own: Inter and JetBrains Mono, a zinc scale, a teal accent, pill
   buttons, bordered cards, and a dark band. The fonts are Latin subsets served from /static, so no page loads a
   third party. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/Inter-Regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Inter-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/Inter-Bold.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2"); }

/* Each color is light-dark(light, dark): the scheme follows the system, or the choice the header button stores. */
:root {
  color-scheme: light dark;
  --font: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --accent: light-dark(#0F766E, #2DD4BF);
  --accent-text: light-dark(#FFFFFF, #18181B);
  --ink: light-dark(#09090B, #FFFFFF);
  --text: light-dark(#27272A, #D4D4D8);
  --muted: light-dark(#71717A, #A1A1AA);
  --line: light-dark(#E4E4E7, #2E2E33);
  --page: light-dark(#FFFFFF, #0C0C0E);
  --surface: light-dark(#F7F7F8, #1F1F23);
  --band-bg: light-dark(#18181B, #27272A);
  --band-fg: #FAFAFA;
  --band-muted: #D4D4D8;
  --footer-bg: light-dark(#F4F4F5, #141416);
  --footer-fg: light-dark(#52525B, #A1A1AA);
  --danger: light-dark(#B91C1C, #F87171);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Page frame: a sticky header, the content column, and a footer band. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--page); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[id] { scroll-margin-top: 5rem; }

.site-header { position: sticky; top: 0; z-index: 10; background: var(--page); border-bottom: 1px solid var(--line); }
.site-header__inner, .site-footer__inner, main { width: 100%; max-width: 64rem; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand img { width: 24px; height: 24px; }
.site-header__actions { display: flex; align-items: center; gap: 0.5rem; }
.brand, .site-header .btn { white-space: nowrap; }

/* Theme button: one icon per choice; theme.js sets data-theme on <html> and reveals the button. */
[hidden] { display: none !important; }
button.theme-toggle { width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--ink); }
button.theme-toggle:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.theme-toggle svg { display: none; }
:root:not([data-theme]) .theme-toggle__system,
:root[data-theme="light"] .theme-toggle__light,
:root[data-theme="dark"] .theme-toggle__dark { display: block; }
main { flex: 1; padding-top: 2.5rem; padding-bottom: 4rem; }
.page { max-width: 42rem; }

.site-footer { background: var(--footer-bg); color: var(--footer-fg); font-size: 0.85rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.site-footer a { color: var(--footer-fg); }
.site-footer a:hover { color: var(--accent); }

/* Type: tight, heavy headings; a muted lead; small monospace labels. */
h1, h2, h3 { color: var(--ink); font-weight: 700; }
h1 { margin: 0 0 1rem; font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem); line-height: 1.15; letter-spacing: -0.02em; }
h2 { margin: 2.4em 0 0.75em; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.015em; }
h3 { margin: 0 0 0.5rem; font-size: 1.05rem; line-height: 1.3; letter-spacing: -0.01em; }
.page h1 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.25rem); }
.lead { max-width: 44rem; margin: 0 0 1.5rem; color: var(--muted); font-size: 1.125rem; }
.eyebrow { margin: 0 0 0.6rem; color: var(--muted); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.note { color: var(--muted); font-size: 0.9rem; }
code { font-family: var(--mono); font-size: 0.9em; }
pre { overflow-x: auto; margin: 1rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: 0.6rem; background: var(--surface); line-height: 1.7; }
pre code { font-size: 0.9rem; }
ol, ul { padding-left: 1.25rem; }
li { margin: 0.2rem 0; }

/* Buttons: pills, teal for the main action, quiet for the others. */
button, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.55rem 1.3rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--accent-text); font: 600 0.95rem/1.2 var(--font); text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }
.btn--secondary, button.btn--secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn--small, button.btn--small { min-height: 36px; padding: 0.35rem 0.9rem; font-size: 0.85rem; }
button.danger { border-color: var(--danger); background: transparent; color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 0; }

/* Forms. */
form { display: grid; gap: 0.9rem; margin: 1rem 0; }
label { display: block; }
input[type="email"], textarea { display: block; width: 100%; margin-top: 0.4rem; padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-radius: 0.6rem; background: var(--page); color: var(--ink); font: inherit; }
input[type="email"]:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0 0.5rem 0 0; vertical-align: -0.15rem; accent-color: var(--accent); }
form button { justify-self: start; }
.code { display: inline-block; padding: 0.15rem 0.7rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 1.3rem; font-weight: 700; letter-spacing: 0.12em; }
.notice { margin: 1rem 0; padding: 0.8rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 0.6rem; background: var(--surface); color: var(--ink); }

/* Landing: hero, stats strip, step cards, two cards, and the dark band. */
.hero { padding: 1rem 0 0.5rem; }
.hero h1 { max-width: 36rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 2.5rem 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 0.2rem; padding: 1.25rem 1.25rem 1.25rem 0; }
.stat__value { color: var(--accent); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat__label { color: var(--muted); font-size: 0.9rem; }
.steps, .cards { display: grid; gap: 0.9rem; margin: 1rem 0 0; }
.steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 2.5rem; }
.step, .card, .panel { padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: 0.6rem; background: var(--page); }
.step p, .card p { margin: 0; }
.step__number { display: block; margin-bottom: 0.5rem; color: var(--accent); font-family: var(--mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.card { background: var(--surface); }
.band { margin: 3rem 0 0; padding: 2rem; border-radius: 0.8rem; background: var(--band-bg); color: var(--band-muted); }
.band h2 { margin-top: 0; color: var(--band-fg); }
.band a:not(.btn) { color: var(--band-fg); }
.band pre { border-color: #3F3F46; background: #09090B; color: var(--band-fg); }
.band .btn--secondary { border-color: var(--band-muted); background: transparent; color: var(--band-fg); }

/* Archive: one panel per section. */
.panel { margin: 1rem 0 0; }
.panel h2 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.panel form { margin-bottom: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.reports, .devices { margin: 0; padding: 0; list-style: none; }
.reports li, .devices li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin: 0; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.reports li:first-child, .devices li:first-child { border-top: 0; }
.devices form { display: block; margin: 0; }
.device__meta { display: block; color: var(--muted); font-size: 0.85rem; }
button.open-report { min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--accent); font-weight: 600; text-align: left; }
button.open-report::after { content: " \2192"; }

/* Narrow phones: a tighter header; below 22rem the mark alone stands for the name, which screen readers still get. */
@media (max-width: 26rem) {
  .site-header__inner, .site-footer__inner, main { padding-left: 1rem; padding-right: 1rem; }
  .site-header__inner { gap: 0.5rem; }
  .brand { gap: 0.5rem; font-size: 0.95rem; }
  .site-header .btn--small { padding: 0.35rem 0.75rem; }
}
@media (max-width: 22rem) {
  .brand__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Phones: stack the grids and lighten the band. */
@media (max-width: 45em) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat__value { font-size: 1.35rem; }
  .steps, .cards { grid-template-columns: 1fr; }
  .band { padding: 1.4rem 1rem; }
  pre { padding: 0.8rem; }
  pre code { font-size: 0.75rem; }
  main { padding-top: 1.75rem; }
}
