/* Werkstatt 76 team tools: the shared base of email., plans. and board. (team/kit).
   The same kraft-paper workshop as werkstatt-76.de (src/styles/global.css, [data-theme="falz"]):
   every colour sampled from public/team/team.jpg; wall, writing paper, kraft, black paper, and
   one green that only ever fills an action. Space Grotesk is the studio voice; D-DIN sets the
   paperwork (labels, dates, figures). Self-hosted only: the CSP admits 'self' and nothing else.
   Contrast (WCAG AA, measured): ink on wall 11.46, on paper 13.03; muted on paper 6.25, on
   wall 5.50; on-dark on green 5.10, on black 13.14; ink on kraft-light 7.58; error 5.44. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/SpaceGrotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  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: "Space Grotesk";
  src: url("/static/fonts/SpaceGrotesk-ext-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
  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;
}
/* D-DIN (Datto, SIL OFL 1.1: static/fonts/d-din/OFL-1.1.txt) */
@font-face { font-family: "D-DIN"; src: url("/static/fonts/d-din/D-DIN.woff2") format("woff2");
             font-weight: 400; font-display: swap; }
@font-face { font-family: "D-DIN"; src: url("/static/fonts/d-din/D-DIN-Bold.woff2") format("woff2");
             font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --wall: #E0D8CD;
  --sheet: #ECE6DC;
  --floor: #D5CEC2;
  --kraft-light: #C9AD8C;
  --kraft: #AA825A;
  --kraft-deep: #6E5340;
  --black: #24201C;
  --green: #356B47;
  --green-deep: #2B5839;
  --on-dark: #EDE7DC;
  --on-dark-soft: #B5AC9F;
  --ink: var(--black);
  --muted: #5A5148;
  --rule: #BDB2A3;
  --error: #9A3F22;
  --hover: rgba(36, 32, 28, 0.06);
  --pencil: url("/static/strokes/pencil-h.svg");
  --pencil-light: url("/static/strokes/pencil-light-h.svg");
  --pencil-v: url("/static/strokes/pencil-v.svg");
  --pen: url("/static/strokes/pen-h.svg");
  --lift: 0 18px 40px -18px rgba(54, 40, 26, 0.35), 0 2px 6px rgba(54, 40, 26, 0.12);
  /* Roles the dark theme redefines. */
  --solid: var(--black);            /* a filled, inverted surface: selected chip, notice */
  --on-solid: var(--on-dark);
  --focus: var(--green);            /* focus rings and the flag: green as a UI colour */
  --select-bg: var(--kraft-light);
  --select-fg: var(--black);
  --stroke-filter: none;            /* the pencil/pen strokes are dark ink SVGs */
  --mark-filter: none;              /* the ink w76 mark */

  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-form: "D-DIN", "DIN Alternate", "Arial Narrow", Arial, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: 2rem;

  --rail: 232px;
  --list: 384px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
}

/* ---- dark: the same workshop at night --------------------------------------------------
   Black paper instead of the wall and writing paper, text in the paper colour, kraft for
   the open conversation, green still only for actions (#8DBE9C as a focus/flag colour so it
   holds 3:1 on black). Strokes and the mark are inverted so they read on dark.
   Measured (AA): ink on wall 14.50, on sheet 13.14; muted on sheet 7.21; ink on the open
   kraft 8.30, muted 4.56; error 7.78; focus 7.68.
   Chosen theme: data-theme on <html> (static/js/theme.js sets it before paint, w76kit/theme.py
   toggles it); without a choice the system preference decides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
    --wall: #1A1714;
    --sheet: #24201C;
    --floor: #2E2924;
    --kraft-light: #4E3E30;
    --kraft-deep: #C9AD8C;
    --ink: #EDE7DC;
    --muted: #B5AC9F;
    --rule: #4A433B;
    --error: #F0A08A;
    --hover: rgba(237, 231, 220, 0.07);
    --lift: 0 18px 40px -18px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.35);
    --solid: #EDE7DC;
    --on-solid: #1A1714;
    --focus: #8DBE9C;
    --select-bg: #4E3E30;
    --select-fg: #EDE7DC;
    --stroke-filter: invert(0.88);
    --mark-filter: invert(0.92);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --wall: #1A1714;
  --sheet: #24201C;
  --floor: #2E2924;
  --kraft-light: #4E3E30;
  --kraft-deep: #C9AD8C;
  --ink: #EDE7DC;
  --muted: #B5AC9F;
  --rule: #4A433B;
  --error: #F0A08A;
  --hover: rgba(237, 231, 220, 0.07);
  --lift: 0 18px 40px -18px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.35);
  --solid: #EDE7DC;
  --on-solid: #1A1714;
  --focus: #8DBE9C;
  --select-bg: #4E3E30;
  --select-fg: #EDE7DC;
  --stroke-filter: invert(0.88);
  --mark-filter: invert(0.92);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--wall); }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  caret-color: var(--green);
  scrollbar-color: var(--kraft) var(--floor);
}
::selection { background: var(--select-bg); color: var(--select-fg); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { -webkit-tap-highlight-color: transparent; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.grow { flex: 1; }
.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.icon svg { width: 100%; height: 100%; }
#app, .app { height: 100%; }
/* The page's true visible height: on iOS 100% is the tall viewport, so a bottom bar or the
   composer's Send would sit under Safari's toolbar. dvh follows the toolbar. */
