/* "Glass cockpit" design language (instagram-backup/docs/glass-cockpit.md, also the mesh_viewer theme):
   black panels, 1px gray borders, no rounding, dense spacing, one monospace font,
   color only with meaning: cyan = action / focus, green = value / state, yellow = alert / keyboard focus. */

@font-face {
  font-family: "Ioskeley Mono";
  src: url("fonts/ioskeley-mono-regular.woff2") format("woff2");
  font-display: swap;
  /* no arrows, ellipsis, geometric shapes: Ioskeley draws them two cells wide, the fallback font takes them */
  unicode-range: U+0020-007E, U+00A0-017F, U+2010-2025, U+2027-203A, U+20AC, U+2122, U+2212, U+2500-259F;
}

:root {
  color-scheme: dark;
  /* scaffolding */
  --black: #080808;
  --bg-dim: #0d0d0d;
  --gray-dark: #1f1f1f;
  --gray-mid: #404040;
  --gray-light: #666666;
  --tab: #4d4d4d;
  --text: #ffffff;
  --dim: #808080;
  --dim-on-panel: #999999;
  /* semantics */
  --action: #00ffff;
  --action-dim: #005959;
  --action-mid: #008085;
  --action-trans: rgba(0, 255, 255, 0.3);
  --toggle-on: #00616b;
  --value: #00ff00;
  --value-dim: #006600;
  --alert: #ffff00;
  --error: #ff7366;
  --link: #8cbfff;

  --mono: "Ioskeley Mono", ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --tab-h: 22px;
  --pad: 0.6rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--gray-mid) var(--black); }
body {
  margin: 0 auto;
  max-width: 64rem;
  padding: 0.75rem 0.75rem 2rem;
  background: var(--black);
  color: var(--text);
  font: 15px/1.45 var(--mono);
  font-synthesis: none;
}
::selection { background: var(--action-trans); }
h1, h2, strong, b { font-weight: normal; }
p { margin: 0.5rem 0; }
ul { margin: 0.5rem 0; padding-left: 2ch; }

a { color: var(--link); text-decoration: underline 1px; text-underline-offset: 2px; }
a:hover { background: var(--action-dim); color: var(--text); }
:focus-visible { outline: 2px solid var(--alert); outline-offset: 0; }

/* Buttons, like ImGui buttons: gray frame, cyan when hovered or pressed. */
button {
  font: inherit; color: var(--text);
  background: var(--gray-dark); border: 1px solid var(--gray-mid); border-radius: 0;
  padding: 0 0.5ch; cursor: pointer; text-transform: uppercase;
}
button:hover { background: var(--action-dim); }
button:active { background: var(--action-mid); }

/* Languages: the page holds both, the one not selected is hidden. */
html[lang="en"] body [lang="de"], html[lang="de"] body [lang="en"] { display: none !important; }
.lang-switch .l-en, .lang-switch .l-de { color: var(--dim); }
html[lang="en"] .lang-switch .l-en, html[lang="de"] .lang-switch .l-de { color: var(--value); }
.toggle .to-shell, .plain .toggle .to-plain { display: none; }
.plain .toggle .to-shell { display: inline; }

/* Menu bar, like "File | View | Help". */
.menubar { display: flex; flex-wrap: wrap; border: 1px solid var(--gray-mid); }
.menubar > * {
  margin: 0; padding: 0 1ch; line-height: 20px; font-size: inherit;
  border: 0; border-right: 1px solid var(--gray-mid); background: none;
  color: var(--text); text-decoration: none;
}
.menubar h1 { letter-spacing: 0.1em; text-transform: uppercase; }
.menubar a:not(.mail):not(.cmd) { text-transform: uppercase; }
.menubar a:hover, .menubar button:hover { background: var(--action-dim); }
.menubar .toggle { margin-left: auto; border-left: 1px solid var(--gray-mid); color: var(--dim); }
.menubar .toggle + .lang-switch, .menubar .toggle[hidden] + .lang-switch { border-right: 0; }
.menubar > a + .lang-switch { margin-left: auto; border-left: 1px solid var(--gray-mid); border-right: 0; }
/* Narrow screens: the name gets its own row, the items below fill their rows evenly.
   The 1px gaps show the gray background, so every cell has a border on all sides. */
@media (max-width: 760px) {
  .menubar { gap: 1px; background: var(--gray-mid); }
  .menubar > * { flex: 1 1 auto; text-align: center; border: 0; background: var(--black); }
  .menubar h1 { flex-basis: 100%; }
  .menubar .toggle { margin-left: 0; border: 0; }
}
.top { margin-bottom: var(--pad); }
.lead { margin: var(--pad) 0 0; }

