/*
 * forge.css — ironsmith.io
 * Hand-authored, no build step. See UI-REFCACTOR.md for the design system.
 */

/* ─────────────────────────────────────────────────────────────
   tokens
   ───────────────────────────────────────────────────────────── */

:root {
  --ink:    #0E0F11;
  --iron:   #1C1F24;
  --anvil:  #2A2E35;
  --patina: #3E5C54;
  --bone:   #EDE7DA;
  --ash:    #B7B1A4;
  --ember:  #C2410C;
  --coal:   #6B2A0E;

  --serif: 'Cormorant Garamond', 'EB Garamond', ui-serif, 'Iowan Old Style',
           'Apple Garamond', 'Baskerville', Cambria, Georgia,
           'Times New Roman', serif;
  --mono:  'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular,
           Menlo, Consolas, 'Liberation Mono', monospace;

  --step--1: clamp(0.875rem, 0.83rem + 0.22vw, 1rem);
  --step-0:  clamp(1rem,    0.93rem + 0.36vw, 1.25rem);
  --step-1:  clamp(1.25rem, 1.10rem + 0.75vw, 1.75rem);
  --step-2:  clamp(1.75rem, 1.40rem + 1.75vw, 2.75rem);
  --step-3:  clamp(2.50rem, 1.80rem + 3.50vw, 4.75rem);
  --step-4:  clamp(3.75rem, 2.40rem + 6.75vw, 8.00rem);

  --measure: 68ch;
  --gutter:  clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  --rule:    1px solid var(--ash);

  --bg: var(--bone);
  --fg: var(--ink);
  --fg-dim: color-mix(in srgb, var(--ink) 65%, var(--bone));
  --line: var(--anvil);
}

/* ─────────────────────────────────────────────────────────────
   reset
   ───────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "onum";
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 80ms linear;
}

a:hover { color: var(--ember); text-decoration-thickness: 2px; }
a:visited { color: inherit; }

a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

::selection { background: var(--ember); color: var(--bone); }

/* hammered surface — subtle SVG turbulence at very low opacity */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='1' stitchTiles='stitch'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}

body > * { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────
   theme: iron (dark)
   ───────────────────────────────────────────────────────────── */

body.theme-iron {
  --bg: var(--iron);
  --fg: var(--bone);
  --fg-dim: color-mix(in srgb, var(--bone) 65%, var(--iron));
  --line: color-mix(in srgb, var(--bone) 18%, var(--iron));
  --rule: 1px solid var(--line);
}

body.theme-iron::before { mix-blend-mode: screen; opacity: 0.04; }

/* ─────────────────────────────────────────────────────────────
   skip link
   ───────────────────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: -999px; top: -999px;
  background: var(--ember);
  color: var(--bone);
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  z-index: 1000;
}

.skip-link:focus {
  left: 0.75rem; top: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────
   layout
   ───────────────────────────────────────────────────────────── */

.shell {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.shell--narrow { max-width: 56rem; }

main { padding-block: clamp(2rem, 4vw, 4rem); }

/* ─────────────────────────────────────────────────────────────
   site chrome — header / footer
   ───────────────────────────────────────────────────────────── */

.site-header {
  padding-block: 1.25rem;
}

.site-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: inherit;
}

.brand:hover { color: var(--ember); text-decoration: none; }

.brand__mark {
  width: 1.6rem; height: 1.6rem;
  color: currentColor;
}

.site-nav { font-family: var(--mono); font-size: var(--step--1); }

.site-nav ul {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0; padding: 0;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.site-nav a {
  text-decoration: none;
  color: inherit;
}

.site-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
  color: var(--ember);
}

.site-footer {
  margin-top: clamp(3rem, 6vw, 6rem);
  padding-block: 1.5rem 2rem;
  border-top: 2px solid var(--line);
}

.site-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--fg-dim);
}

.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: var(--ember); }

.site-footer__mark {
  width: 1.4rem; height: 1.4rem;
  opacity: 0.7;
}

/* ─────────────────────────────────────────────────────────────
   typography
   ───────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.012em;
  margin: 0;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); font-weight: 600; }

p, ul, ol, dl, table { margin: 0 0 1em; }

p { max-width: var(--measure); }

strong { font-weight: 600; }
em { font-style: italic; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.92em;
}

/* letterpress impression on display headings */
.h-pressed {
  text-shadow: 0 1px 0 rgba(255,255,255,0.55), 0 -1px 0 rgba(0,0,0,0.10);
}

body.theme-iron .h-pressed {
  text-shadow: 0 1px 0 rgba(0,0,0,0.65), 0 -1px 0 rgba(255,255,255,0.05);
}

/* mono section labels */
.section-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.section-label::before {
  content: "§ ";
  opacity: 0.6;
}

