/*
 * Hobfolk — sistema visual "escritório pixel art" (docs/design/sistema-pixel.md).
 *
 * The window is a piece of the office: every panel is a pixel window (square corners, 2px lines,
 * a light bevel and a hard shadow that never blurs), the type is pixel type, and color comes from
 * the office at night — navy walls, warm wood, monitor cyan and lamp gold. No gradients, no glass,
 * no rounded corners: depth is bevel + offset shadow, emphasis is a solid 2px ring.
 *
 * Loaded first: every other sheet reads these tokens.
 */

/* ------------------------------------------------------------------ type (OFL, bundled: the CSP only allows 'self') */

/* Inter: the reading face. A clean grotesk with a tall x-height and open shapes, so long text,
   paths and small UI stay legible on the dark panels; the pixel look stays in titles and labels.
   The face range stops at 700: heavier requests from the sheets clamp to it. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
  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: 'Inter';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Jersey 15: the display face for titles and big numbers (one heavy weight). */
@font-face {
  font-family: 'Jersey 15';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  size-adjust: 112%;
  src: url('fonts/jersey-15-latin-400-normal.woff2') format('woff2');
  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: 'Jersey 15';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  size-adjust: 112%;
  src: url('fonts/jersey-15-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/silkscreen-latin-400-normal.woff2') format('woff2');
  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: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/silkscreen-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url('fonts/silkscreen-latin-700-normal.woff2') format('woff2');
  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: 'Silkscreen';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url('fonts/silkscreen-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono: code, paths and the terminal, with distinct 0/O and 1/l/I. */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  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: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: dark;

  /* Palette: the office at night. Surfaces step up from the floor to the lamp. */
  --ink: #06070d; /* outlines and the hard shadow */
  --shadow-ink: rgba(3, 4, 10, 0.92);
  --bg: #0b0d19; /* the dark around the office */
  --panel-2: #10132a; /* recessed: wells, tracks, inputs */
  --panel: #151935; /* a window */
  --raised: #1d2246; /* a button, a card on a window */
  --raised-hover: #262c58;
  --border: #2a3160; /* the window line */
  --border-2: #3c4580; /* a line that should be seen */
  --text: #f1ead8; /* paper white, a little warm like the lamps */
  --muted: #b8bddf; /* ≥ 7:1 on every surface */
  --faint: #8f96c4; /* ≥ 4.5:1 (WCAG AA) on every surface */

  /* Office colors (same hues the canvas paints with). */
  --accent: #22d3ee; /* monitor cyan: the action, the focus */
  --accent-soft: rgba(34, 211, 238, 0.14);
  --accent-border: rgba(34, 211, 238, 0.55);
  --on-accent: #04121a;
  --gold: #fbbf24; /* lamp gold: level, XP, what needs you */
  --on-gold: #1f1300;
  --amber: #f59e0b;
  --orange: #f97316;
  --teal: #2dd4bf;
  --green: #4ade80;
  --red: #f87171;
  --violet: #a78bfa;
  --pink: #f472b6;
  --wood: #b07445; /* the office floor */
  --wood-dark: #7a4b2a;
  --wood-light: #d49a63;
  --scrim: rgba(4, 5, 12, 0.8);

  /* Pixel geometry. */
  --px: 2px; /* one art pixel of the window chrome */
  --bw: 2px; /* every line */
  --radius: 0;
  --hi: rgba(255, 255, 255, 0.07); /* bevel light (top-left) */
  --lo: rgba(0, 0, 0, 0.38); /* bevel shade (bottom-right) */
  --bevel: inset var(--px) var(--px) 0 var(--hi), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo);
  --bevel-in: inset var(--px) var(--px) 0 var(--lo), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--hi);
  --shadow-1: 2px 2px 0 var(--shadow-ink);
  --shadow-2: 4px 4px 0 var(--shadow-ink);
  --shadow-3: 6px 6px 0 var(--shadow-ink);
  --ring: 0 0 0 var(--bw) var(--accent);
  /* Texture instead of gradients: 2×2 dither and 45° hatch, both on the pixel grid. */
  --dither: repeating-conic-gradient(rgba(255, 255, 255, 0.035) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
  --dither-dark: repeating-conic-gradient(rgba(0, 0, 0, 0.22) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
  --hatch: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 6px);

  /* Type. Inter for reading, Jersey 15 for titles, Silkscreen for labels and tags, JetBrains Mono for code. */
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Jersey 15', 'Inter', system-ui, sans-serif;
  --font-label: 'Silkscreen', 'Inter', monospace;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --fs-3xs: 8px; /* Silkscreen's native size */
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 16px; /* Silkscreen ×2 */
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;
  --lh-tight: 1.15;
  --lh: 1.45;

  /* Motion: things snap between frames like sprites. */
  --steps: steps(3, end);
  --dur-fast: 90ms;
  --dur: 140ms;
}

/* ------------------------------------------------------------------ base */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-synthesis: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
  border-radius: 0;
}

/*
 * Checkboxes: a sunken pixel well that lights up cyan with a pixel tick, in the window and in the
 * account pages (which load this sheet too). `:where` keeps it at zero specificity, so a component
 * that hides its box behind a drawing of its own (the automations switch) still wins.
 */
:where(input[type='checkbox']) {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  vertical-align: -4px;
  background: var(--panel-2) no-repeat center / 14px 14px;
  border: var(--bw) solid var(--border-2);
  box-shadow: var(--bevel-in);
  cursor: pointer;
}
:where(input[type='checkbox']):hover:not(:disabled) {
  border-color: var(--accent);
}
:where(input[type='checkbox']):checked,
:where(input[type='checkbox']):indeterminate {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%2304121a' d='M5 1h1v1H5zM4 2h2v1H4zM1 3h1v1H1zM3 3h2v1H3zM1 4h3v1H1zM2 5h1v1H2z'/%3E%3C/svg%3E");
  box-shadow: var(--bevel);
}
:where(input[type='checkbox']):indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%2304121a' d='M1 3h5v1H1z'/%3E%3C/svg%3E");
}
:where(input[type='checkbox']):disabled {
  cursor: default;
  opacity: 0.45;
}

code,
kbd,
samp,
pre {
  font-family: var(--mono);
}

canvas,
img,
.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: var(--bw) solid var(--accent);
  outline-offset: var(--bw);
}

/* Scrollbars: a square thumb in a dark track, like an old window. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 2px solid var(--bg);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* ------------------------------------------------------------------ motion primitives */

/* A busy frame: the line trades colors in steps, like a marquee. */
@keyframes pixel-march {
  0%,
  100% {
    border-color: var(--accent);
  }
  50% {
    border-color: var(--teal);
  }
}

/* Loading placeholders blink instead of shimmering. */
@keyframes pixel-blink {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.45;
  }
}