/* Panels with a tab, like the docked ImGui windows: the selected tab is lighter gray
   with a cyan line on top, a 1px line runs under the tab bar. */
main {
  display: grid; gap: var(--pad);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  align-items: start;
}
.panel {
  border: 1px solid var(--gray-mid);
  padding: 0 var(--pad) var(--pad);
  background: linear-gradient(var(--gray-mid), var(--gray-mid)) 0 var(--tab-h) / 100% 1px no-repeat, var(--black);
  min-width: 0;
}
h2 {
  display: inline-block;
  height: var(--tab-h); line-height: calc(var(--tab-h) - 3px);
  margin: 0 0 var(--pad); padding: 3px 1ch 0;
  font-size: inherit; color: var(--text); text-transform: uppercase;
  background: linear-gradient(var(--action), var(--action)) 0 0 / 100% 3px no-repeat, var(--tab);
}
.panel > h2 { margin-left: calc(-1 * var(--pad)); }
/* Summary readout next to a tab, e.g. the number of photos in a section. */
.readout { padding-left: 1ch; color: var(--dim); }
.val { color: var(--value); }
main.single { grid-template-columns: 1fr; }

/* View switching: no JS -> plain page. JS -> shell unless the visitor chose plain view. */
.term { display: none; }
.js:not(.plain) .term { display: block; }
.js:not(.plain) .file { display: none; }
.term { grid-column: 1 / -1; }

/* Shell */
.term { min-height: 26rem; overflow-wrap: anywhere; cursor: text; }
.note { margin-top: 0; padding-bottom: var(--pad); border-bottom: 1px solid var(--gray-dark); color: var(--dim); }
.key { color: var(--action); }
.out > * { margin: 0; }
.out pre { white-space: pre-wrap; font: inherit; margin: 0; }
.out .err { color: var(--error); }
.out .dim { color: var(--dim); }
.out .ls { display: flex; flex-wrap: wrap; gap: 0 2ch; }
.out .ls .run { color: inherit; }
.out .dir { color: var(--link); }
.out .lnk { color: var(--action); }
.run { color: var(--action); cursor: pointer; text-decoration: underline dotted var(--gray-light); text-underline-offset: 2px; }
.run:hover { background: var(--action-dim); color: var(--text); }
.line { display: flex; gap: 1ch; }
.prompt { white-space: pre; }
.p-user { color: var(--value); }
.p-path { color: var(--link); }
.line input {
  flex: 1; min-width: 0;
  background: transparent; color: inherit; border: 0; outline: 0; padding: 0;
  font: inherit; caret-color: var(--action);
}

footer { margin-top: 1.5rem; color: var(--dim); }

/* Photo page: square tiles, gray until loaded, cyan border on hover. */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 4px; }
p + .gallery { margin-top: var(--pad); }
.gallery a { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--gray-mid); background: var(--gray-dark); }
.gallery a:hover { border-color: var(--action); background: var(--gray-dark); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 760px) {
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 2px; }
  .gallery a { border: 0; }
}

/* Photo viewer (photos.js): photo on black, readout bar on top, key hints below. */
.viewing { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.95);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.viewer[hidden] { display: none; }
.v-head { display: flex; min-width: 0; height: 22px; border-bottom: 1px solid var(--gray-mid); background: var(--black); white-space: nowrap; }
.v-head > * { padding: 0 1ch; line-height: 21px; }
.v-head .tab { padding-top: 1px; line-height: 20px; background: var(--tab); box-shadow: inset 0 3px 0 var(--action); }
.v-head .v-read { flex: none; }
.v-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.v-close { flex: none; margin-left: auto; height: 21px; border: 0; border-left: 1px solid var(--gray-mid); }
/* The frame has the photo's aspect ratio and fits the stage (container units), the preview
   fills it at once and the full size covers it when loaded. Clicks beside the frame close. */
/* touch-action: one-finger moves are swipes for photos.js, not page scrolling (which would cancel
   them); pinch zoom stays possible. */
.v-stage { position: relative; display: grid; place-items: center; min-height: 0; margin: 12px; container-type: size; touch-action: pinch-zoom; }
.v-frame { position: relative; width: min(100cqw, 100cqh * var(--ar, 1)); aspect-ratio: var(--ar, 1); border: 1px solid var(--gray-mid); background: #000; }
.v-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.v-step { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 56px; padding: 0; background: rgba(8, 8, 8, 0.7); }
.v-step.prev { left: 0; }
.v-step.next { right: 0; }
.v-foot { padding: 0 1ch; line-height: 22px; border-top: 1px solid var(--gray-mid); background: var(--black); color: var(--dim); }
@media (max-width: 760px) {
  .v-stage { margin: 0; }
  .v-frame { border: 0; }
  .v-step, .v-foot { display: none; }
}
