/* ============================================================
   MAGLUFORGE - SHARED DESIGN SYSTEM
   magluforge-shared.css
   Link this in every tool and the homepage.
   ============================================================ */

/* ── VARIABLES ───────────────────────────────────────────────────────────── */
:root {
  --bg:          #08070a;
  --bg2:         #0e0b0f;
  --bg3:         #100e12;
  --ember:       #e87530;
  --ember-dim:   #a04c10;
  --ember-glow:  rgba(232,122,40,0.2);
  --gold:        #c8922a;
  --gold-pale:   #e8c878;
  --ash:         #e0d4c0;
  --ash-dim:     #c0b090;
  --stone:       #6a5840;
  --stone-mid:   #b89060;
  --stone-dim:   #3a2e20;
  --border:      rgba(200,146,42,0.18);
  --border-dim:  rgba(255,165,60,0.1);
  --rune:        rgba(232,122,40,0.12);
  --success:     #50c878;
  --danger:      #e04040;
  --warning:     #e8c040;
  --purple:      #c040e0;
  --blue-steel:  #8ab0d0;

  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Pro', Georgia, serif;
}

/* ── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ash);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--stone-dim); border-radius: 3px; }

/* ── GRAIN OVERLAY ───────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.028;
}

/* ── PAGE WRAPPER (sits above canvas + grain) ────────────────────────────── */
#page { position: relative; z-index: 2; }

/* ── NAV ─────────────────────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 60px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,7,10,0.9);
  backdrop-filter: blur(12px);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ember);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(232,122,40,0.5));
}
.nav-logo span { color: var(--stone); font-weight: 400; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav-links a,
.nav-links span {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--stone);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.2s;
  cursor: pointer;
}
.nav-links a:hover { color: var(--ember); }

.nav-divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.nav-tool-name {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--stone-mid);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── FOOTER ──────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--stone-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.footer-note {
  font-size: 12px;
  color: var(--stone-dim);
  font-style: italic;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 13px 32px;
  background: linear-gradient(135deg, #c05818, #8a3a0e);
  border: 1px solid var(--ember);
  border-radius: 3px;
  color: var(--gold-pale);
  cursor: pointer;
  box-shadow: 0 0 28px var(--ember-glow), inset 0 1px 0 rgba(255,200,100,0.1);
  transition: box-shadow 0.2s, transform 0.15s;
}
.btn-primary:hover {
  box-shadow: 0 0 44px rgba(232,122,40,0.38), inset 0 1px 0 rgba(255,200,100,0.1);
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 13px 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--stone);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--ember); color: var(--ember); }

/* ── DIVIDER ─────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 56px;
}
.divider-line { flex: 1; height: 1px; background: var(--border); }
.divider-text {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--stone);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
}
.divider-gem {
  width: 6px;
  height: 6px;
  background: var(--ember-dim);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* ── TOOLTIP ─────────────────────────────────────────────────────────────── */
.tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
}
.tip-btn {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,165,60,0.3);
  color: var(--stone-mid);
  font-size: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  vertical-align: middle;
  line-height: 1;
  padding: 0;
}
.tip-btn:hover, .tip-btn.open { background: var(--rune); }

.tip-box {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  background: #1c160e;
  border: 1px solid rgba(255,165,60,0.28);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ash-dim);
  font-family: var(--font-body);
  line-height: 1.6;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(0,0,0,0.7);
  pointer-events: none;
}
.tip-box.open { display: block; }
.tip-box::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #1c160e;
  border-right: 1px solid rgba(255,165,60,0.28);
  border-bottom: 1px solid rgba(255,165,60,0.28);
}

/* ── SECTION BOX ─────────────────────────────────────────────────────────── */
.section-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.section-box.accent-ember  { border-color: var(--ember); }
.section-box.accent-purple { border-color: var(--purple); }
.section-box.accent-nova   { border-color: #ff8c42; }

.section-title {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--stone-mid);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
}
.section-box.accent-ember  .section-title { color: var(--ember); }
.section-box.accent-purple .section-title { color: var(--purple); }
.section-box.accent-nova   .section-title { color: #ff8c42; }

/* ── STAT ROW ────────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.stat-label {
  font-size: 12px;
  color: var(--stone);
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
}
.stat-value {
  font-size: 13px;
  color: var(--ash);
  font-weight: 600;
  font-family: var(--font-display);
}

/* ── HEALTH BAR ──────────────────────────────────────────────────────────── */
.hp-row { margin-bottom: 10px; }
.hp-row:last-child { margin-bottom: 0; }
.hp-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  font-size: 12px;
  color: var(--stone);
}
.hp-track {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.hp-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── FORM FIELDS ─────────────────────────────────────────────────────────── */
.sec-label {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
  margin-top: 18px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-dim);
}
.sec-label:first-child { margin-top: 0; }

