/* Reset, typography, layout primitives */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5 {
  color: var(--text-strong);
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--text-link);
  text-decoration: none;
  font-weight: var(--fw-medium);
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

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

svg {
  flex: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s-6) 0;
}

/* Visible focus everywhere — never remove without replacement */
:focus-visible {
  outline: 2px solid var(--violet-500);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--violet-200);
  color: var(--text-strong);
}

/* ---------- Utility primitives ---------- */

.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;
}

.stack {
  display: flex;
  flex-direction: column;
}
.stack--1 { gap: var(--s-1); }
.stack--2 { gap: var(--s-2); }
.stack--3 { gap: var(--s-3); }
.stack--4 { gap: var(--s-4); }
.stack--5 { gap: var(--s-5); }
.stack--6 { gap: var(--s-6); }
.stack--8 { gap: var(--s-8); }

.row {
  display: flex;
  align-items: center;
}
.row--1 { gap: var(--s-1); }
.row--2 { gap: var(--s-2); }
.row--3 { gap: var(--s-3); }
.row--4 { gap: var(--s-4); }
.row--6 { gap: var(--s-6); }
.row--top { align-items: flex-start; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }

.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--s-4); }
.grid--auto-220 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid--auto-260 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--auto-300 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid--auto-340 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Two-column page layouts. Declared as classes (never inline styles) so the
   mobile breakpoints in responsive.css can collapse them to a single column. */
.grid--aside,
.grid--form,
.grid--half,
.grid--pick {
  align-items: start;
  gap: var(--s-6);
}

.grid--aside { grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr); gap: var(--s-5); }
.grid--form  { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
.grid--half  { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid--pick  { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }

/* ---------- Text helpers ---------- */

.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-md { font-size: var(--fs-md); }
.t-lg { font-size: var(--fs-lg); }
.t-xl { font-size: var(--fs-xl); }
.t-2xl { font-size: var(--fs-2xl); }

.t-muted { color: var(--text-muted); }
.t-subtle { color: var(--text-subtle); }
.t-strong { color: var(--text-strong); }
.t-primary { color: var(--primary); }
.t-mint { color: var(--mint-600); }
.t-gold { color: var(--gold-600); }
.t-rose { color: var(--rose-600); }

.t-medium { font-weight: var(--fw-medium); }
.t-semibold { font-weight: var(--fw-semibold); }
.t-bold { font-weight: var(--fw-bold); }

.t-center { text-align: center; }
.t-right { text-align: right; }

.t-caps {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-subtle);
}

.t-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.t-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.t-num {
  font-variant-numeric: tabular-nums;
}

/* ---------- App layout ---------- */

#app {
  min-height: 100%;
}

.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-app);
}

.layout__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1 1 auto;
  padding: var(--s-8);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.page__head {
  margin-bottom: var(--s-6);
}

.page__title {
  font-size: var(--fs-3xl);
}

.page__sub {
  color: var(--text-muted);
  font-size: var(--fs-md);
  margin-top: var(--s-2);
}

.section {
  margin-top: var(--s-8);
}

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.section__title {
  font-size: var(--fs-xl);
}
