@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Serif";
  src: url("/assets/fonts/ibm-plex-serif-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/assets/fonts/ibm-plex-sans-condensed-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Terminus TTF";
  src: url("/assets/fonts/terminus-ttf-4.49.3.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Chicago";
  src: url("/assets/fonts/chicagoflf.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/assets/fonts/ibm-plex-sans-condensed-medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/assets/fonts/ibm-plex-sans-condensed-semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

/*
 * vladymir.info — base.
 *
 * Reset, document defaults, optical treatment, focus and selection.
 * Consumes semantic tokens only; no theme-specific literal values.
 */

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

html {
  background: var(--desktop-bg);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: linear-gradient(to bottom, var(--desktop-bg), var(--desktop-bg-alt));
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: var(--line-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/*
 * Responsive type scale.
 *
 * The 1536px golden reference is the baseline. Above it the type grows
 * smoothly with the viewport (clamped so 4K stays readable but not huge);
 * below it the minimums keep the original pixel sizes, so small screens
 * are unaffected.
 */
:root,
:root[data-theme] {
  --text-xxs: clamp(10px, 0.65vw, 14px);
  --text-xs: clamp(11px, 0.72vw, 16px);
  --text-sm: clamp(13px, 0.85vw, 19px);
  --text-md: clamp(15px, 0.98vw, 22px);
  --text-lg: clamp(19px, 1.24vw, 28px);
  --text-xl: clamp(23px, 1.5vw, 34px);
}

/* Plan 9 uses a slightly tighter display scale. */
:root[data-theme="plan9"] {
  --text-lg: clamp(18px, 1.17vw, 26px);
  --text-xl: clamp(22px, 1.43vw, 32px);
}

/* On very wide screens, give the bottom front panel more vertical room so
   the scaled-up workspace type does not truncate. */
@media (min-width: 1920px) {
  :root,
  :root[data-theme] {
    --front-panel-height: 92px;
  }
}

/* Optical treatment — vignette + scanlines, token-driven. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, var(--vignette-opacity)) 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  pointer-events: none;
  opacity: var(--scanline-opacity);
  background: repeating-linear-gradient(
    to bottom,
    var(--scanline-color) 0 1px,
    transparent 1px var(--scanline-size)
  );
}

/* Token-driven fine grain. Kept separate from scanlines so the two dark
   themes can have different optical depth without softening hard edges. */
.workstation::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147482999;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image:
    radial-gradient(circle at 18% 27%, var(--scanline-color) 0 .5px, transparent .8px),
    radial-gradient(circle at 71% 63%, var(--scanline-color) 0 .5px, transparent .8px);
  background-position: 0 0, 3px 5px;
  background-size: 7px 9px, 11px 13px;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

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

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--link-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* Scrollbars. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-muted) transparent;
}
*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}
*::-webkit-scrollbar-thumb {
  background: var(--border-muted);
}
*::-webkit-scrollbar-track {
  background: var(--surface-sunken);
}

/* Honor reduced motion: kill transitions/animations. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Visually hidden (screen-reader only). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
