/* Shared styles for the small tools (calculator, graph calculator, contrast checker).
   Same colours and type as the main site. These pages are plain static files, so fonts load from /fonts. */

@font-face {
  font-family: "Anybody Variable";
  src: url("/fonts/anybody-latin-wdth-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --cobalt: #2b35ff;
  --grape: #8438ff;
  --sun: #ffd426;
  --ink: #100a3a;
  --mist: #f7f5ff;

  --display: "Anybody Variable", "Arial Narrow", system-ui, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --gut: clamp(1rem, 2.4vw, 2.25rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --page-bg: var(--ink);
  --page-fg: var(--mist);
  --focus: var(--sun);
}

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

body {
  margin: 0; min-height: 100svh;
  background: var(--page-bg); color: var(--page-fg);
  font-family: var(--serif); font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem); line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
body[data-theme="cobalt"] { --page-bg: var(--cobalt); --page-fg: var(--mist); }
body[data-theme="grape"] { --page-bg: var(--grape); --page-fg: #fff; }
body[data-theme="sun"] { --page-bg: var(--sun); --page-fg: var(--ink); --focus: var(--ink); }
body[data-theme="ink"] { --page-bg: var(--ink); --page-fg: var(--mist); }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.ui {
  font-family: var(--display);
  font-variation-settings: "wdth" 100, "wght" 560;
  font-size: 0.9rem; letter-spacing: 0.01em; line-height: 1.25;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 1rem; top: -5rem; z-index: 50;
  padding: 0.7rem 1.1rem; border-radius: 999px; background: var(--sun); color: var(--ink); text-decoration: none;
}
.skip:focus { top: 1rem; }

/* Top bar */
.lab-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem var(--gut); }
.lab-back { display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0; text-decoration: none; }
.lab-back::before {
  content: ""; width: 0.6rem; height: 0.6rem; margin-right: 0.1rem;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.lab-back:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.lab-name { opacity: 0.85; }

.lab-main { padding: 0 var(--gut) 3rem; }
.lab-title {
  font-family: var(--display); font-variation-settings: "wdth" 108, "wght" 780;
  font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 0.95; letter-spacing: -0.035em;
}
.lab-lead { max-width: 32rem; margin-top: 0.9rem; }
.lab-heading {
  font-family: var(--display); font-variation-settings: "wdth" 100, "wght" 700;
  font-size: 1.05rem; letter-spacing: 0; margin-bottom: 0.7rem;
}

/* Buttons and chips, same shapes as the main site: interactive things are pills */
.btn, .chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border-radius: 999px; border: 2px solid currentColor; text-decoration: none; white-space: nowrap;
  font-family: var(--display); font-variation-settings: "wdth" 105, "wght" 620;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.15s;
}
.btn { padding: 0.7rem 1.3rem; font-size: 0.95rem; }
.chip { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn:hover, .chip:hover { background: var(--page-fg); color: var(--page-bg); border-color: var(--page-fg); }
.btn:active, .chip:active { transform: scale(0.96); }

noscript p { padding: 2rem var(--gut); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
