/* =========================================================================
   FORGE — shared framework stylesheet
   Loaded with an ABSOLUTE path (/assets/global.css) on every page, at any
   folder depth, so it never breaks when a tool lives at /tools/x/y/.
   This file owns: reset, tokens, header/nav, footer, ad slots, buttons,
   the tool grid, and the shared "page-intro" header block. Anything a
   single tool needs that no other page needs belongs in that tool's own
   style.css instead.
   ========================================================================= */

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }

/* ---- Design tokens ------------------------------------------------------
   Forge's palette is soot and hot metal: a warm near-black (not blue-black)
   for the shop floor, cool steel for the structure, and — instead of a
   single flat "AI orange" — an actual four-stop molten gradient that runs
   from white-hot yellow through orange into cooling ember red. The
   gradient is reserved for a few deliberate spots (the mark, the equals
   key, the hero glow); everything else stays quiet steel and soot. */
:root {
  --bg:            #1a1714;
  --bg-raised:      #221e1a;
  --bg-raised-hi:   #2b2622;
  --border:        #332d27;
  --steel:         #8f8880;
  --steel-bright:  #bdb6ad;

  --molten-1:      #ffd166; /* white-hot core */
  --molten-2:      #ff8a1e; /* orange */
  --molten-3:      #d3350f; /* ember red */
  --molten-4:      #6e0f02; /* cooling, near-bg */
  --molten-gradient: linear-gradient(135deg, var(--molten-1) 0%, var(--molten-2) 42%, var(--molten-3) 75%, var(--molten-4) 100%);

  --ember:         #e2540c; /* solid accent for text/borders — ember, not traffic-cone orange */
  --ember-dim:     #a83d08;
  --text:          #ece7e1;
  --text-dim:      #9a938a;
  --danger:        #ff5c5c;

  --font-display: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 8px;
  --header-h: 56px;
  --max-width: 1080px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

/* ---- Bracket label — the site's one recurring signature mark ----------- */
.bracket-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--steel-bright);
  white-space: nowrap;
}
.bracket-label::before { content: "["; color: var(--steel); margin-right: 0.35em; }
.bracket-label::after  { content: "]"; color: var(--steel); margin-left: 0.35em; }

/* ---- Header / nav -------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 23, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  margin-right: auto;
}
.brand-mark { display: flex; }
.brand-name { }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  margin: 0 6px;
  background: var(--steel-bright);
  border-radius: 2px;
}

.site-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.nav-group { position: relative; display: flex; }
.nav-cat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  cursor: pointer;
  height: 34px;
}
.nav-cat-toggle:hover,
.nav-group.open .nav-cat-toggle {
  border-color: var(--border);
  background: var(--bg-raised);
}
.nav-group.open .nav-cat-toggle .chevron { transform: rotate(180deg); }
.chevron {
  color: var(--steel);
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.35);
}
.nav-group.open .nav-dropdown { display: flex; }

.nav-dropdown a,
.nav-dropdown .tool-link.soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text);
}
.nav-dropdown a:hover { background: var(--bg-raised-hi); color: var(--ember); }
.nav-dropdown a.active { color: var(--ember); }
.nav-dropdown .tool-link.soon {
  color: var(--text-dim);
  cursor: default;
}

.pill {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
  flex-shrink: 0;
}
.pill-live { background: rgba(226, 84, 12, 0.15); color: var(--molten-2); border: 1px solid rgba(226, 84, 12, 0.35); }
.pill-soon { background: rgba(125, 138, 153, 0.15); color: var(--steel-bright); border: 1px solid var(--border); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; }
.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer-badge { color: var(--steel-bright); }

/* ---- Ad slots -------------------------------------------------------------
   Plain placeholder divs. Drop <div class="ad-slot" data-ad-slot="name"
   data-ad-size="WxH"></div> anywhere; layout.js labels it automatically. */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  margin: 24px auto;
  max-width: var(--max-width);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text-dim);
}
.ad-slot-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--ember); color: var(--ember); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; border-color: var(--border); color: var(--text); }
.btn:disabled:hover { border-color: var(--border); color: var(--text); }
.btn-primary { background: var(--ember); border-color: var(--ember); color: #1a0f06; }
.btn-primary:hover { background: var(--ember-dim); border-color: var(--ember-dim); color: #1a0f06; }

/* ---- Shared page intro block (hero on landing, header on tool pages) ----
   A soft, static bloom of molten color sits behind the title — like heat
   coming off the forge — instead of a blinking "status" badge. */
.page-intro {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px 8px;
}
.page-intro::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 20px;
  width: 340px;
  height: 220px;
  background: radial-gradient(closest-side, rgba(255, 138, 30, 0.16), rgba(211, 53, 15, 0.08) 60%, transparent 80%);
  filter: blur(4px);
  pointer-events: none;
  z-index: -1;
}
.page-title {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  padding-bottom: 14px;
}
.page-title::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--molten-gradient);
}
.page-tagline {
  max-width: 62ch;
  color: var(--text-dim);
  font-size: 1.05rem;
}
.stat-line {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--steel-bright);
}

/* ---- Tool grid ------------------------------------------------------------ */
.tool-section { max-width: var(--max-width); margin: 0 auto; padding: 8px 20px 40px; }
.category-block + .category-block { margin-top: 36px; }
.category-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.category-count { color: var(--text-dim); font-size: 0.82rem; }

.common-links-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.common-links-grid a {
  font-family: var(--font-display);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--steel-bright);
  text-decoration: none;
}
.common-links-grid a:hover { border-color: var(--ember); color: var(--ember); }

/* ---- Reference tables (generated pair pages) & cross-links --------------- */
.ref-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.ref-table { width: 100%; border-collapse: collapse; background: var(--bg-raised); }
.ref-table th,
.ref-table td { text-align: left; padding: 10px 14px; font-size: 0.88rem; }
.ref-table thead th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel-bright);
  border-bottom: 1px solid var(--border);
}
.ref-table tbody tr { border-top: 1px solid var(--border); }
.ref-table tbody tr:first-child { border-top: none; }
.ref-table tbody td:last-child { font-family: var(--font-display); color: var(--steel-bright); }

.pair-page-links {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4px 20px 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}
.pair-page-links a { color: var(--ember); text-decoration: none; }
.pair-page-links a:hover { text-decoration: underline; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.tool-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tool-card:not(.is-soon):hover {
  border-color: var(--ember);
  box-shadow: 0 10px 28px rgba(211, 53, 15, 0.18);
  transform: translateY(-2px);
}
.tool-card.is-soon { color: var(--text-dim); cursor: default; }
.tool-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.tool-card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}
.tool-card-desc { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    display: none;
  }
  .site-header.nav-open .site-nav { display: flex; }
  .nav-group { flex-direction: column; }
  .nav-dropdown {
    position: static;
    box-shadow: none;
    display: none;
    border: none;
    padding-left: 10px;
  }
  .nav-group.open .nav-dropdown { display: flex; }
}
