/* SchemAccess Web — Virginia Tech senior design.
   Chicago Maroon carries structure and every link; Burnt Orange is a
   graphic accent only (too light to read as body text on white); Hokie
   Stone grey does the quiet work.  Square corners, real rules, no
   gradients: the contrast has to hold for the same people the alt text
   is written for. */

:root {
  /* Virginia Tech primary palette */
  --maroon:       #861F41;   /* Chicago Maroon */
  --maroon-deep:  #630F2D;
  --orange:       #E5751F;   /* Burnt Orange - graphic use */
  --orange-ink:   #9A4A0C;   /* a readable orange, for text */
  --stone:        #75787B;   /* Hokie Stone grey */

  --paper:        #F6F5F3;
  --surface:      #FFFFFF;
  --surface-sunk: #FAF9F8;
  --ink:          #1C1C1E;
  --ink-soft:     #45464A;
  --ink-muted:    #5F6165;
  --ink-faint:    var(--stone);
  --rule:         #DEDCD8;
  --rule-strong:  #C3C1BC;
  --hair:         #ECEAE6;

  --accent:       var(--maroon);
  --accent-deep:  var(--maroon-deep);
  --accent-tint:  #F7EFF2;
  --accent-edge:  #E6D2DA;
  --accent-band:  #F8F1F4;
  --accent-band-edge: #E7D5DC;

  --amber:        var(--orange);
  --amber-ink:    var(--orange-ink);
  --amber-tint:   #FDF4EB;
  --amber-edge:   #F2DCC3;

  --danger:       #9B2226;
  --danger-tint:  #FBEFEF;
  --danger-edge:  #EDD3D3;

  /* Atkinson Hyperlegible was drawn by the Braille Institute to be
     legible at low vision: unambiguous a/g, distinguishable l/I/1.  For
     a tool whose whole purpose is making circuits readable, it is the
     honest choice, and it carries headings and body alike so the page
     never needs a second voice. */
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: var(--sans);
  --mono: "IBM Plex Mono", Consolas, ui-monospace, "SFMono-Regular", monospace;

  --shell-pad: 40px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Maroon goes muddy on a dark ground, so the accent lightens to a
       tint of the same hue rather than changing family. */
    --maroon:       #D4839A;
    --maroon-deep:  #EDA8BB;
    --orange:       #EE9247;
    --orange-ink:   #F0A868;
    --stone:        #8E9194;

    --paper:        #17181A;
    --surface:      #1E2022;
    --surface-sunk: #1A1C1E;
    --ink:          #E8E6E3;
    --ink-soft:     #C7C5C1;
    --ink-muted:    #9B9C9E;
    --ink-faint:    var(--stone);
    --rule:         #313337;
    --rule-strong:  #414449;
    --hair:         #26282B;

    --accent-tint:  #2A1B21;
    --accent-edge:  #4A2E38;
    --accent-band:  #26191E;
    --accent-band-edge: #3D2831;

    --amber-tint:   #251C13;
    --amber-edge:   #453421;

    --danger:       #E0817E;
    --danger-tint:  #2A1B1B;
    --danger-edge:  #4A2E2E;
  }
}

/* A two-tone rule across the top of the page: Burnt Orange leader into
   Chicago Maroon.  It stands in for the university mark rather than
   redrawing it - drop in the real logo from Virginia Tech's brand assets
   once the team is cleared to use it. */
.brandbar {
  display: flex;
  height: 5px;
  flex-shrink: 0;
}
.brandbar span:first-child { width: 104px; background: #E5751F; }
.brandbar span:last-child { flex-grow: 1; background: #861F41; }

* { box-sizing: border-box; }

/* Several regions below are flex containers, and an author `display`
   beats the user-agent rule that makes [hidden] disappear.  Without this
   the whole app would render at once, stacked. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- shell */

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--shell-pad);
  height: 68px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.wordmark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  color: var(--maroon);
}


.masthead-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.masthead-right { display: flex; align-items: center; gap: 20px; }

