/*
 * Compressible Flow Calculator presentation layer
 * Author: Anthony Spohn
 *
 * The stylesheet is organized from global theme variables to page layout,
 * reusable controls, result tables, messages, and footer presentation.
 */

/* ---------- Light-theme design tokens shared throughout the application ---------- */
:root{
    --bg:#eef1ee;
    --surface:#ffffff;
    --surface-2:#f5f7f4;
    --ink:#151b1f;
    --ink-dim:#5c6b66;
    --line:#d2d8d0;
    --line-strong:#b7c0b6;
    --accent:#c1531f;
    --accent-ink:#fffaf6;
    --accent-2:#256d8a;
    --mono-bg:#e7ebe4;
    --danger:#a4342a;
    --danger-bg:#f8e6e2;
    --radius:10px;
    --shadow:0 1px 2px rgba(21,27,31,0.06), 0 6px 18px rgba(21,27,31,0.06);
    color-scheme: light;
  }
/* Follow the operating-system dark theme unless light mode is explicitly requested. */
@media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]){
      --bg:#10151a;
      --surface:#171d23;
      --surface-2:#1c232a;
      --ink:#e7ece7;
      --ink-dim:#8fa39c;
      --line:#2b343b;
      --line-strong:#3a444c;
      --accent:#e2814c;
      --accent-ink:#1a1108;
      --accent-2:#5fabd0;
      --mono-bg:#1e262d;
      --danger:#e2695c;
      --danger-bg:#3a1f1c;
      --shadow:0 1px 2px rgba(0,0,0,0.4), 0 10px 26px rgba(0,0,0,0.4);
      color-scheme: dark;
    }
  }
/* Explicit dark-theme values are retained for a future manual theme control. */
:root[data-theme="dark"]{
    --bg:#10151a;
    --surface:#171d23;
    --surface-2:#1c232a;
    --ink:#e7ece7;
    --ink-dim:#8fa39c;
    --line:#2b343b;
    --line-strong:#3a444c;
    --accent:#e2814c;
    --accent-ink:#1a1108;
    --accent-2:#5fabd0;
    --mono-bg:#1e262d;
    --danger:#e2695c;
    --danger-bg:#3a1f1c;
    --shadow:0 1px 2px rgba(0,0,0,0.4), 0 10px 26px rgba(0,0,0,0.4);
    color-scheme: dark;
  }

/* ---------- Global page foundation ---------- */
*{box-sizing:border-box;}
body{
    margin:0;
    background:var(--bg);
    color:var(--ink);
    font-family:'Public Sans', system-ui, sans-serif;
    padding:28px 16px 56px;
  }
  .wrap{ max-width:1040px; margin:0 auto; }

/* ---------- Header, title, and global gamma control ---------- */
header.top{
    display:flex; flex-wrap:wrap; gap:18px 28px;
    align-items:flex-end; justify-content:space-between;
    border-bottom:2px solid var(--line-strong);
    padding-bottom:18px; margin-bottom:22px;
  }
  .brand-eyebrow{
    font-family:'IBM Plex Mono', monospace;
    font-size:11.5px; letter-spacing:0.14em; text-transform:uppercase;
    color:var(--accent-2); font-weight:600; margin:0 0 6px;
  }
  h1{
    font-family:'Archivo', sans-serif; font-weight:800;
    font-size:clamp(24px,3.4vw,32px); letter-spacing:-0.01em;
    margin:0; text-wrap:balance; color:var(--ink);
  }
  .sub{ font-size:13.5px; color:var(--ink-dim); margin:6px 0 0; max-width:66ch; }

