/*
 * Theme layer over Bootstrap 5.3.
 *
 * Everything here works by overriding Bootstrap's own CSS variables rather than
 * re-implementing its rules, so components keep their built-in behaviour and
 * dark mode comes from Bootstrap's [data-bs-theme] switch.
 */

/* ----------------------------------------------------------- brand palette */
:root,
[data-bs-theme="light"] {
  --accent: #6f5b3e;
  --accent-contrast: #fdfcfa;
  --surface: #fffffe;   /* cards and other raised surfaces */

  /* Warm paper instead of Bootstrap's plain white. */
  --bs-body-bg: #f8f7f4;
  --bs-body-color: #1a1a18;
  --bs-emphasis-color: #111110;
  --bs-secondary-color: rgb(81 78 71 / 100%);
  --bs-tertiary-color: rgb(113 110 103 / 100%);
  /* Bootstrap's *-rgb companions feed the .bg-*/.text-* utilities, which build
     rgba() from them — overriding only the plain variable leaves the utilities
     on Bootstrap's defaults. */
  --bs-body-bg-rgb: 248, 247, 244;
  --bs-body-color-rgb: 26, 26, 24;
  --bs-emphasis-color-rgb: 17, 17, 16;
  --bs-tertiary-bg: #f1efe9;
  --bs-tertiary-bg-rgb: 241, 239, 233;
  --bs-border-color: #e3e0d8;
  --bs-link-color: #1a1a18;
  --bs-link-hover-color: var(--accent);
}

[data-bs-theme="dark"] {
  --accent: #c9ad7f;
  --accent-contrast: #17170f;
  --surface: #1c1c18;

  --bs-body-bg: #12120f;
  --bs-body-color: #f3f2ec;
  --bs-emphasis-color: #fffefa;
  --bs-secondary-color: rgb(184 181 172 / 100%);
  --bs-tertiary-color: rgb(141 135 123 / 100%);
  --bs-body-bg-rgb: 18, 18, 15;
  --bs-body-color-rgb: 243, 242, 236;
  --bs-emphasis-color-rgb: 255, 254, 250;
  --bs-tertiary-bg: #191916;
  --bs-tertiary-bg-rgb: 25, 25, 22;
  --bs-border-color: #2c2c26;
  --bs-link-color: #f3f2ec;
  --bs-link-hover-color: var(--accent);
}

/* Cards sit slightly above the page rather than matching it. Bootstrap declares
   --bs-card-bg on .card itself, so these have to be scoped to the component. */
.card { --bs-card-bg: var(--surface); }
.card.bg-body-tertiary { --bs-card-bg: var(--bs-tertiary-bg); }

/* --------------------------------------------------------------- typography */
:root {
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --bs-font-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --bs-body-line-height: 1.65;
}

.font-display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.font-mono {
  font-family: var(--bs-font-monospace);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, .display-1, .display-5 { text-wrap: balance; }
p { text-wrap: pretty; }

/* Bootstrap's display-1 is heavier and larger than this page wants. */
.display-1 { font-size: clamp(2.75rem, 9vw, 5.25rem); }
.display-5 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.lead { max-width: 46ch; }

.eyebrow {
  font-family: var(--bs-font-monospace);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow:not(.text-body-secondary) { color: var(--accent); }

.accent { color: var(--accent); }

/* ------------------------------------------------------------- components */
/* Bootstrap buttons read their colours from per-component variables. */
.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-color: var(--accent-contrast);
  --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 88%, black);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 88%, black);
  --bs-btn-hover-color: var(--accent-contrast);
  --bs-btn-active-bg: color-mix(in srgb, var(--accent) 78%, black);
  --bs-btn-active-border-color: color-mix(in srgb, var(--accent) 78%, black);
  --bs-btn-active-color: var(--accent-contrast);
}

.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-bg: var(--surface);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-hover-border-color: var(--accent);
}

.tag {
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  font-family: var(--bs-font-monospace);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card { --bs-card-border-color: var(--bs-border-color); }

.nav-link:hover { color: var(--bs-body-color) !important; }

/* Project marks: the SVG carries its own light/dark palette, so this only has
   to hold the box steady in the flex row. */
.project-logo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
}

/* Outcome bullets: an accent dot rather than a list marker. */
.outcomes li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
}
.outcomes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.stack {
  font-family: var(--bs-font-monospace);
  font-size: 0.75rem;
}
.stack .list-inline-item:not(:last-child) { margin-right: 0.25rem; }
.stack .list-inline-item:not(:last-child)::after { content: " ·"; }

/* Keep the transition on .btn from firing for reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------ print */
@media print {
  header nav, .btn, .visually-hidden-focusable { display: none !important; }
  section { break-inside: avoid; padding-block: 1rem !important; }
  .card { break-inside: avoid; box-shadow: none !important; }
}