/* labeled spine rule: a 2px line with the mono label inset */
.spine {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: clamp(2rem, 4vw, 3rem) 0 1.5rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.spine::before {
  content: "§ " attr(data-step) " —";
  white-space: nowrap;
}

.spine::after {
  content: "";
  flex: 1;
  border-top: 2px solid var(--line);
}

/* ─────────────────────────────────────────────────────────────
   home: hero
   ───────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(3rem, 8vw, 7rem) clamp(2rem, 5vw, 4rem);
}

.hero__display {
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.hero__lede {
  font-size: var(--step-1);
  line-height: 1.3;
  max-width: 28ch;
  color: var(--fg);
  margin: 0;
  font-style: italic;
  font-variation-settings: "wght" 420;
}

/* the single ember band: current commission */
.commission {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding: 1rem 0 1.25rem;
  border-top: 2px solid var(--ember);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
}

.commission__label {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ember);
}

.commission__status {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.commission__list {
  grid-column: 1 / -1;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 1.25rem;
}

.commission__item {
  display: grid;
  gap: 0.4rem;
  padding-top: 1rem;
  border-top: 1px dashed color-mix(in srgb, var(--line) 60%, transparent);
}

.commission__item:first-child {
  padding-top: 0;
  border-top: 0;
}

.commission__title {
  font-size: var(--step-1);
  font-weight: 500;
  margin: 0;
  max-width: 56ch;
}

.commission__cta {
  justify-self: start;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ember);
  text-decoration: none;
  border-bottom: 1px solid var(--ember);
  padding-bottom: 2px;
}

.commission__cta:hover {
  color: var(--coal);
  border-color: var(--coal);
}

/* ─────────────────────────────────────────────────────────────
   home: works grid
   ───────────────────────────────────────────────────────────── */

.works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0;
  border-top: var(--rule);
  border-left: var(--rule);
}

.work {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem 1.5rem;
  border-right: var(--rule);
  border-bottom: var(--rule);
  text-decoration: none;
  color: inherit;
  background: transparent;
  transition: background 120ms linear;
}

.work:hover {
  background: color-mix(in srgb, var(--ember) 6%, transparent);
  color: inherit;
}

.work__name {
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.work__name .dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--patina);
  display: inline-block;
}

.work__kind {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--fg-dim);
  margin: 0 0 0.75rem;
}

.work__blurb {
  font-size: var(--step-0);
  margin: 0;
  color: var(--fg-dim);
}

/* ─────────────────────────────────────────────────────────────
   home: doors (BBS menu)
   ───────────────────────────────────────────────────────────── */

.doors {
  font-family: var(--mono);
  font-size: var(--step-0);
  line-height: 1.9;
  margin: 0;
  padding: 1.5rem;
  background: var(--iron);
  color: var(--bone);
  border: 1px solid var(--line);
}

body.theme-iron .doors {
  background: color-mix(in srgb, var(--bone) 4%, var(--iron));
}

.doors__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px dashed color-mix(in srgb, var(--bone) 30%, transparent);
  letter-spacing: 0.1em;
  font-size: var(--step--1);
  text-transform: uppercase;
  color: var(--ash);
}

.doors__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
  font-size: var(--step--1);
}

.doors__list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
}

.doors__num {
  color: var(--ash);
}

.doors__name {
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--bone) 40%, transparent);
}

.doors__name:hover {
  color: var(--ember);
  border-bottom-color: var(--ember);
}

.doors__where {
  color: var(--ash);
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

.doors__foot {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed color-mix(in srgb, var(--bone) 30%, transparent);
  font-size: var(--step--1);
  letter-spacing: 0.05em;
  color: var(--ash);
}

/* ─────────────────────────────────────────────────────────────
   home: contact
   ───────────────────────────────────────────────────────────── */

.contact-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1rem 0;
  font-size: var(--step-1);
}

.contact-line__hours {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* ─────────────────────────────────────────────────────────────
   compliance pages (privacy, terms, cookies, contact)
   ───────────────────────────────────────────────────────────── */

.doc h1 {
  font-size: var(--step-3);
  margin-bottom: 0.25rem;
}

.doc h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: var(--step-2);
  border-top: 2px solid var(--line);
  padding-top: 1.25rem;
  position: relative;
}

.doc h2::before {
  content: "§ " counter(doc-section);
  counter-increment: doc-section;
  display: block;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 0.4rem;
}

.doc { counter-reset: doc-section; }

.doc h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: var(--step-1);
}

.doc h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.doc p, .doc li {
  font-size: var(--step-0);
  line-height: 1.6;
}

.doc ul, .doc ol {
  padding-left: 1.5rem;
  max-width: var(--measure);
}

.doc li { margin-bottom: 0.25rem; }