.shell, .login { height: 100%; height: 100dvh; }

/* A hand-drawn rule: put it on any ::after that should separate. */
.stroke-under { position: relative; }
.stroke-under::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter); pointer-events: none;
}

/* ---- splash (static, in index.html, before Python is up) ---------------------------- */
.splash {
  height: 100%; display: grid; place-content: center; justify-items: center; gap: 22px;
}
.splash-dots { display: flex; gap: 6px; }
.splash-dots span {
  width: 6px; height: 6px; background: var(--kraft);
  animation: pulse 1.2s var(--ease) infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ---- brand -------------------------------------------------------------------------- */
.lockup { display: inline-flex; align-items: center; gap: calc(var(--mark) * 0.36); }
.mark { width: var(--mark); height: var(--mark); flex: none; display: block; filter: var(--mark-filter); }
.lockup-word {
  font-weight: 700; font-size: calc(var(--mark) * 0.62); letter-spacing: -0.03em;
  line-height: 0.9; white-space: nowrap;
}

/* ---- buttons ------------------------------------------------------------------------ */
/* Paper has corners, not radii. The primary action is the one green thing on screen,
   with a folded corner like the site's dog-eared sheets. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 0;
  background: transparent; font-weight: 600; color: var(--ink);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary {
  background: var(--green); border-color: var(--green); color: var(--on-dark);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.btn-primary:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-ghost {
  border-color: transparent; padding: 0 6px; text-decoration: underline;
  text-underline-offset: 5px; text-decoration-thickness: 1.5px; text-decoration-color: var(--kraft);
}
.btn-ghost:hover { background: transparent; text-decoration-color: var(--ink); }
.btn-wide { width: 100%; }
.btn-small { min-height: 32px; padding: 0 10px; font-size: var(--step--1); }
.btn-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 0; background: transparent; color: var(--ink);
  font-size: 1.15rem;
}
.btn-icon:hover { background: var(--hover); }
.btn-icon.is-on { color: var(--focus); }
.btn-icon.btn-small { width: 30px; height: 30px; font-size: 0.95rem; }
.only-narrow { display: none; }
.theme-icon { display: inline-flex; }
.login-theme { position: fixed; top: 12px; right: 12px; }

/* ---- sign in: a form on a sheet of writing paper ------------------------------------- */
.login {
  min-height: 100%; display: grid; place-content: center; gap: 18px; padding: 24px 16px;
  overflow-y: auto; height: 100%;
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 36px 32px 32px; background: var(--sheet); box-shadow: var(--lift);
}
.login-title {
  margin: 30px 0 6px; font-size: var(--step-3); font-weight: 700; letter-spacing: -0.035em;
  line-height: 1.05;
}
.login-lede { margin: 0 0 26px; color: var(--muted); }
.login-form { display: grid; gap: 6px; }
.field-label {
  margin-top: 10px; font-family: var(--font-form); font-size: 0.875rem; font-weight: 700;
  letter-spacing: 0.02em;
}
/* Fields are printed boxes: crisp ink edges, like the contact form on the site. */
.field-input, .search-input, .compose-input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--ink);
  border-radius: 0; background: transparent;
}
.field-input:focus, .compose-input:focus, .search-input:focus, .compose-body:focus {
  outline: 2px solid var(--focus); outline-offset: 1px;
}
.login-form .btn-wide { margin-top: 20px; min-height: 46px; }
.login-error { margin: 8px 0 0; color: var(--error); font-size: var(--step--1); font-weight: 600; }


/* ---- touch: fingers, not a pointer ---------------------------------------------------
   16 px in every field, or iOS Safari zooms the page when one is tapped; 44 px tap targets;
   a pressed state in place of the grey tap flash. */
@media (pointer: coarse) {
  .field-input, select.field-input, textarea.field-input { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-icon { width: 44px; height: 44px; }
  .btn-icon.btn-small { width: 40px; height: 40px; }
  .btn-small { min-width: 44px; }
  .btn:active, .btn-icon:active { background: var(--hover); }
  .btn-primary:active { background: var(--green-deep); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
