/* t3r.dev: a terminal with an Oh My Posh prompt.
   Colors follow the original site's Shoelace palette: amber + cyan powerline segments,
   amber links, on a dark (or light) ground. */

@font-face {
  font-family: "Fira Code";
  src: url("../fonts/fira-code.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0e0e11;
  --bar: #1c1c21;
  --ink: #e4e4e7;
  --ink-bright: #fafafa;
  --ink-dim: #a1a1aa;

  --amber: #f59e0b;
  --amber-text: #fbbf24;
  --cyan: #22d3ee;
  --green: #4ade80;
  --violet: #a78bfa;
  --pink: #f472b6;
  --red: #f87171;

  --seg-user: #f59e0b;
  --seg-user-ink: #18181b;
  --seg-path: #22d3ee;
  --seg-path-ink: #0b2a31;

  --link: var(--amber-text);
  --select: rgb(34 211 238 / 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #fafafa;
  --bar: #e4e4e7;
  --ink: #27272a;
  --ink-bright: #09090b;
  --ink-dim: #52525b;

  --amber: #f59e0b;
  --amber-text: #b45309;
  --cyan: #0e7490;
  --green: #15803d;
  --violet: #6d28d9;
  --pink: #be185d;
  --red: #dc2626;

  --seg-user: #f59e0b;
  --seg-user-ink: #18181b;
  --seg-path: #06b6d4;
  --seg-path-ink: #082f36;

  --link: var(--amber-text);
  --select: rgb(6 182 212 / 0.25);
}

:root {
  --font: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs: 16px;
  --lh: 26px;
  --bar-h: 44px;
}
@media (max-width: 600px) {
  :root {
    --fs: 14px;
    --lh: 23px;
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* which version is showing */
:root[data-mode="normie"] #nerd,
:root[data-mode="nerd"] #normie {
  display: none;
}

:root[data-mode="nerd"] {
  background: var(--ground);
  scroll-padding-bottom: calc(var(--bar-h) + var(--lh));
}

body {
  margin: 0;
}

:root[data-mode="nerd"] body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  -webkit-text-size-adjust: 100%;
  font-feature-settings: "calt" 1, "liga" 1; /* Fira's programming ligatures: != => -> */
}

/* ASCII art and dot leaders must stay literal */
.figlet,
.kv .dots {
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
}

:root[data-mode="nerd"] ::selection {
  background: var(--select);
  color: var(--ink-bright);
}

p,
pre,
ul,
ol,
dl,
dd,
h1,
h2,
h3 {
  margin: 0;
  font: inherit;
}

:where(#nerd) a,
.run {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.run {
  font: inherit;
  line-height: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:where(#nerd) a:hover,
.run:hover {
  background: var(--amber);
  color: var(--seg-user-ink);
  text-decoration: none;
}

:where(#nerd) :focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 20;
  background: var(--seg-user);
  color: var(--seg-user-ink);
  padding: 0 1ch;
}
.skip:focus {
  top: 8px;
}

/* ---------- the screen ---------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--lh) * 2) clamp(16px, 4vw, 64px) calc(var(--bar-h) + var(--lh) * 3 + env(safe-area-inset-bottom));
}

.sheet {
  max-width: 100ch;
}

/* ---------- powerline segments ---------- */

.pl {
  display: inline-flex;
  align-items: stretch;
  vertical-align: top;
  white-space: nowrap;
  margin-right: calc(var(--lh) / 2 + 1ch);
}
.pl-arrow {
  color: var(--green);
  margin-right: 1ch;
  font-weight: 700;
}
.seg {
  position: relative;
  padding: 0 0.9ch 0 calc(var(--lh) / 2 + 0.6ch);
  font-weight: 600;
}
.seg:first-of-type {
  padding-left: 1ch;
}
/* the powerline chevron: a triangle the colour of the segment, overlapping the next one */
.seg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: calc(var(--lh) / 2);
  height: 100%;
  background: inherit;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.seg-user {
  z-index: 2;
  background: var(--seg-user);
  color: var(--seg-user-ink);
}
.seg-path {
  z-index: 1;
  background: var(--seg-path);
  color: var(--seg-path-ink);
}
.seg-sauce {
  z-index: 2;
  background: var(--violet);
  color: #12101c;
}
.tryme-tag {
  background: var(--seg-user);
  color: var(--seg-user-ink);
  font-weight: 700;
  padding: 0 1ch;
}
.ps1-sym {
  color: var(--ink-bright);
  font-weight: 700;
}

/* ---------- output ---------- */

.out > * {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.blank {
  height: var(--lh);
}

.dim {
  color: var(--ink-dim);
}
.bright,
b,
strong {
  color: var(--ink-bright);
  font-weight: 700;
}
.err {
  color: var(--red);
}
.c-cyan {
  color: var(--cyan);
}
.c-amber {
  color: var(--amber-text);
}
.c-green {
  color: var(--green);
}
.c-violet {
  color: var(--violet);
}
.nowrap {
  white-space: nowrap;
}
.tag {
  background: var(--seg-path);
  color: var(--seg-path-ink);
  font-weight: 600;
  padding: 0 1ch;
}

/* figlet banner */
.banner .figlet {
  white-space: pre;
  overflow: hidden;
  color: var(--cyan);
  font-weight: 500;
  font-size: calc(var(--fs) * 1.6);
  line-height: 1.4; /* Fira's tall pipes need air between rows or the letters fuse */
  padding-bottom: calc(var(--lh) / 2);
}
.figlet.small {
  color: var(--ink);
  font-size: inherit;
  line-height: inherit;
  font-weight: 400;
}

.name-hi {
  color: var(--ink-bright);
  font-weight: 700;
}

.cmds {
  display: flex;
  flex-wrap: wrap;
  column-gap: 3ch;
  padding-left: 2ch;
}

/* key ........ value rows (from the original site) */
.kv {
  display: flex;
  gap: 1ch;
  white-space: nowrap;
  max-width: 64ch;
}
.kv .k {
  flex: none;
  font-weight: 700;
  color: var(--ink-bright);
}
.kv .dots {
  flex: 1 1 2ch;
  min-width: 2ch;
  overflow: hidden;
  color: var(--ink-dim);
}
.kv .dots::before {
  content: "................................................................................";
}
.kv .v {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* help table */
.table {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 3ch;
  padding-left: 2ch;
}
.table > * {
  white-space: normal;
}

/* neofetch */
.fetch {
  display: flex;
  flex-wrap: wrap;
  column-gap: 4ch;
}
.fetch .logo .figlet {
  font-size: inherit;
  line-height: inherit;
  padding: 0;
}
.fetch .info {
  min-width: 0;
  flex: 1 1 36ch;
  white-space: normal;
}
.fetch .info .k {
  color: var(--amber-text);
  font-weight: 700;
}
.swatches {
  display: flex;
  margin-top: var(--lh);
}
.swatches span {
  width: 3ch;
  height: var(--lh);
}

/* ls -l of projects */
.ls-l {
  display: grid;
  grid-template-columns: max-content max-content max-content 1fr;
  column-gap: 2ch;
}
.ls-l > * {
  white-space: normal;
}
.ls-grid {
  display: flex;
  flex-wrap: wrap;
  column-gap: 3ch;
}
.ls-grid .dir .run,
.ls-l .dir .run {
  color: var(--cyan);
  font-weight: 700;
}

/* man pages */
.man-head {
  display: flex;
  justify-content: space-between;
  max-width: 80ch;
}
.man-h {
  color: var(--cyan);
  font-weight: 700;
}
.man-b {
  padding-left: 7ch;
  max-width: 79ch;
  white-space: normal;
}
.man-b .sub {
  padding-left: 4ch;
}
.man-b .li {
  padding-left: 6ch;
  text-indent: -2ch;
}
.man-b .li::first-letter {
  color: var(--amber-text);
}

.para {
  max-width: 72ch;
  white-space: normal;
}
.li-num {
  max-width: 80ch;
  padding-left: 4ch;
  text-indent: -4ch;
  white-space: pre-wrap;
}
.work-l {
  grid-template-columns: max-content 1fr;
}

@media (max-width: 600px) {
  .fetch .logo,
  .man-head .mid,
  .ls-l .perm,
  .ls-l .year {
    display: none;
  }
  .ls-l {
    grid-template-columns: max-content 1fr;
  }
  .man-b {
    padding-left: 3ch;
  }
  .man-b .sub {
    padding-left: 2ch;
  }
  .man-b .li {
    padding-left: 4ch;
  }
  .table {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
  .table .desc {
    padding-left: 2ch;
  }
  .cmds {
    padding-left: 0;
  }
}

/* ---------- the prompt ---------- */

.prompt {
  display: flex;
  align-items: flex-start;
  margin: 0;
}
.ps1 {
  flex: none;
  white-space: nowrap;
}
.field {
  position: relative;
  flex: 1;
  min-width: 0;
}
.echo {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#cmd {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-family: var(--font);
  font-size: max(16px, var(--fs)); /* stops iOS zooming on focus */
  opacity: 0;
}
#cmd:focus-visible {
  outline: none;
}

.cursor {
  display: inline-block;
  min-width: 1ch;
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}
.prompt.is-focused .cursor {
  outline: none;
  background: var(--cyan);
  color: var(--ground);
  animation: blink 1.06s steps(1) infinite;
}
.prompt.is-busy .cursor {
  animation: none;
}
@keyframes blink {
  50% {
    background: transparent;
    color: inherit;
  }
}

/* ---------- status line (the navigation) ---------- */

.tmux {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 1ch;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 0 clamp(0px, 4vw, 64px) env(safe-area-inset-bottom) 0;
  background: var(--bar);
  color: var(--ink);
  white-space: nowrap;
  font-size: var(--fs);
}
.tmux-session {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 0 1.5ch 0 clamp(16px, 4vw, 64px);
  margin-right: calc(var(--bar-h) / 2);
  background: var(--seg-user);
  color: var(--seg-user-ink);
  font-weight: 700;
}
.tmux-windows {
  display: flex;
  min-width: 0;
  padding: 0;
  margin: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.tmux a,
.tmux button {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  min-height: 44px;
  padding: 0 1.2ch;
  color: inherit;
  text-decoration: none;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.tmux a:hover {
  background: none;
  color: var(--ink-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tmux a[aria-current="page"] {
  background: var(--seg-path);
  color: var(--seg-path-ink);
  font-weight: 700;
  text-decoration: none;
}
.tmux-n {
  color: var(--ink-dim);
}
.tmux a[aria-current="page"] .tmux-n {
  color: inherit;
}
.tmux :focus-visible {
  outline-offset: -3px;
}
.tmux-theme {
  margin-left: auto;
  gap: 0.5ch;
  color: var(--ink-dim) !important;
}
.tmux-theme [data-theme-label] {
  padding: 0 0.6ch;
}
:root[data-theme="dark"] .tmux-theme [data-theme-label="dark"],
:root[data-theme="light"] .tmux-theme [data-theme-label="light"] {
  background: var(--seg-user);
  color: var(--seg-user-ink);
  font-weight: 700;
}

/* 🤓 / 🙂: which version of the site */
.modeswitch {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 1ch;
}
.tmux .modeswitch button {
  min-width: 40px;
  justify-content: center;
  padding: 0 0.6ch;
  font-size: 18px;
  filter: grayscale(1);
  opacity: 0.55;
}
.tmux .modeswitch button[aria-pressed="true"] {
  filter: none;
  opacity: 1;
  background: var(--seg-path);
}
.tmux .modeswitch button:hover {
  opacity: 1;
  filter: none;
}

/* the session segment's chevron runs into the bar */
.tmux-session::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: calc(var(--bar-h) / 2);
  height: var(--bar-h);
  background: inherit;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

@media (max-width: 600px) {
  .tmux {
    padding-right: 8px;
    gap: 0;
  }
  .tmux-session {
    padding-left: 12px;
    padding-right: 0.5ch;
  }
  .tmux-n {
    display: none;
  }
  .tmux a,
  .tmux button {
    padding: 0 0.7ch;
  }
}
@media (max-width: 600px) {
  .tmux-session {
    display: none;
  }
  .tmux-theme {
    display: none !important; /* theme stays reachable with the `theme` command */
  }
  .tmux .modeswitch {
    margin-left: auto;
  }
  .tmux .modeswitch button {
    min-width: 36px;
    font-size: 16px;
  }
  /* show only the active theme; tapping it flips */
  .tmux-theme > [aria-hidden],
  :root[data-theme="dark"] .tmux-theme [data-theme-label="light"],
  :root[data-theme="light"] .tmux-theme [data-theme-label="dark"] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prompt.is-focused .cursor {
    animation: none;
  }
}

/* ---------- print: a clean copy of whatever is on screen (the resume, usually) ---------- */

@media print {
  :root,
  :root[data-theme] {
    --ground: #fff;
    --ink: #111;
    --ink-bright: #000;
    --ink-dim: #444;
    --link: #000;
    --cyan: #000;
    --amber-text: #000;
    --red: #000;
    --fs: 10pt;
    --lh: 15pt;
  }
  body {
    background: #fff;
  }
  .tmux,
  .prompt,
  .skip,
  .cmds {
    display: none !important;
  }
  .screen {
    padding: 0;
    min-height: 0;
  }
  .pl {
    margin-right: 1ch;
  }
  .seg,
  .tag {
    background: none !important;
    color: #000 !important;
    padding: 0;
  }
  .seg::after {
    display: none;
  }
  a {
    text-decoration: none;
  }
  a[href^="http"]::after {
    content: " <" attr(href) ">";
    color: #444;
  }
}