.filechip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-soft);
  min-width: 0;
}
.filechip .name {
  font-family: var(--mono);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tagline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.nav-link { font-size: 14px; color: var(--ink-muted); }

/* --------------------------------------------------------------- buttons */

button { font: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 9px 16px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--ink-muted); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  color: #FFFFFF;
  background: #861F41;
  border-color: #861F41;
  padding: 12px 24px;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.btn-primary:hover:not(:disabled) {
  background: #630F2D;
  border-color: #630F2D;
}

.btn-small { font-size: 13px; padding: 7px 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink-soft);
}
.icon-btn:hover { border-color: var(--ink-muted); }

.segmented { display: inline-flex; border-radius: 2px; }
.segmented button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-left: none;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.segmented button:first-child { border-left: 1px solid var(--rule-strong); }
.segmented button[aria-pressed="true"] {
  background: #861F41;
  color: #FFFFFF;
  border-color: #861F41;
}

/* ---------------------------------------------------------------- upload */

/* The landing page has one job.  Everything the tool can do is visible
   the moment a file is dropped, so nothing here describes it in advance. */
.upload {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px var(--shell-pad) 72px;
}

.upload-inner {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* A small monospace tag rather than an icon. */
.label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.dropzone {
  border: 1px dashed var(--rule-strong);
  border-left: 3px solid var(--maroon);
  background: var(--surface);
  padding: 24px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 120ms, background 120ms;
}
.dropzone.is-over {
  border-color: var(--maroon);
  background: var(--accent-tint);
}

.dropzone-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.dropzone-hint { font-size: 14px; color: var(--ink-muted); }
.filetype {
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 2px 6px;
  margin-left: 2px;
}

.examples {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 4px 14px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
}
.examples button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.examples button:hover { color: var(--accent-deep); }

/* -------------------------------------------------------------- boot bar */

.boot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--accent-band-edge);
  background: var(--accent-band);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.boot.is-ready { border-color: var(--rule); background: var(--surface); color: var(--ink-faint); }
.boot.is-failed { border-color: var(--danger-edge); background: var(--danger-tint); color: var(--ink); }

.spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--accent-edge);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ------------------------------------------------------------- workspace */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px var(--shell-pad);
  min-height: 54px;
  flex-shrink: 0;
  background: var(--accent-band);
  border-bottom: 1px solid var(--accent-band-edge);
  font-size: 14.5px;
}
.statusbar.is-warn { background: var(--amber-tint); border-bottom-color: var(--amber-edge); }
.statusbar.is-error { background: var(--danger-tint); border-bottom-color: var(--danger-edge); }
.statusbar-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.statusbar-right { display: flex; align-items: center; gap: 18px; font-size: 13.5px; flex-shrink: 0; }
.notes-count { display: inline-flex; align-items: center; gap: 7px; color: var(--amber-ink); }
.notes-count[hidden] { display: none; }

