/*
 * design.css — Smart As Apps design system
 *
 * Ported from farmerville/src/styles/tokens.css + global.css.
 * Tokens are unchanged. Font paths updated to /static/fonts/.
 * DO NOT hardcode values in component CSS — use the custom properties below.
 */

/* ============================================================
 * Design tokens (from tokens.css)
 * ============================================================ */

:root {
  /* Color — restrained palette, brand blue as sole accent */
  --color-primary: #0086c9;
  --color-primary-hover: #006da3;
  --color-primary-light: rgba(0, 134, 201, 0.06);

  --color-text: #1a1a1a;
  --color-muted: #6b7280;
  --color-background: #fafaf8;
  --color-surface: #ffffff;
  --color-border: #e8e8e5;

  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #0086c9;

  /* Typography */
  --font-display: "General Sans", system-ui, -apple-system, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Typography scale (from DESIGN.md): 12/13/14/15/16/17/18/20/24/28/32/48/52/64 */
  --text-12: 0.75rem;
  --text-13: 0.8125rem;
  --text-14: 0.875rem;
  --text-15: 0.9375rem;
  --text-16: 1rem;
  --text-17: 1.0625rem;
  --text-18: 1.125rem;
  --text-20: 1.25rem;
  --text-24: 1.5rem;
  --text-28: 1.75rem;
  --text-32: 2rem;
  --text-48: 3rem;
  --text-52: 3.25rem;
  --text-64: 4rem;

  /* Spacing — 8px base, scale: 4/8/16/24/32/48/64/72/80/100 */
  --space-4: 0.25rem;
  --space-8: 0.5rem;
  --space-16: 1rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-48: 3rem;
  --space-64: 4rem;
  --space-72: 4.5rem;
  --space-80: 5rem;
  --space-100: 6.25rem;

  /* Layout */
  --content-max-width: 1100px;

  /* Border radius */
  --radius-sm: 6px;   /* buttons, inputs — NOT pill */
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Motion */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --duration-micro: 100ms;
  --duration-short: 200ms;
  --duration-medium: 300ms;

  /* Breakpoints — documented; used via media queries */
  /* 375px mobile, 768px tablet, 1024px desktop, 1440px ultrawide */
}

/* Dark mode tokens — DESIGN.md prefers-color-scheme variant. NOT applied in v1.
 * Keeping token definitions here for v1.1 activation without token migration. */
@media (prefers-color-scheme: dark) {
  /* v1 is light-mode only. Uncomment in v1.1 to activate.
  :root {
    --color-background: #0F1115;
    --color-surface: #1A1D23;
    --color-border: #2D3139;
    --color-text: #E8E8E5;
    --color-muted: #9CA3AF;
  }
  */
}

/* ============================================================
 * Font faces — self-hosted WOFF2, no external CDN (DSGVO)
 * Paths: /static/fonts/ (served by FastAPI StaticFiles mount)
 * ============================================================ */

@font-face {
  font-family: "General Sans";
  src: url("/static/fonts/GeneralSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
 * Reset — minimal, tasteful (from global.css)
 * ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-16);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text);
}

p {
  line-height: 1.6;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--duration-short) var(--ease-out);
}

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

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

/* Focus styles — 2px solid brand blue, 2px offset */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link — first focusable element, visible on focus */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-16);
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-weight: 500;
  z-index: 100;
  transition: top var(--duration-short) var(--ease-out);
  text-decoration: none;
}

.skip-link:focus-visible {
  top: var(--space-16);
}

/* Accessible screen-reader-only utility */
.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;
}