/* Gamma is global to the compressible-flow relation panels. */
.gamma-box{
    display:flex; align-items:center; gap:10px;
    background:var(--surface); border:1px solid var(--line-strong);
    border-radius:var(--radius); padding:10px 14px; box-shadow:var(--shadow);
    flex-shrink:0;
  }
  .gamma-box label{
    font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--ink-dim);
    display:flex; flex-direction:column; gap:2px; letter-spacing:.02em;
  }
  .gamma-box label b{ font-size:16px; color:var(--ink); font-style:italic; }
  .gamma-box input{
    width:88px; font-family:'IBM Plex Mono',monospace; font-size:16px;
    font-weight:600; padding:6px 8px; border-radius:7px;
    border:1px solid var(--line-strong); background:var(--surface-2); color:var(--ink);
  }
  .gamma-presets{ display:flex; flex-direction:column; gap:4px; }
  .gamma-presets button{
    font-family:'IBM Plex Mono',monospace; font-size:10.5px;
    border:1px solid var(--line); background:var(--surface-2); color:var(--ink-dim);
    border-radius:5px; padding:2px 6px; cursor:pointer;
  }
  .gamma-presets button:hover{ border-color:var(--accent-2); color:var(--accent-2); }

/* ---------- Calculator-mode tab navigation ---------- */
nav.tabs{
    display:flex; gap:6px; flex-wrap:wrap; margin-bottom:22px;
  }
  nav.tabs button{
    font-family:'Archivo', sans-serif; font-weight:700; font-size:13.5px;
    color:var(--ink-dim); background:var(--surface);
    border:1px solid var(--line); border-bottom:3px solid transparent;
    border-radius:8px 8px 0 0; padding:10px 16px; cursor:pointer;
    transition:color .12s, border-color .12s, background .12s;
  }
  nav.tabs button .t-sym{ font-family:'IBM Plex Mono',monospace; font-weight:500; color:var(--accent-2); margin-right:7px; }
  nav.tabs button:hover{ color:var(--ink); }
  nav.tabs button.active{
    color:var(--ink); background:var(--surface-2);
    border-color:var(--line-strong); border-bottom-color:var(--accent);
  }

/* Only the panel associated with the active tab is displayed. */
.panel{ display:none; }
  .panel.active{ display:block; }

/* ---------- Responsive two-column calculator layout ---------- */
.layout{
    display:grid; grid-template-columns:280px minmax(0,1fr);
    gap:20px; align-items:start;
  }
  @media (max-width:680px){ .layout{ grid-template-columns:1fr; } }

/* ---------- Shared card presentation ---------- */
.card{
    background:var(--surface); border:1px solid var(--line);
    border-radius:var(--radius); box-shadow:var(--shadow);
  }
  .card-head{
    font-family:'Archivo',sans-serif; font-weight:700; font-size:13px;
    letter-spacing:.06em; text-transform:uppercase; color:var(--ink-dim);
    padding:13px 16px; border-bottom:1px solid var(--line);
  }
  .card-body{ padding:16px; display:flex; flex-direction:column; gap:14px; }

/* ---------- Form fields, branch selectors, and calculate buttons ---------- */
.field label{
    display:block; font-size:12.5px; font-weight:600; color:var(--ink);
    margin-bottom:5px;
  }
  .field select, .field input[type=number]{
    width:100%; font-family:'IBM Plex Mono',monospace; font-size:14.5px;
    padding:8px 10px; border-radius:7px; border:1px solid var(--line-strong);
    background:var(--surface-2); color:var(--ink);
  }
  .field select:focus, .field input:focus, .gamma-box input:focus{
    outline:2px solid var(--accent-2); outline-offset:1px;
  }
  .field .hint{ font-size:11.5px; color:var(--ink-dim); margin-top:4px; line-height:1.4; }

  .radio-row{ display:flex; gap:14px; flex-wrap:wrap; }
  .radio-row label{
    display:flex; align-items:center; gap:6px; font-size:13px; font-weight:500;
    color:var(--ink); cursor:pointer; margin:0;
  }
  .radio-row input{ accent-color:var(--accent); }

  .calc-btn{
    font-family:'Archivo',sans-serif; font-weight:700; font-size:13.5px;
    letter-spacing:.02em; background:var(--accent); color:var(--accent-ink);
    border:none; border-radius:7px; padding:10px 14px; cursor:pointer;
  }
  .calc-btn:hover{ filter:brightness(1.06); }

