/* Thrice Theta base stylesheet. Requires tokens.css and fonts.css. Hand-written; keep it small. */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--tt-font-sans);
  font-size: var(--tt-text-md);
  line-height: var(--tt-text-leading);
  color: var(--tt-color-text);
  background: var(--tt-color-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: var(--tt-text-leading-tight); font-weight: var(--tt-weight-semibold); margin: 0 0 var(--tt-space-3); }
h1 { font-size: var(--tt-text-3xl); letter-spacing: -0.01em; }
h2 { font-size: var(--tt-text-2xl); margin-top: var(--tt-space-8); }
h3 { font-size: var(--tt-text-xl); margin-top: var(--tt-space-6); }
h4 { font-size: var(--tt-text-lg); }
p, ul, ol, pre, table, blockquote { margin: 0 0 var(--tt-space-4); }
a { color: var(--tt-color-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--tt-color-accent-hover); }
small, .tt-muted { color: var(--tt-color-text-muted); font-size: var(--tt-text-sm); }
hr { border: 0; border-top: 1px solid var(--tt-color-border); margin: var(--tt-space-8) 0; }
code, kbd, pre { font-family: var(--tt-font-mono); font-size: 0.925em; }
code { background: var(--tt-color-surface); padding: 0.1em 0.35em; border-radius: var(--tt-radius-sm); }
pre { background: var(--tt-color-surface); padding: var(--tt-space-4); border-radius: var(--tt-radius-md); overflow-x: auto; }
pre code { background: none; padding: 0; }
blockquote { border-left: 3px solid var(--tt-color-accent); padding-left: var(--tt-space-4); color: var(--tt-color-text-muted); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: var(--tt-space-2) var(--tt-space-3); border-bottom: 1px solid var(--tt-color-border); }
th { font-weight: var(--tt-weight-semibold); }
:focus-visible { outline: 2px solid var(--tt-color-focus); outline-offset: 2px; }

/* Layout */
.tt-container { width: 100%; max-width: var(--tt-layout-content); margin-inline: auto; padding-inline: var(--tt-space-4); }
.tt-container--wide { max-width: var(--tt-layout-wide); }
.tt-stack > * + * { margin-top: var(--tt-space-4); }
.tt-cluster { display: flex; flex-wrap: wrap; gap: var(--tt-space-3); align-items: center; }
.tt-grid { display: grid; gap: var(--tt-space-6); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Surfaces */
.tt-card {
  background: var(--tt-color-surface-raised);
  border: 1px solid var(--tt-color-border);
  border-radius: var(--tt-radius-lg);
  padding: var(--tt-space-6);
  box-shadow: var(--tt-shadow-sm);
}
.tt-notice {
  border: 1px solid var(--tt-color-border);
  border-left-width: 4px;
  border-radius: var(--tt-radius-md);
  padding: var(--tt-space-3) var(--tt-space-4);
  background: var(--tt-color-surface);
}
.tt-notice--info { border-left-color: var(--tt-color-accent); }
.tt-notice--success { border-left-color: var(--tt-color-success); }
.tt-notice--warning { border-left-color: var(--tt-color-warning); }
.tt-notice--danger { border-left-color: var(--tt-color-danger); }

/* Buttons */
.tt-btn, button.tt-btn, input[type="submit"].tt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tt-space-2);
  font: inherit; font-weight: var(--tt-weight-semibold); font-size: var(--tt-text-sm);
  padding: 0.6rem 1.1rem; border-radius: var(--tt-radius-md); border: 1px solid transparent;
  background: var(--tt-color-accent); color: var(--tt-color-on-accent);
  text-decoration: none; cursor: pointer; line-height: 1.2;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.tt-btn:hover { background: var(--tt-color-accent-hover); color: var(--tt-color-on-accent); }
.tt-btn--secondary { background: transparent; color: var(--tt-color-text); border-color: var(--tt-color-border); }
.tt-btn--secondary:hover { background: var(--tt-color-surface); color: var(--tt-color-text); }
.tt-btn--danger { background: var(--tt-color-danger); }
.tt-btn--danger:hover { filter: brightness(0.9); background: var(--tt-color-danger); }
.tt-btn:disabled, .tt-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Forms */
label { display: block; font-weight: var(--tt-weight-medium); font-size: var(--tt-text-sm); margin-bottom: var(--tt-space-1); }
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), select, textarea {
  width: 100%; font: inherit; color: var(--tt-color-text); background: var(--tt-color-bg);
  border: 1px solid var(--tt-color-border); border-radius: var(--tt-radius-md);
  padding: 0.55rem 0.75rem; margin-bottom: var(--tt-space-4);
}
input:focus, select:focus, textarea:focus { border-color: var(--tt-color-accent); outline: 2px solid var(--tt-color-focus); outline-offset: 0; }
.tt-field-error { color: var(--tt-color-danger); font-size: var(--tt-text-sm); margin-top: calc(-1 * var(--tt-space-3)); margin-bottom: var(--tt-space-4); }
.tt-checkbox { display: flex; gap: var(--tt-space-2); align-items: flex-start; font-weight: var(--tt-weight-normal); }
.tt-checkbox input { margin-top: 0.3em; }

/* Site chrome */
.tt-header { border-bottom: 1px solid var(--tt-color-border); background: var(--tt-color-bg); }
.tt-header__inner { display: flex; align-items: center; gap: var(--tt-space-4); min-height: 64px; }
.tt-header__inner .tt-nav { margin-left: auto; }
.tt-brand { display: inline-flex; align-items: center; gap: var(--tt-space-2); font-weight: var(--tt-weight-bold); color: var(--tt-color-text); text-decoration: none; }
.tt-brand svg { width: 28px; height: 28px; }
.tt-nav { display: flex; flex-wrap: wrap; gap: var(--tt-space-4); font-size: var(--tt-text-sm); }
.tt-nav a { color: var(--tt-color-text-muted); text-decoration: none; }
.tt-nav a:hover, .tt-nav a[aria-current="page"] { color: var(--tt-color-text); }
.tt-main { padding-block: var(--tt-space-8) var(--tt-space-16); }
.tt-footer { border-top: 1px solid var(--tt-color-border); padding-block: var(--tt-space-8); font-size: var(--tt-text-sm); color: var(--tt-color-text-muted); }
.tt-footer a { color: inherit; }
.tt-hero { padding-block: var(--tt-space-12); }
.tt-hero p { font-size: var(--tt-text-lg); color: var(--tt-color-text-muted); max-width: 40rem; }
.tt-eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--tt-text-xs); font-weight: var(--tt-weight-semibold); color: var(--tt-color-text-muted); }
.tt-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Theme switch (see theme.js). One button cycles auto -> light -> dark; icons swap on data-mode. */
.tt-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0; border-radius: var(--tt-radius-full);
  border: 1px solid var(--tt-color-border); background: transparent; color: var(--tt-color-text-muted); cursor: pointer;
}
.tt-theme-toggle:hover { color: var(--tt-color-text); background: var(--tt-color-surface); }
.tt-theme-toggle svg { width: 1.1rem; height: 1.1rem; display: none; }
.tt-theme-toggle[data-mode="auto"] .tt-icon-auto,
.tt-theme-toggle[data-mode="light"] .tt-icon-light,
.tt-theme-toggle[data-mode="dark"] .tt-icon-dark { display: block; }
.tt-theme-toggle:not([data-mode]) .tt-icon-auto { display: block; }