.field { margin-bottom: 10px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.field label,
.field .field-label {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--stone-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.field input[type="number"],
.field select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,165,60,0.2);
  border-radius: 6px;
  color: var(--ash);
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  margin-top: 3px;
  outline: none;
  transition: border-color 0.2s;
}
.field input[type="number"]:focus,
.field select:focus { border-color: rgba(255,165,60,0.5); }
.field input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; }

select option { background: #1a150e; }

.field-check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  cursor: pointer;
}
.field-check input[type="checkbox"] {
  accent-color: var(--ember);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.field-check .check-label {
  font-size: 12px;
  color: var(--ash-dim);
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ── SCROLL REVEAL ───────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }
.reveal-delay-7 { transition-delay: 0.7s; }

/* ── ANIMATIONS ──────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1; }
}

/* ── DISCLAIMER ──────────────────────────────────────────────────────────── */
.disclaimer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 60px 60px;
}
.disclaimer .inner {
  border-top: 1px solid var(--border-dim);
  padding-top: 20px;
}
.disclaimer .disc-title {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.disclaimer p {
  font-size: 12px;
  color: var(--stone-dim);
  font-family: var(--font-body);
  line-height: 1.75;
  max-width: 860px;
}
/* ── TOOL PAGE HEADER ────────────────────────────────────────────────────── */
.tool-header {
  padding: 28px 60px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(232,122,40,0.04) 0%, transparent 100%);
}
.tool-header .breadcrumb {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--stone);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tool-header .breadcrumb a:hover { color: var(--ember); }
.tool-header .breadcrumb .sep { color: var(--stone-dim); }
.tool-header .breadcrumb .current { color: var(--stone-mid); }
.tool-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ash);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.tool-header .subtitle {
  font-size: 13px;
  color: var(--stone);
  font-style: italic;
}

/* ── TOOL BODY LAYOUT ────────────────────────────────────────────────────── */
#tool-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 60px;
}
#form-col {
  padding-right: 32px;
  border-right: 1px solid var(--border-dim);
}
#results-col {
  padding-left: 32px;
}

/* ── PRIMARY ACTION BUTTON (run / calculate) ─────────────────────────────── */
.tool-run-btn {
  width: 100%;
  padding: 13px 0;
  background: linear-gradient(135deg, #c05818 0%, #8a3a0e 100%);
  border: 1px solid var(--ember);
  border-radius: 4px;
  color: var(--gold-pale);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.18em;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  text-transform: uppercase;
  box-shadow: 0 4px 24px rgba(200,80,20,0.3);
  transition: box-shadow 0.2s, transform 0.15s;
}
.tool-run-btn:hover {
  box-shadow: 0 4px 36px rgba(200,80,20,0.5);
  transform: translateY(-1px);
}

/* ── PLACEHOLDER (empty results) ─────────────────────────────────────────── */
#placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--stone-dim);
  gap: 14px;
}
.placeholder-ring {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,165,60,0.1);
  border-radius: 50%;
}
.placeholder-text {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── RESULTS PANEL ───────────────────────────────────────────────────────── */
#results-panel { display: none; }

/* ── TWO-COL SECTIONS (inside results) ───────────────────────────────────── */
.two-col-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.two-col-sections .section-box { margin-bottom: 0; }

/* ── EXTENDED INPUT STYLES ───────────────────────────────────────────────── */
.field input[type="text"] {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,165,60,0.2);
  border-radius: 6px;
  color: var(--ash);
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  margin-top: 3px;
  outline: none;
  transition: border-color 0.2s;
}
.field input[type="text"]:focus { border-color: rgba(255,165,60,0.5); }
.field input[type="text"]::placeholder { color: var(--stone); opacity: 0.5; }

.dice-flat-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  align-items: end;
}
.flat-sublabel {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--stone);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
  display: block;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--ember);
  cursor: pointer;
  margin-top: 6px;
}
.range-row { display: flex; align-items: center; }
.range-val {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ember);
  font-weight: 600;
  margin-left: 10px;
  white-space: nowrap;
  min-width: 38px;
}
.field-note {
  font-size: 11px;
  color: var(--stone);
  font-family: var(--font-body);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.4;
}