/* ---------- Result cards and tabular numerical output ---------- */
.result-card{
    width:100%; max-width:520px;
  }
  .result-head{
    display:flex; align-items:baseline; justify-content:space-between;
    gap:10px; padding:13px 16px; border-bottom:1px solid var(--line);
    flex-wrap:wrap;
  }
  .result-head .name{
    font-family:'Archivo',sans-serif; font-weight:700; font-size:13px;
    letter-spacing:.06em; text-transform:uppercase; color:var(--ink-dim);
  }
  .result-head .echo{
    font-family:'IBM Plex Mono',monospace; font-size:12.5px; color:var(--accent-2);
    font-variant-numeric:tabular-nums;
  }
  table.results{
    width:100%; border-collapse:collapse; font-family:'IBM Plex Mono',monospace;
  }
  table.results td{
    padding:9px 16px; border-bottom:1px solid var(--line); font-size:14px;
    font-variant-numeric:tabular-nums; vertical-align:baseline;
  }
  table.results tr:last-child td{ border-bottom:none; }
  table.results td.lbl{
    font-family:'Public Sans',sans-serif; font-weight:600; font-size:12.8px;
    color:var(--ink); white-space:nowrap;
  }
  table.results td.lbl .sym{ color:var(--ink-dim); font-family:'IBM Plex Mono',monospace; font-weight:400; margin-left:5px; font-size:11.5px; }
  table.results td.val{
    text-align:right; font-weight:600; color:var(--ink); background:var(--mono-bg);
    width:42%;
  }
  table.results tr.hi td.val{ color:var(--accent); }
  table.results tr.input-row td.val{ color:var(--accent-2); }

/* Informational and validation messages displayed beneath result tables. */
.note{
    margin:0; padding:11px 14px; border-radius:8px; font-size:12.5px;
    line-height:1.5; background:var(--surface-2); color:var(--ink-dim);
    border:1px dashed var(--line-strong);
  }
  .note.warn{ background:var(--danger-bg); color:var(--danger); border-style:solid; border-color:var(--danger); }

/* ---------- Technical assumptions and references ---------- */
.assumptions {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
}

.assumptions strong {
  color: var(--ink);
  font-weight: 600;
}

.assumptions-reference {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---------- Author and copyright footer ---------- */
.site-footer {
  margin-top: 20px;
  padding: 18px 12px 8px;
  color: var(--ink-dim);
  font-family: "Source Sans 3", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.footer-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.footer-copyright {
  margin-top: 5px;
  font-size: 11.5px;
}

/* New application tabs only; original panel styles remain unchanged. */
.new-flow .new-status { padding: 14px 16px 0; font-weight: 600; line-height: 1.5; }
.new-flow .new-status.new-error { color: #b42318; }
.new-flow .new-note { padding: 0 16px 16px; }
.new-flow .new-table-scroll { overflow-x: auto; }
.new-flow .new-stations { width: 100%; border-collapse: collapse; font-size: 12px; }
.new-flow .new-stations th, .new-flow .new-stations td { padding: 9px 10px; border-bottom: 1px solid #dce3e8; text-align: right; white-space: nowrap; }
.new-flow .new-stations th:first-child, .new-flow .new-stations td:first-child { text-align: left; }
.new-flow .new-stations caption { padding: 14px 16px 8px; text-align: left; font-weight: 600; }

.new-flow .result-card { min-width: 0; }

/* ---------- Link back to the Aero Design Analysis home page ---------- */
.site-home{
  display:inline-block; margin:0 0 14px;
  font-family:'IBM Plex Mono', monospace; font-size:12px; letter-spacing:.04em;
  color:var(--accent-2); text-decoration:none;
}
.site-home:hover{ text-decoration:underline; }
