/*
 * Ink Tools site (#371, #437): plain HTML and CSS, no client script, light only.
 * 1 Tokens, 2 Base, 3 Layout, 4 Components, 5 Site chrome, 6 Sections, 9 Responsive.
 */

/* 1 Tokens */
:root {
  color-scheme: light;
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --radius-m: 0.75rem;
  --radius-xl: 1.5rem;
  --radius-pill: 999px;
  /* The one width token (#439): the header, every section, every grid and all text share it through
     .container; no text carries a width cap of its own (#444). site_figures.py --check holds it. */
  --page-width: min(73.75rem, 100% - 2.5rem);
  /* The one exception (owner, on #444): the centered hero subtitle under the page title, .hero-summary. */
  --width-subtitle: 42rem;
  --control-height: 3rem;
  --glyph-tile: 3rem;
  /* One even padding for every card and install box (#443). */
  --box-padding: var(--space-m);
  --text-sm: 0.875rem;
  --text-md: 1.125rem;
  --text-xl: 1.75rem;
  --text-2xl: clamp(2.25rem, 5vw, 3.5rem);
  --duration-fast: 0.15s;
  --lift: -2px;
  --z-header: 10;
  --blur-m: 22px;
  --transition-interactive: transform var(--duration-fast) ease-out, box-shadow var(--duration-fast) ease-out,
    background-color var(--duration-fast) ease-out, border-color var(--duration-fast) ease-out, color var(--duration-fast) ease-out;

  /* Light only (owner, #437). Warm near-black ink on white and paper, after supernote.eu's palette. */
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #231916;
  --secondary: #5e5652;
  --line: #e7e2dc;
  --accent: #231916;
  --accent-hover: #4a3a35;
  --button-primary-fg: #ffffff;
  --button-primary-bg: #231916;
  --button-primary-bg-hover: #4a3a35;
  --shadow-button: 0 6px 18px color-mix(in srgb, var(--accent) 18%, transparent);
  --shadow-button-hover: 0 10px 24px color-mix(in srgb, var(--accent) 24%, transparent);
  /* Status badges: text and tint per README status, AA on their tint; the word is the cue. */
  --status-working-fg: #1d5b2c;
  --status-working-bg: #e3f1e6;
  --status-beta-fg: #774800;
  --status-beta-bg: #fbefd6;
  --status-in-progress-fg: #1f4c7a;
  --status-in-progress-bg: #e2ecf7;
  --status-planned-fg: #4a4442;
  --status-planned-bg: #eeeceb;
  --status-internal-fg: #5a2f7a;
  --status-internal-bg: #efe7f5;
  --status-broken-fg: #8a1f14;
  --status-broken-bg: #f9e2df;
  --accent-tint: color-mix(in srgb, var(--accent) 12%, transparent);
}

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

/* The scrollbar's space is always reserved, so a short page and a long page keep one content left
   edge (martonpaulo/workbench#2124, #443); a browser without scrollbar-gutter always shows the bar.
   site_figures.py --check holds it. */
html {
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html {
    overflow-y: scroll;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-hover);
}

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

/* External links: the arrow is drawn here once, never in the markup. Its own inline-block box keeps
   the link's underline off it, at rest and on hover (#456); site_figures.py --check holds it. */
a[href^="http"]:not(.button)::after {
  content: "\2009\2197";
  display: inline-block;
  text-decoration: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -100%;
  z-index: calc(var(--z-header) + 1);
  padding: var(--space-2xs) var(--space-s);
  background: var(--surface);
  border-radius: var(--radius-m);
}

.skip-link:focus {
  top: var(--space-2xs);
}

/* 3 Layout */
.container {
  width: var(--page-width);
  margin-inline: auto;
}

main {
  flex: 1 0 auto;
}

/* 4 Components */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: var(--space-2xs) var(--space-m);
  border-radius: var(--radius-pill);
  text-align: center;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-interactive);
}

.button.primary {
  background: var(--button-primary-bg);
  color: var(--button-primary-fg);
  box-shadow: var(--shadow-button);
}

.button.primary:hover {
  background: var(--button-primary-bg-hover);
  color: var(--button-primary-fg);
}

.button:active {
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    transform: translateY(var(--lift));
  }

  .button.primary:hover {
    box-shadow: var(--shadow-button-hover);
  }
}

.button.secondary {
  border: 1px solid var(--text);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface);
  color: var(--text);
}

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

