/* TN Tools — shared design language.
 *
 * Standalone HTML tools at /tools/*.html share this stylesheet.
 * Mirrors the Next.js site's Phase-18 register pivot (2026-04-26):
 * rust-orange primary (#c2410c), steel-blue accent (#1e3a5f), Oswald
 * 700/800 display face (industrial/spec-sheet, not editorial-magazine),
 * sharp rectangle geometry (radius 4px max, pill = 0), two-family stack
 * DM Sans (UI/body) + Oswald (display). All token values mirror
 * lib/design.ts COLORS / TYPE / RADIUS / SPACING / SHADOWS.
 */

:root {
  /* Background. */
  --bg-page:       #f8f5f0;
  --bg-card:       #ffffff;
  --bg-subtle:     #ede5d4;
  --bg-highlight:  #fdf6ec;
  --bg-inverse:    #1a1510;

  /* Text. */
  --text-primary:   #1f1810;
  --text-dark:      #0f0c08;
  --text-body:      #332a1e;
  --text-secondary: #52473a;
  --text-tertiary:  #5a4d3a;
  --text-muted:     #6b5d48;
  --text-disabled:  #b8ad9c;
  --text-light:     #d4c9b8;
  --text-inverse:   #fdfcfa;

  /* Border. */
  --border-default: #c4b6a0;
  --border-light:   #d8cdb8;
  --border-input:   #b0a48f;
  --border-strong:  #8a7c64;

  /* Brand — Phase 18 role swap: rust primary, steel accent. */
  --brand-primary:        #c2410c;  /* worn rust orange */
  --brand-primary-dark:   #9a3412;
  --brand-primary-ghost:  #fed7aa;
  --brand-accent:         #1e3a5f;  /* steel blue */
  --brand-accent-dark:    #14306b;
  --brand-accent-ghost:   #dbeafe;

  /* Status. */
  --status-up:      #2d6a4f;
  --status-up-bg:   #dcfce7;
  --status-down:    #991b1b;
  --status-down-bg: #fee2e2;
  --status-warn:    #92400e;
  --status-warn-bg: #fef3c7;

  /* Geometry — sharp register. */
  --radius-sm:   4px;
  --radius-md:   4px;
  --radius-lg:   4px;
  --radius-pill: 0;

  /* Spacing. */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-xxl:  48px;
  --space-xxxl: 64px;

  /* Shadows (rare in tools, but available for parity). */
  --shadow-sm: 0 1px 2px rgba(44, 36, 22, 0.04);
  --shadow-md: 0 2px 8px rgba(44, 36, 22, 0.06);
  --shadow-lg: 0 4px 16px rgba(44, 36, 22, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding: 32px 16px 64px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
}

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

a {
  color: var(--brand-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--brand-accent-dark); }
a:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* Site-chrome continuity: tools-header sits above the tool content,
 * giving each tool a back-link to the main site in the same register
 * the site uses elsewhere. */
.tools-header {
  max-width: 720px;
  margin: 0 auto var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.tools-header .tn-wordmark {
  font-family: 'Oswald', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}
.tools-header .tn-wordmark:hover { color: var(--brand-primary); }
.tn-tools-back-link {
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}
.tn-tools-back-link:hover { color: var(--brand-primary); }

.eyebrow {
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 6px 0;
}

.eyebrow-bracketed::before { content: '['; margin-right: 6px; }
.eyebrow-bracketed::after { content: ']'; margin-left: 6px; }

/* Display face: Oswald 700, condensed-sans / spec-sheet register.
 * No serif, no italic. */
h1 {
  font-family: 'Oswald', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}
h2 {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}
h3 {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

p { margin: 0 0 12px 0; }
.lead {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text-body);
  max-width: 60ch;
}
.muted { color: var(--text-muted); }

/* Sharp-corner cards. The whole point of the home-page register —
 * speed-square, T-square, snapped chalk line — applies here too. */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

/* Tool index card link — proper class instead of inline styles on <a>. */
.tn-tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.tn-tool-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.tn-tool-card:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.tn-tool-card h3 {
  color: var(--text-primary);
  margin-top: 4px;
}
.tn-tool-card p {
  color: var(--text-body);
  margin: 0;
}

.stamp {
  display: inline-block;
  background: var(--brand-primary);
  color: #fff;
  padding: 4px 8px;
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0;
}
.stamp-accent { background: var(--brand-accent); }

/* Form elements. */
.field {
  margin-bottom: 16px;
}
/* Labels are sentence-case body text — eyebrow/all-caps style is
 * reserved for section eyebrows, not form labels. */
.field label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-input);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.field input:focus,
.field select:focus {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-color: var(--brand-primary);
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

button.cta {
  display: inline-block;
  padding: 12px 24px;
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms ease;
}
button.cta:hover { background: var(--brand-primary-dark); }
button.cta:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* Result rows — big tabular numbers, eyebrow-style label. */
.result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
}
.result:first-child { border-top: none; padding-top: 0; }
.result .label {
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.result .value {
  font-family: 'Oswald', system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.result .value.muted {
  color: var(--text-muted);
  font-weight: 500;
}
.result .sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: 'DM Sans', system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

/* Disclaimer: full bordered card with bg-subtle, not border-left only. */
.disclaimer {
  margin-top: 32px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-body);
  line-height: 1.6;
}
.disclaimer strong { color: var(--text-primary); }

footer.tn-tools-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  body { padding: 16px 12px 48px; }
  .row { grid-template-columns: 1fr; }
  .tools-header { margin-bottom: var(--space-md); }
}

/* Print: black ink, no backgrounds, expand URLs after links. */
@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  .card,
  .tn-tool-card,
  .disclaimer {
    background: #fff !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
  .tools-header,
  .tn-tools-back-link,
  footer.tn-tools-footer,
  button.cta {
    display: none !important;
  }
  a {
    color: #000 !important;
    text-decoration: underline;
  }
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #000;
  }
  .stamp,
  .stamp-accent {
    background: #000 !important;
    color: #fff !important;
  }
  h1, h2, h3, .result .value, .result .label, .eyebrow {
    color: #000 !important;
  }
}
