/*
 * Copyright 2026 steadfastengineering
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --ink: #39ff14;
  --muted: #1f9a32;
  --line: #14661f;
  --accent: #39ff14;
  --accent-ink: #000000;
  --plot: #000000;
  --glow: 0 0 6px rgba(57, 255, 20, 0.35);
  font-family: "Cascadia Mono", "Cascadia Code", "Consolas", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #000000;
  color: var(--ink);
  text-shadow: var(--glow);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #000000;
}

.app-header {
  padding: 0.85rem 1.25rem 0.35rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-header h1::before {
  content: "> ";
  color: var(--muted);
}

.tablist {
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  overflow-x: auto;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: #000000;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  padding: 0.7rem 1rem;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: none;
}

.tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 650;
  text-shadow: none;
}

.tab:focus-visible,
.inputs input:focus-visible,
.inputs button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.panels {
  flex: 1;
  min-height: 0;
  background: #000000;
}

.panel {
  padding: 1rem;
}

.split {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.inputs {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: min(100%, 22rem);
  flex: 0 0 22rem;
}

.inputs label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.inputs input,
.inputs button,
.results,
.plot,
.empty {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000000;
  color: var(--ink);
}

.inputs input,
.inputs button {
  font: inherit;
  padding: 0.55rem 0.7rem;
}

.inputs input {
  text-transform: none;
  letter-spacing: 0;
  caret-color: var(--accent);
}

.inputs input::placeholder {
  color: var(--muted);
}

.inputs button {
  align-self: flex-start;
  background: #000000;
  color: var(--accent);
  border-color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: var(--glow);
}

.inputs button:hover {
  background: var(--accent);
  color: var(--accent-ink);
  text-shadow: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.results,
.formula-box,
.empty {
  padding: 0.9rem 1rem;
  color: var(--muted);
  background: #000000;
  width: 100%;
}

.results {
  flex: 1;
  min-height: 8rem;
}

.formula-box {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: pre-line;
}

.results:empty::before {
  content: "Results appear here after Update";
}

.results p {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: none;
}

.results strong {
  display: block;
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  text-shadow: var(--glow);
}

.results strong:last-child {
  margin-bottom: 0;
}

.empty {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 16rem;
  background: #000000;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plot {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.6rem 0.7rem 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
}

.plot-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: none;
}

.plot svg {
  
  width: 100%;
  height: min(36rem, calc(100vh - 8rem));
  text-shadow: none;
}

.tire-views {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2rem;
  flex: 1;
  min-height: 0;
  padding: 0.5rem 0;
}

.tire-views svg {
  height: 100%;
  max-height: 24rem;
  width: 100%;
}

.plot-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: none;
}

.plot-key li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 1.1rem;
  height: 0.12rem;
  background: currentColor;
}

.swatch.frame { background: #00ffcc; }
.swatch.axle { background: #39ff14; }
.swatch.link { background: #c084fc; }
.swatch.sagitta-radius { background: #00ffcc; }
.swatch.sagitta-chord { background: #ff5c5c; }
.swatch.sagitta-height { background: #c084fc; }

.input-error {
  color: #ff8c00;
  font-size: 0.9rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  display: inline-block;
}

@media (max-aspect-ratio: 1 / 1) {
  .split {
    flex-direction: column;
  }

  .inputs,
  .results,
  .formula-box,
  .plot {
    width: 100%;
    flex-basis: auto;
  }

  .plot svg {
    height: min(30rem, 78vh);
  }
}