.eyebrow {
  margin: 0 0 var(--space-xs);
  color: var(--secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

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

.status-working { color: var(--status-working-fg); background: var(--status-working-bg); }
.status-beta { color: var(--status-beta-fg); background: var(--status-beta-bg); }
.status-in-progress { color: var(--status-in-progress-fg); background: var(--status-in-progress-bg); }
.status-planned { color: var(--status-planned-fg); background: var(--status-planned-bg); }
.status-internal { color: var(--status-internal-fg); background: var(--status-internal-bg); }
.status-broken { color: var(--status-broken-fg); background: var(--status-broken-bg); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-s);
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--box-padding);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-xs);
  margin: 0 0 var(--space-s);
}

.card-head img {
  flex: none;
}

.card-head .badge {
  margin-left: auto;
}

.card h3 {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-md);
}

.kind {
  color: var(--secondary);
  font-size: var(--text-sm);
}

.features {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--secondary);
}

.features li + li {
  margin-top: var(--space-3xs);
}

.features strong {
  color: var(--text);
  font-weight: 600;
}

.download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-s);
  margin: auto 0 0;
  padding-top: var(--space-m);
}

.version {
  color: var(--secondary);
  font-size: var(--text-sm);
}

.install {
  padding: var(--box-padding);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.install:first-child {
  grid-column: 1 / -1;
}

.install h3 {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-md);
}

.install p {
  margin: 0 0 var(--space-xs);
  color: var(--secondary);
}

.steps {
  margin: 0;
  padding-left: 1.4rem;
}

.steps li + li {
  margin-top: var(--space-2xs);
}

/* One list, one credit per row, so every row starts at the same edge (#443). */
.credits {
  margin: 0 0 var(--space-m);
  padding-left: 1.1rem;
}

.credits li + li {
  margin-top: var(--space-2xs);
}

/* A tool's picture or video (#414): written by scripts/site_media.py inside its card. */
.shot {
  margin: var(--space-m) 0 0;
}

.shot img,
.shot video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg);
}

.shot figcaption {
  margin-top: var(--space-2xs);
  color: var(--secondary);
  font-size: var(--text-sm);
}

.notice {
  padding: var(--space-m);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.breadcrumb ol {
  display: flex;
  gap: var(--space-2xs);
  margin: 0 0 var(--space-s);
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
}

.breadcrumb li {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb li + li::before {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-right: var(--space-2xs);
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateY(-0.1em) rotate(45deg);
}

.breadcrumb a {
  color: var(--secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* 5 Site chrome */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(var(--blur-m)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur-m)) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.site-header nav ul {
  display: flex;
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  color: var(--secondary);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--text);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: var(--text-sm);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-s);
  padding-block: var(--space-l);
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--secondary);
}

.site-footer a:hover {
  color: var(--accent);
}

/* 6 Sections */
.hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
}

.hero h1 {
  margin: 0 auto var(--space-s);
  font-size: var(--text-2xl);
}

.hero-summary {
  max-width: var(--width-subtitle);
  margin: 0 auto var(--space-l);
  color: var(--secondary);
  font-size: var(--text-md);
}

/* The downloads and stars line (#443), quiet, as on windowhop.martonpaulo.com. */
.hero-stats {
  margin: var(--space-m) 0 0;
  font-size: var(--text-sm);
}

.hero-stats a {
  color: var(--secondary);
  text-decoration: none;
}

.hero-stats a:hover {
  color: var(--text);
  text-decoration: underline;
}

.section {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 var(--space-m);
  font-size: var(--text-xl);
}


.section .lead {
  margin: calc(-1 * var(--space-xs)) 0 var(--space-m);
  color: var(--secondary);
  font-size: var(--text-md);
}

.page {
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.page h1 {
  margin: 0 0 var(--space-s);
  font-size: var(--text-2xl);
}

.page h2 {
  margin: var(--space-xl) 0 var(--space-xs);
  font-size: var(--text-xl);
}

.page h3 {
  margin: var(--space-m) 0 var(--space-2xs);
}


.page .lead {
  color: var(--secondary);
  font-size: var(--text-md);
}

/* 9 Responsive. Breakpoints: 1024, 820, 640 and 520 px. */
/* A last card alone on its row spans the row; site_figures.py marks it per column count (#443). */
@media (min-width: 1025px) {
  .grid-3 > .lone-3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 > .lone-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  :root {
    --page-width: calc(100% - 2rem);
  }

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

  .hero {
    padding: var(--space-2xl) 0 var(--space-xl);
  }

  .site-header .container {
    justify-content: center;
    padding-block: var(--space-2xs);
  }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .button:hover {
    transform: none;
    transition: none;
  }
}
