@import url("/assets/fonts/fonts.css");

/* DeepARAM theme: cool grey page, light surfaces; The Lab's accent is its pink tab hue. */
:root {
  color-scheme: light dark;
  --bg: #e7ebef;
  --surface: #f0f3f6;
  --raised: #e0e5eb;
  --fg: #1f252e;
  --muted: #525b68;
  --line: #d3dae2;
  --hover: #e3e8ee;
  --accent: #ec5aa6;
  --accent-ink: #2a0b1c;
  --accent-soft: rgba(236, 90, 166, 0.16);
  --good: #197048;
  --bad: #a83831;
  --gold: #80601a;
  --display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 14px;
  --r-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090b0f; --surface: #11151c; --raised: #181d26; --fg: #e8ecf2; --muted: #8b94a3; --line: #222936;
    --hover: #181d26; --accent: #ec5aa6; --accent-ink: #2a0b1c; --accent-soft: rgba(236, 90, 166, 0.16);
    --a-ink: #eb86bd; --a-line: #7d3f68; --gain: #773860; --gold-ink: #e2bc73; --gold-line: #816839;
    --good: #4cc98b; --bad: #f0776f; --gold: #e0b45c;
    color-scheme: dark;
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  --bg: #090b0f; --surface: #11151c; --raised: #181d26; --fg: #e8ecf2; --muted: #8b94a3; --line: #222936;
  --hover: #181d26; --accent: #ec5aa6; --accent-ink: #2a0b1c; --accent-soft: rgba(236, 90, 166, 0.16);
  --a-ink: #eb86bd; --a-line: #7d3f68; --gain: #773860; --gold-ink: #e2bc73; --gold-line: #816839;
  --good: #4cc98b; --bad: #f0776f; --gold: #e0b45c;
  color-scheme: dark;
}

/* The Lab's hue (site colour pass): accent, tints and hue-tinted text. Gold accents use the site gold. */
:root {
  --a: #ec5aa6;
  --hue-gold: #e0a83c;
  /* Precomputed colour mixes (no color-mix(), so Safari before 16.2 and Firefox before 113 render the same).
     The light values are darkened to reach 4.5:1 contrast; dark values are set in the dark blocks above. */
  --a-ink: #8a416c;
  --a-soft: rgba(236, 90, 166, 0.16);
  --a-20: rgba(236, 90, 166, 0.2);
  --a-30: rgba(236, 90, 166, 0.3);
  --a-40: rgba(236, 90, 166, 0.4);
  --a-70: rgba(236, 90, 166, 0.7);
  --a-line: #dea0c7;
  --gain: #e5a6cc;
  --gold-ink: #7a5b16;
  --gold-line: #dac18f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main {
  margin: 0 auto;
  padding: 1.75rem 16px 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

h1 { font: 700 clamp(30px, 5vw, 44px)/1.04 var(--display); letter-spacing: -0.035em; text-wrap: balance; }
h2 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow { color: var(--muted); font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.eyebrow a { color: var(--a-ink); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.intro { display: flex; gap: 1rem; align-items: flex-start; padding-block: 0.5rem; }
.intro img { border-radius: 12px; flex: none; }
.intro h1 { margin-top: 0.3rem; }
.intro p.muted { margin-top: 0.5rem; max-width: 60ch; }

/* Every section is a card on the page. */
main > section {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  min-width: 0;
}
/* A thin colour edge on top of every card. */
main > section::before, .tool::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, var(--a), var(--a-30));
}
section > h2, .row-head { margin-bottom: 0.75rem; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

main > section.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 22px;
}
.label { display: block; color: var(--muted); font: 500 11.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.big .value { display: block; margin-top: 0.25rem; font: 600 3rem/1.05 var(--mono); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.big .value.infinite { color: var(--a-ink); }
.loop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-variant-numeric: tabular-nums; }
.loop-head > span:last-child { font: 500 14px var(--mono); text-align: right; }
.meter { position: relative; height: 6px; border-radius: 999px; background: var(--raised); margin: 0.5rem 0; overflow: hidden; }
#gain-bar { height: 100%; width: 0; border-radius: inherit; background: var(--gain); transition: width 0.2s; }
#gain-bar.full { background: var(--accent); }
.meter-mark { position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: var(--fg); }
#chart { width: 100%; height: 80px; grid-column: 1 / -1; }
#chart path.line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
#chart path.area { fill: var(--accent); opacity: 0.1; }
#chart line.cap { stroke: var(--line); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }

.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stats div { background: var(--raised); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
.stats dt { color: var(--muted); font-size: 12.5px; }
.stats dd { font: 600 1.05rem/1.3 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

input[type="range"] { width: 100%; accent-color: var(--accent); }
output { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }

.slots { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.slot {
  width: 52px; height: 52px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--line); background: var(--raised); padding: 0; cursor: pointer;
  display: grid; place-items: center; overflow: hidden;
}
.slot.filled { border: 1px solid var(--accent); }
.slot img { width: 100%; height: 100%; display: block; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.pick {
  text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: inherit;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem; font: inherit; font-size: 13px; cursor: pointer; line-height: 1.2;
}
.pick:hover:not(:disabled) { background: var(--a-soft); border-color: var(--a-line); }
.pick:disabled { opacity: 0.35; cursor: not-allowed; }
.pick.on:disabled { opacity: 1; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
/* Augment icons are white line art, so give them a dark tile in both themes. */
.augs img { background: #1c1c1c; }
.augs .slot.filled { background: #1c1c1c; }
.pick img { width: 28px; height: 28px; border-radius: 6px; flex: none; }
.pick .tier { display: block; color: var(--muted); font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem 1.25rem; }
.options label { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; font-size: 14px; }
.options input[type="number"] {
  width: 6.5rem; height: 34px; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: inherit; font: 14px var(--mono); font-variant-numeric: tabular-nums;
}
.options input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--a-soft); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.table td:last-child, .table th:last-child { text-align: right; }
.table td:last-child { font-family: var(--mono); }
.table th { color: var(--muted); font: 500 11.5px var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
button#preset, .actions button {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: var(--r-sm); cursor: pointer;
  font: 500 14px var(--sans); border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
}
.actions button:hover { filter: brightness(1.08); }
.actions button.ghost { background: var(--surface); color: var(--fg); border-color: var(--line); }
.actions button.ghost:hover { filter: none; background: var(--a-soft); border-color: var(--a-line); }
footer { max-width: 70ch; padding-inline: 4px; }

@media (max-width: 600px) {
  main { padding-top: 1.25rem; }
  main > section.result { grid-template-columns: 1fr; padding: 18px; }
  .big .value { font-size: 2.5rem; }
}

.search {
  width: 100%; max-width: 320px; height: 36px; margin-bottom: 0.75rem; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: inherit; font: 14px var(--sans);
}

/* Hub: one card per tool. */
.group { font: 500 11.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--a-ink); margin: 0.5rem 0 -0.5rem; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.tool {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
  color: inherit; text-decoration: none; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.tool:hover { border-color: var(--a-line); box-shadow: 0 10px 30px -18px var(--a); transform: translateY(-2px); }
.tool:hover b { color: var(--a-ink); }
.tool:hover .arrow { color: var(--a); }
.chef-tool::before { background: linear-gradient(90deg, var(--hue-gold), var(--a-70)); }
.chef-tool b { color: var(--gold-ink); }
.tool b { display: block; font-weight: 600; }
.tool span span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.tool .arrow { color: var(--muted); flex: none; }
