/* OpenField Finance — global tokens, reset, base typography */

:root {
  --color-bg: #0f172a;
  --color-bg-deep: #0b1120;
  --color-surface: #16213a;
  --color-surface-raised: #1e2b47;
  --color-text: #f8fafc;
  --color-text-muted: #cbd5e1;
  --color-text-subtle: #94a3b8;
  --color-primary: #38bdf8;
  --color-primary-hover: #7dd3fc;
  --color-primary-active: #0ea5e9;
  --color-primary-dark-text: #082f49;
  --color-success: #22c55e;
  --color-warning: #facc15;
  --color-danger: #f87171;
  --color-border: rgba(255, 255, 255, 0.12);

  /* Brand type (see assets/brand/BRAND-README.md) */
  --font-heading: "Bricolage Grotesque", Georgia, serif;      /* wordmark, headlines (700) */
  --font-ui: "Sora", system-ui, sans-serif;                    /* eyebrows, UI labels (600) */
  --font-body: "Public Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;       /* figures, specs */
  --color-cyan-ink: #0284c7;   /* cyan text on LIGHT surfaces only (AA); on navy use --color-primary */

  --container-max: 1100px;
  --reading-max: 760px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 30px rgba(2, 6, 23, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--color-text);
  overflow-wrap: break-word;
}

h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: clamp(1.1rem, 2.2vw, 1.3rem); }

p, li {
  color: var(--color-text-muted);
}

p { margin: 0 0 1em; }

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

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

strong { color: var(--color-text); }

ul, ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}

li { margin-bottom: 0.35em; }

img, svg, iframe { max-width: 100%; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.6em 0.75em;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: top;
}

th {
  color: var(--color-text);
  background: rgba(56, 189, 248, 0.08);
  font-family: var(--font-heading);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  margin: 1em 0;
}

textarea, input[type="text"], input[type="number"] {
  width: 100%;
  max-width: 100%;
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.6em 0.75em;
  margin: 0.35em 0 0.9em;
}

textarea { min-height: 86px; resize: vertical; }

input[type="radio"], input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 1.05em;
  height: 1.05em;
  margin-right: 0.5em;
}

details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.55em 0.9em;
  margin: 0.6em 0;
  background: rgba(11, 17, 32, 0.4);
}

details summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  padding: 0.15em 0;
}

details[open] summary { margin-bottom: 0.5em; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.6em 0;
}

blockquote {
  margin: 1em 0;
  padding: 0.6em 1em;
  border-left: 3px solid var(--color-primary);
  background: rgba(56, 189, 248, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Layout helpers */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 18px;
}

.reading {
  max-width: var(--reading-max);
  margin-left: auto;
  margin-right: auto;
}

main { display: block; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--color-primary);
  color: var(--color-primary-dark-text);
  font-weight: 700;
  padding: 0.7em 1.2em;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.skip-link:focus {
  left: 12px;
}

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion */
@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;
  }
}

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