.doc a {
  color: var(--ember);
  text-decoration-thickness: 1px;
}

.effective-date {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 2rem;
}

.toc {
  padding: 1.25rem 1.5rem;
  margin: 2rem 0 2.5rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ash) 12%, var(--bg));
}

body.theme-iron .toc {
  background: color-mix(in srgb, var(--bone) 4%, var(--iron));
}

.toc h3 {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 0.75rem;
  font-weight: 500;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2rem;
}

@media (max-width: 600px) { .toc ul { columns: 1; } }

.toc li {
  font-size: var(--step--1);
  line-height: 1.7;
  break-inside: avoid;
}

.toc a { color: inherit; text-decoration: none; }
.toc a:hover { color: var(--ember); text-decoration: underline; }

.warning-box {
  border-left: 3px solid var(--ember);
  background: color-mix(in srgb, var(--ember) 5%, var(--bg));
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: var(--step-0);
}

body.theme-iron .warning-box {
  background: color-mix(in srgb, var(--ember) 12%, var(--iron));
}

.warning-box p:last-child, .warning-box ul:last-child { margin-bottom: 0; }

.info-box, .info-section, .response-time {
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 3px solid var(--patina);
  background: color-mix(in srgb, var(--patina) 6%, var(--bg));
}

body.theme-iron .info-box,
body.theme-iron .info-section,
body.theme-iron .response-time {
  background: color-mix(in srgb, var(--patina) 14%, var(--iron));
}

.info-box p:last-child,
.info-section p:last-child,
.info-section ul:last-child { margin-bottom: 0; }

.product-section {
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  padding: 1.5rem 0;
  margin: 2.5rem 0;
}

.contact-info {
  border-top: var(--rule);
  padding-top: 1.5rem;
  margin-top: 2.5rem;
}

.all-caps, .uppercase {
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* tables (cookie table etc.) */
.cookie-table, .doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  margin: 1.25rem 0;
}

.cookie-table th, .cookie-table td,
.doc table th, .doc table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.cookie-table th, .doc table th {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom: 2px solid var(--line);
}

/* contact page grid */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}

.contact-card {
  border: 1px solid var(--line);
  padding: 1.25rem;
}

.contact-card h3 {
  font-size: var(--step-0);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.contact-card .email {
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--ember);
  word-break: break-all;
}

.contact-card .description {
  margin-top: 0.5rem;
  font-size: var(--step--1);
  color: var(--fg-dim);
}

.hours-table {
  font-family: var(--mono);
  font-size: var(--step--1);
}

.hours-table > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
}

.hours-table > div:last-child { border-bottom: none; }

/* ─────────────────────────────────────────────────────────────
   utilities
   ───────────────────────────────────────────────────────────── */

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

.muted { color: var(--fg-dim); }
.mono  { font-family: var(--mono); letter-spacing: 0.04em; }

/* ─────────────────────────────────────────────────────────────
   ornaments: drop cap, doors cursor, wax seal
   ───────────────────────────────────────────────────────────── */

/* drop cap — applied to hero lede.
   Lede is italic; the drop cap is roman so the initial reads
   like a stamped capital rather than a slanted swash. */
.hero__lede.h-dropcap::first-letter {
  float: left;
  font-family: var(--serif);
  font-style: normal;
  font-weight: 700;
  font-size: 4em;
  line-height: 0.82;
  padding: 0.05em 0.14em 0 0;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.55), 0 -1px 0 rgba(0,0,0,0.10);
}

body.theme-iron .hero__lede.h-dropcap::first-letter {
  color: var(--bone);
  text-shadow: 0 1px 0 rgba(0,0,0,0.65), 0 -1px 0 rgba(255,255,255,0.05);
}

/* doors: BBS prompt and blinking cursor */
.doors__prompt {
  color: var(--ember);
  font-weight: 700;
  margin-right: 0.4em;
}

.doors__cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.4em;
  background: var(--bone);
  vertical-align: -0.12em;
  animation: doors-cursor 1.1s steps(2, jump-none) infinite;
}

@keyframes doors-cursor {
  to { opacity: 0; }
}

/* wax seal — stamped on legal pages just before the footer. */
.wax-seal {
  display: flex;
  justify-content: center;
  margin: clamp(3rem, 6vw, 4.5rem) auto 1rem;
  color: var(--fg-dim);
}

.wax-seal svg {
  width: clamp(96px, 11vw, 132px);
  height: auto;
  opacity: 0.85;
}

/* ─────────────────────────────────────────────────────────────
   motion preferences
   ───────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
  }
  body::before { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   print
   ───────────────────────────────────────────────────────────── */

@media print {
  body::before { display: none; }
  body { background: white; color: black; }
  .site-header, .site-footer, .doors { display: none; }
  a { color: black; text-decoration: underline; }
}