.workspace-view {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace {
  flex-grow: 1;
  display: flex;
  gap: 24px;
  padding: 24px var(--shell-pad) 32px;
  min-height: 0;
  align-items: stretch;
}

.panel-column {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
  overflow-x: auto;
}
.tabs button {
  padding: 11px 20px;
  font-size: 14.5px;
  color: var(--ink-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.panel {
  flex-grow: 1;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 12px; }
.toolbar-label { font-size: 13px; color: var(--ink-muted); }

.panel-body { flex-grow: 1; min-height: 0; overflow: auto; }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  min-height: 46px;
  border-top: 1px solid var(--hair);
  background: var(--paper);
  font-size: 12.5px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* preview */

.preview-stage {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 40px;
  color: var(--ink);
}
.preview-stage svg {
  max-width: 100%;
  height: auto;
  transform-origin: center;
}

.zoom { display: flex; align-items: center; gap: 6px; }
.zoom .level {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  width: 46px;
  text-align: center;
}
.icon-btn.square { width: 28px; height: 28px; }

/* code */

.code {
  display: flex;
  min-height: 100%;
  background: var(--surface-sunk);
}
.code .gutter {
  padding: 18px 12px 18px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--ink-faint);
  opacity: 0.6;
  text-align: right;
  border-right: 1px solid var(--hair);
  user-select: none;
  white-space: pre;
  flex-shrink: 0;
}
.code pre {
  margin: 0;
  padding: 18px 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--ink);
  white-space: pre;
}

/* description */

.prose {
  padding: 26px 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.prose p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.72;
  max-width: 78ch;
}
.prose h3 {
  margin: 14px 0 2px;
  font-size: 15px;
  color: var(--ink-muted);
}

/* report */

.report { padding: 26px 32px 30px; display: flex; flex-direction: column; gap: 26px; }
.report h3 { font-size: 17px; margin-bottom: 12px; }
.report h3 .count {
  font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--ink-faint);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .n {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat .l { font-size: 12.5px; color: var(--ink-faint); }

.note-list { display: flex; flex-direction: column; gap: 8px; }
.note {
  display: flex;
  gap: 13px;
  padding: 13px 16px;
  background: var(--accent-band);
  border: 1px solid var(--accent-band-edge);
}
.note.warn { background: var(--amber-tint); border-color: var(--amber-edge); }
.note svg { flex-shrink: 0; margin-top: 2px; }
.note .body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.note .t { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.note .d { font-size: 13.2px; line-height: 1.55; color: var(--ink-soft); }

.empty-note {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 13.5px; color: var(--ink-muted);
  padding: 12px 16px; border: 1px solid var(--rule); background: var(--paper);
}

/* notes strip under a panel body */

.strip {
  border-top: 1px solid var(--amber-edge);
  background: var(--amber-tint);
  padding: 12px 20px 14px;
  display: flex;
  gap: 11px;
  flex-shrink: 0;
}
.strip svg { flex-shrink: 0; margin-top: 2px; }
.strip ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 5px; }
.strip li { font-size: 12.8px; line-height: 1.55; color: var(--ink-soft); }

/* ------------------------------------------------------------------ rail */

.rail {
  width: 356px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.rail-card { background: var(--surface); border: 1px solid var(--rule); }
.rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 15px 18px 11px; border-bottom: 1px solid var(--hair);
}
.rail-head h2 { font-size: 17px; }
.rail-head span { font-size: 12.5px; color: var(--ink-faint); }
.rail-body { padding: 15px 18px 17px; display: flex; flex-direction: column; gap: 10px; }
.rail-body h2 { font-size: 16px; }
.rail-body p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-muted); }

.filerow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--hair);
}
.filerow:last-of-type { border-bottom: none; }
.filerow .ext {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent-edge);
  padding: 3px 6px;
  border-radius: 2px;
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.filerow .meta { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.filerow .meta .n {
  font-family: var(--mono); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filerow .meta .s { font-size: 11.5px; color: var(--ink-faint); }

.rail-foot { padding: 14px 18px 16px; border-top: 1px solid var(--hair); }

/* ---------------------------------------------------------------- toasts */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 2px;
  font-size: 13.5px;
  z-index: 40;
}
@media (prefers-color-scheme: dark) { .toast { color: #14161A; } }

/* -------------------------------------------------------------- narrower */

@media (max-width: 1180px) {
  :root { --shell-pad: 24px; }
  .workspace { flex-direction: column; }
  .rail { width: auto; }
  .panel-column { min-height: 460px; }
}

@media (max-width: 720px) {
  .upload { padding: 28px var(--shell-pad) 40px; }
  .masthead { height: auto; padding: 12px var(--shell-pad); flex-wrap: wrap; }
}

/* The PDF the LaTeX engine produced, shown in the browser's own viewer. */
.pdf-view {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: none;
  background: #fff;
}

.latex-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* Shown while pdflatex is working; deliberately not a drawing. */
.rendering {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
}
.rendering p { margin: 0; font-size: 15px; }
.rendering .spinner { width: 22px; height: 22px; border-width: 3px; }
.rendering-note {
  max-width: 46ch;
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.6;
}
