/* Forgehaven Labs — base stylesheet.
   Strict-CSP compatible: no @import, no remote URLs, no inline styles.
   Design tokens are theme-switched via [data-theme] on <html>. */

:root,
[data-theme="dark"] {
  --bg:           #0e0d0c;
  --bg-elev:     #16140f;
  --bg-alt:      #110f0c;
  --surface:     #1c1814;
  --border:      #2a241d;
  --border-strong:#3a2f24;
  --text:        #ede4d3;
  --text-muted:  #a8a092;
  --text-dim:    #968d7e;
  --accent:      #e8743b;
  --accent-soft: #c75d2a;
  --accent-glow: rgba(232, 116, 59, 0.12);
  --focus:       #f59e6a;
  --shadow:      0 1px 0 rgba(255, 255, 255, 0.02) inset,
                 0 12px 32px -16px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  --bg:           #fbf8f3;
  --bg-elev:     #f3ede2;
  --bg-alt:      #f7f2e9;
  --surface:     #ffffff;
  --border:      #e3dccd;
  --border-strong:#c8bea9;
  --text:        #1a1714;
  --text-muted:  #5a544a;
  --text-dim:    #6a6358;
  --accent:      #b94f1d;
  --accent-soft: #9a4216;
  --accent-glow: rgba(185, 79, 29, 0.10);
  --focus:       #b94f1d;
  --shadow:      0 1px 0 rgba(0, 0, 0, 0.02) inset,
                 0 8px 24px -16px rgba(46, 34, 22, 0.18);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); text-decoration: underline; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--accent); color: #1a0f08; }

/* Layout primitives ------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.skip-link {
  position: absolute;
  top: -40px; left: 16px;
  background: var(--accent);
  color: #1a0f08;
  padding: 8px 14px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 16px; }

/* Header / nav ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }

.brand-mark {
  width: 22px; height: 22px;
  display: inline-block;
  background:
    linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand-text {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.primary-nav { margin-left: auto; }

.nav-list {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0; padding: 0;
  font-size: 15px;
}
.nav-list a {
  color: var(--text-muted);
  font-weight: 500;
}
.nav-list a:hover { color: var(--text); text-decoration: none; }
.nav-list a[aria-current="page"] { color: var(--accent); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle-bars {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  position: relative;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px; height: 2px;
  background: var(--text);
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top:  6px; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px; height: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle-icon {
  width: 16px; height: 16px;
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--theme-toggle-mask) no-repeat center / contain;
          mask: var(--theme-toggle-mask) no-repeat center / contain;
}
[data-theme="dark"] {
  --theme-toggle-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M11.5 8.5A4.5 4.5 0 0 1 7.5 4a4.6 4.6 0 0 1 .2-1.3.5.5 0 0 0-.6-.6 6 6 0 1 0 6.8 6.8.5.5 0 0 0-.6-.6 4.6 4.6 0 0 1-1.8.2z'/></svg>");
}
[data-theme="light"] {
  --theme-toggle-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='3.2' fill='black'/><g stroke='black' stroke-width='1.4' stroke-linecap='round'><line x1='8' y1='1.2' x2='8' y2='2.6'/><line x1='8' y1='13.4' x2='8' y2='14.8'/><line x1='1.2' y1='8' x2='2.6' y2='8'/><line x1='13.4' y1='8' x2='14.8' y2='8'/><line x1='3.1' y1='3.1' x2='4.1' y2='4.1'/><line x1='11.9' y1='11.9' x2='12.9' y2='12.9'/><line x1='3.1' y1='12.9' x2='4.1' y2='11.9'/><line x1='11.9' y1='4.1' x2='12.9' y2='3.1'/></g></svg>");
}

/* Hero -------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: 96px 0 80px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 80% -10%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse at 0% 110%, var(--accent-glow), transparent 55%),
    var(--bg);
}

.hero-inner { max-width: 760px; }

.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.hero-title {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0 0 20px;
  color: var(--text);
}

.hero-lede {
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #1a0f08;
}
.btn-primary:hover { background: var(--accent-soft); color: #1a0f08; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Sections ---------------------------------------------------------------- */

.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border);
}
.section-alt { background: var(--bg-alt); }

.section h2 {
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 20px;
  color: var(--text);
}

.prose {
  max-width: 68ch;
  color: var(--text-muted);
  font-size: 17px;
}

.grid {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
}
.card h3 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}
.card-muted { opacity: 0.92; }

.tag {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border-strong);
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.contact-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 24px 0 0;
}
.contact-list > div { display: contents; }
.contact-list dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 2px;
}
.contact-list dd { margin: 0; color: var(--text); }

/* Legal pages ------------------------------------------------------------- */

.legal { padding: 64px 0 96px; }
.legal-inner { max-width: 720px; }
.legal h1 {
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.legal h2 {
  font-size: 20px;
  margin: 36px 0 10px;
  color: var(--text);
}
.legal p {
  color: var(--text-muted);
  margin: 0 0 14px;
  max-width: 68ch;
}
.legal-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 32px;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-copy {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}
.footer-nav {
  list-style: none;
  display: flex;
  gap: 18px;
  margin: 0; padding: 0;
  font-size: 14px;
}
.footer-nav a { color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); text-decoration: none; }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 56px; }
  .section { padding: 56px 0; }

  .nav-toggle { display: inline-flex; }
  .nav-list {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
    display: none;
  }
  .nav-list.is-open { display: flex; }
  .nav-list li { border-bottom: 1px solid var(--border); }
  .nav-list li:last-child { border-bottom: 0; }
  .nav-list a {
    display: block;
    padding: 12px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}
