/* ============================================================
   Terminal-session design system
   Palette lives here only; sketch.js reads these tokens at
   runtime via getComputedStyle.
   ============================================================ */

:root {
  --desktop: #161616;   /* page background behind the window */
  --term-bg: #0c0c0c;   /* terminal body */
  --chrome: #1c1c1c;    /* title bar */
  --border: #2a2a2a;    /* window and card borders */
  --green: #7ce38b;     /* prompt, links, node strokes */
  --bright: #f7f3ea;    /* headline tier: section headings, role and card
                           titles — one step above --accent, still warm,
                           never stark #fff */
  --accent: #eae6de;    /* highlights, banner, search path — warm
                           off-white, clearly above --fg without glare */
  --fg: #c0c0c0;        /* output text — ANSI white, 10.8:1 on --term-bg */
  --dim: #8a8a8a;       /* dim text — 5.7:1 on --term-bg, do not darken */
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* the whole session zooms on big monitors: everything is sized in
   rem/em/ch, so scaling the root scales the window proportionally
   (16px up to 1500px viewports, growing to 21px at 2500px) */
html {
  font-size: clamp(16px, calc(16px + (100vw - 1500px) / 200), 21px);
}

body {
  margin: 0;
  padding: clamp(0.75rem, 3vw, 3rem);
  /* clear the fixed status line (and the home indicator) on narrow screens */
  padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
  background: var(--desktop);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.6;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- terminal window ---- */

.term {
  max-width: 87.5rem;
  margin: 0 auto;
  background: var(--term-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: clip;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.5);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.8rem;
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.term-dot--close { background: #b3554e; }
.term-dot--min { background: #b3893e; }
.term-dot--max { background: #4e9e5f; }

.term-title {
  margin-left: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.term-shell {
  margin-left: auto;
}

.term-body {
  padding: 2rem 2.5rem 3rem;
}

/* ---- section headings ----
   The one sanctioned size jump on the page (amended Flat Scale Rule):
   recruiters scan the section names first; the command line beneath
   each heading is demoted to flavor. */

.heading {
  margin: 0 0 0.25rem;
  color: var(--bright);
  font-size: clamp(1.25rem, 1.15rem + 0.4vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
}

/* ---- shell lines ---- */

.line {
  margin: 0;
  padding-left: 4ch;
  text-indent: -4ch;
  overflow-wrap: break-word;
  font-size: 1em;
  font-weight: normal;
}

.ps1 {
  color: var(--green);
}

.cmd {
  color: var(--fg);
  font-weight: 600;
}

/* demoted command line under a heading: the prompt keeps its green
   voice, but the command drops to dim 400 at label size — flavor,
   not structure */
.line--sub {
  font-size: 0.85em;
}

.line--sub .cmd {
  color: var(--dim);
  font-weight: 400;
}

.out {
  margin: 0.75rem 0 0;
}

/* figlet-style answer to `whoami` */
.banner {
  margin: 0 0 1rem;
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(0.7rem, 3vw, 1.05rem);
  line-height: 1.2;
}

.out p {
  margin: 0 0 0.75rem;
  max-width: 68ch;
}

.out p:last-child {
  margin-bottom: 0;
}

.comment {
  color: var(--dim);
}

.cursor::after {
  content: "";
  display: inline-block;
  width: 1ch;
  height: 1.2em;
  background: var(--green);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

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

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---- sections ---- */

section {
  margin-top: 3.5rem;
  scroll-margin-top: 4.5rem;
}

.term-body > section:first-child {
  margin-top: 0;
}

/* ---- sticky sidebar (wide screens only) ---- */

.side-nav {
  display: none;
}

@media (min-width: 1180px) {
  body {
    display: grid;
    grid-template-columns: 11rem minmax(0, 87.5rem);
    justify-content: center;
    column-gap: 2rem;
    align-items: start;
    padding-bottom: clamp(0.75rem, 3vw, 3rem);
    font-size: 1rem;
  }

  .term-body {
    padding: 2.5rem 3.25rem 3.5rem;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 3rem;
    /* pull the padding of the first/last links back out so the column's
       optical bounds don't shift */
    margin-block: -0.425rem;
    text-align: right;
    font-size: 1rem;
  }
}

/* spacing lives inside each link (padding, not flex gap) so the hover
   area is contiguous: crossing the space between two items never drops
   hover, which would snap the › marker back to the active section */
.side-nav a {
  padding: 0.425rem 0;
  color: var(--green);
  text-decoration: none;
}

/* the › is a menu cursor, not a web link: it snaps to the hovered or
   focused item (no underline, no fade — TUI selection markers move
   instantly) and rests on the active section otherwise */
.side-nav a:hover::before,
.side-nav a:focus-visible::before {
  opacity: 1;
}

.side-nav:has(a:hover) a.is-active:not(:hover)::before {
  opacity: 0;
}

.side-nav a.is-active {
  font-weight: 600;
}

/* chevron space is reserved on every link (and weight is constant per
   glyph box on the right-aligned text), so activation never reflows
   the sticky column */
.side-nav a::before {
  content: "\203a\00a0";
  opacity: 0;
}

.side-nav a.is-active::before {
  opacity: 1;
}

/* ---- tmux status line (narrow screens) ----
   The sidebar's replacement below 1180px: a fixed window list
   pinned to the bottom of the screen, tmux-style. */

.status-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10; /* the page's only overlay */
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 0 max(0.75rem, env(safe-area-inset-left));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--chrome);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  overflow-x: auto;
}

.status-nav a {
  display: flex;
  align-items: center;
  padding: 0.85rem 0.25rem; /* ≥44px touch target */
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}

/* the tmux current-window asterisk; reserved when inactive so the
   row doesn't shift as the highlight moves */
.status-nav a::after {
  content: "*";
  opacity: 0;
}

.status-nav a.is-active {
  color: var(--green);
  font-weight: 600;
}

.status-nav a.is-active::after {
  opacity: 1;
}

/* the sidebar takes over on wide screens (after the base rules above so
   the override wins the cascade) */
@media (min-width: 1180px) {
  .status-nav {
    display: none;
  }
}

/* ---- shields.io badges ---- */

.shield-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* 1.75rem = the badges' native 28px, so they render crisp */
.shield {
  display: block;
  height: 1.75rem;
  width: auto;
}

.shield-link {
  position: relative;
  display: inline-block;
  line-height: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* linked badges answer hover with a lift and a brightness step — the
   cards' language, scaled to badge size */
@media (hover: hover) {
  .shield-link:hover {
    transform: translateY(-3px);
    filter: brightness(1.15);
  }
}

.shield-link:focus-visible {
  transform: translateY(-3px);
  filter: brightness(1.15);
}

@media (prefers-reduced-motion: reduce) {
  .shield-link:hover,
  .shield-link:focus-visible {
    transform: none; /* the brightness step alone carries the feedback */
  }
}

/* invisible hit-area extension: the 28px badges become ≥44px touch
   targets without moving a pixel (±4px horizontal stays inside the
   0.5rem row gap, so neighbours never overlap) */
.shield-link::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

/* ---- experience log ----
   Rendered as a downward DAG with drawn node/edge elements: each role
   is a ring node (dark fill, muted border) on a left rail; a stem runs
   beside the text into a solid arrowhead landing on the next node. */

.log-entry {
  position: relative;
  margin-top: 2.25rem;
  padding-left: 2.5rem;
}

/* node: a solid graph vertex — filled disc with a thick ring, centered
   on the first line. box-sizing is explicit: the * reset doesn't match
   pseudo-elements, and a border drawn outside the box is what let the
   stem poke into the circle. */
.log-entry::before {
  content: "";
  position: absolute;
  box-sizing: border-box;
  left: 0;
  top: calc(0.8em - 0.625rem);
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--border);
  border: 4px solid var(--dim);
}

/* edge: 3px stem flowing into a small arrowhead, carved from one
   element; same color as the node ring. Runs flush from this node's
   bottom tangent to the next node's top tangent — never inside. */
.log-entry:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  width: 0.75rem;
  top: calc(0.8em + 0.625rem);
  bottom: calc(-2.25rem - 0.8em + 0.625rem);
  background: var(--dim);
  clip-path: polygon(
    calc(50% - 1.5px) 0,
    calc(50% + 1.5px) 0,
    calc(50% + 1.5px) calc(100% - 6px),
    calc(50% + 4.5px) calc(100% - 6px),
    50% 100%,
    calc(50% - 4.5px) calc(100% - 6px),
    calc(50% - 1.5px) calc(100% - 6px)
  );
}

/* role leads the line, date sits flush right; org gets its own line */
.log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 2ch;
}

.log-date {
  color: var(--dim);
  white-space: nowrap;
}

.log-role {
  margin: 0;
  color: var(--bright);
  font-size: 1.1em;
  font-weight: 600;
}

.log-org {
  margin: 0.2rem 0 0;
  color: var(--fg);
}

.log-emoji {
  letter-spacing: 0.25rem;
}

.log-note {
  margin: 0.5rem 0 0;
  max-width: 70ch;
}

/* ---- card grids ("GUI output") ---- */

/* fixed column counts so card size tracks the screen instead of
   snapping between huge and tiny: 1 → 2 → always 3 on desktop */
.gui {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  margin-top: 1rem;
}

@media (min-width: 720px) {
  .gui {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .gui {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.gui-card {
  display: block;
  padding: 1.25rem;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease,
    transform 0.2s ease, box-shadow 0.2s ease;
}

/* hover styling only on devices that can hover; on touch, :hover would
   stick to the last-tapped card */
@media (hover: hover) {
  a.gui-card:hover {
    background: #131313;
    border-color: var(--green);
    transform: translateY(-3px) scale(1.015);
    box-shadow: 0 10px 24px rgb(0 0 0 / 0.45);
  }

  a.gui-card:hover .gui-title {
    color: var(--green);
  }
}

a.gui-card:focus-visible {
  background: #131313;
  border-color: var(--green);
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.45);
}

a.gui-card:focus-visible .gui-title {
  color: var(--green);
}

/* touch feedback: border + background answer the press, no lift */
a.gui-card:active {
  background: #131313;
  border-color: var(--green);
}

a.gui-card:active .gui-title {
  color: var(--green);
}

@media (prefers-reduced-motion: reduce) {
  a.gui-card:hover,
  a.gui-card:focus-visible {
    transform: none;
  }
}

.gui-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.gui-title {
  margin: 0 0 0.3rem;
  color: var(--bright);
  font-size: 1.1em;
  font-weight: 600;
  transition: color 0.2s ease;
}

/* every card links to proof; the dim ↗ says so at rest — recruiters
   read before they hover. It joins the title's green on interaction.
   (The content alt-text syntax keeps screen readers from announcing
   the arrow; older browsers fall back to the plain declaration.) */
.gui-title::after {
  /* no-break space so the arrow never wraps to a line of its own */
  content: "\00a0\2197";
  content: "\00a0\2197" / "";
  color: var(--dim);
  /* relative offsets, not transform: transforms don't apply to inline
     boxes, and inline-block would break the no-break glue above. The
     hover nudge travels the way the glyph points. */
  position: relative;
  top: 0;
  left: 0;
  transition: color 0.2s ease, top 0.2s ease, left 0.2s ease;
}

@media (hover: hover) {
  a.gui-card:hover .gui-title::after {
    color: var(--green);
    top: -0.12em;
    left: 0.12em;
  }
}

a.gui-card:focus-visible .gui-title::after {
  color: var(--green);
  top: -0.12em;
  left: 0.12em;
}

a.gui-card:active .gui-title::after {
  color: var(--green);
}

@media (prefers-reduced-motion: reduce) {
  a.gui-card:hover .gui-title::after,
  a.gui-card:focus-visible .gui-title::after {
    top: 0;
    left: 0; /* the color step alone carries the feedback */
  }
}

.gui-sub {
  margin: 0 0 0.3rem;
  color: var(--dim);
  font-size: 0.85em;
}

.gui-desc {
  margin: 0;
  font-size: 0.95em;
}

.gui-card .shield {
  height: 1.6rem;
}

/* ---- contact coda ----
   The session ends the way real ones do: `cat contact.txt` prints the
   ask, a comment signs off, and the prompt idles. The key/value links
   are native text, so the contact path survives blocked badge CDNs. */

.coda {
  margin-top: 3.5rem;
}

/* a real `cat` prints contiguous lines — tighter than paragraph rhythm */
.out .contact-line {
  margin-bottom: 0.2rem;
  overflow-wrap: anywhere; /* long profile URLs on narrow screens */
}

.contact-key {
  display: inline-block;
  min-width: 10ch; /* longest key is "linkedin:" — values align as one column */
  color: var(--dim);
}

.contact-line a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: filter 0.2s ease;
}

/* same hover language as the linked shields: a brightness step, so the
   link stays in green's interactive voice; :active carries the touch
   equivalent, as on the cards */
@media (hover: hover) {
  .contact-line a:hover {
    filter: brightness(1.15);
  }
}

.contact-line a:active {
  filter: brightness(1.15);
}

.prompt-end {
  margin-top: 2rem;
}

/* ---- responsive ---- */

@media (max-width: 720px) {
  /* narrow screens: the key/value column can't hold — wrapped values
     dangled back at column 0 and sheared the column apart. Stack the
     value under its key instead; every value line aligns at 2ch. The
     block links also become full-width touch targets. */
  .contact-key {
    display: block;
    min-width: 0;
  }

  .contact-val {
    display: block;
    padding-left: 2ch;
  }

  .out .contact-line {
    margin-bottom: 0.6rem;
  }

  body {
    padding: 0.5rem;
    padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
    font-size: 1rem; /* 16px floor for phone reading distance */
  }

  .term {
    border-radius: 6px;
  }

  .term-shell {
    display: none;
  }

  .term-body {
    padding: 1.25rem 1rem 2rem;
  }

  .shield {
    height: 1.4rem;
  }

  .gui-card .shield {
    height: 1.25rem;
  }
}
