/* ---------------------------------------------------------------
   jadenchapman.com
   --------------------------------------------------------------- */

:root {
  --bg:      #0b0d10;
  --bg-glow: #12161b;
  --fg:      #c9d1d9;
  --bright:  #e6edf3;
  --dim:     #6e7681;
  --accent:  #7ee787;  /* prompt / success */
  --amber:   #d29922;  /* attributions */
  --cyan:    #79c0ff;  /* links */
  --red:     #ff7b72;  /* errors */

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --line: 1.65;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--bg-glow) 0%, transparent 70%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: var(--line);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* Screen-reader-only heading: real content for search engines + AT. */
.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 shell ------------------------------------------- */

#terminal {
  min-height: 100%;
  max-width: 78ch;
  margin: 0 auto;
  padding: 24px 20px 96px;
  cursor: text;
}

@media (min-width: 700px) {
  #terminal { padding: 48px 32px 120px; }
  body { font-size: 15.5px; }
}

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

.line {
  white-space: pre-wrap;
  margin: 0;
}

.line + .line { margin-top: 2px; }

.spacer { height: 1em; }

.dim    { color: var(--dim); }
.bright { color: var(--bright); }
.accent { color: var(--accent); }
.amber  { color: var(--amber); }
.red    { color: var(--red); }

/* A quote block: indented, brighter, with a left rule. */
.quote {
  margin: 0.35em 0 0;
  padding-left: 1.25ch;
  border-left: 2px solid rgba(126, 231, 135, 0.28);
  color: var(--bright);
  white-space: pre-wrap;
}

.quote-author {
  margin-top: 0.15em;
  padding-left: 1.25ch;
  color: var(--amber);
  white-space: pre-wrap;
}

/* The echoed command after you hit enter. */
.echo .prompt-sym { color: var(--accent); }
.echo .cmd        { color: var(--bright); }

a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(121, 192, 255, 0.3);
}
a:hover, a:focus-visible {
  border-bottom-color: var(--cyan);
  outline: none;
}

/* --- input row ------------------------------------------------- */

#input-row {
  display: flex;
  align-items: baseline;
  gap: 0.75ch;
  margin-top: 2px;
}

#input-row[hidden] { display: none !important; }

.prompt-sym {
  color: var(--accent);
  flex: none;
  user-select: none;
}

/* The real input is transparent and overlaid by a styled mirror so
   we can render our own block cursor. */
#input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

#cmd {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  margin: 0;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  font-size: 16px; /* prevents iOS Safari zoom-on-focus; text is invisible anyway */
  line-height: inherit;
}

#mirror {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--bright);
  white-space: pre-wrap;
}

/* Block cursor, used by both the mirror and the typing animation. */
.cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.05s steps(1) infinite;
}

.cursor.solid { animation: none; }

@keyframes blink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* --- mobile quick commands ------------------------------------- */

#chips {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  overflow-x: auto;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }

#chips button {
  flex: none;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: rgba(126, 231, 135, 0.07);
  border: 1px solid rgba(126, 231, 135, 0.22);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
}
#chips button:active { background: rgba(126, 231, 135, 0.18); }

@media (min-width: 700px) {
  #chips { display: none; }
}

/* --- optional CRT mode (`crt` command) ------------------------- */

body.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0.22) 4px
  );
}

body.crt #terminal {
  text-shadow: 0 0 6px rgba(126, 231, 135, 0.45);
}

/* --- falling particles (`snow`, `halloween`, `easter`, birthday) - */

#particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 8;
}

.flake {
  position: absolute;
  top: -1.5em;
  left: 0;
  color: var(--bright);
  opacity: 0.9;
  animation: fall linear forwards;
}

.confetti-piece {
  position: absolute;
  top: -1.5em;
  left: 0;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation: fall-confetti linear forwards;
}

@keyframes fall {
  to { transform: translateY(110vh) translateX(var(--drift, 0px)); }
}

@keyframes fall-confetti {
  to {
    transform: translateY(110vh) translateX(var(--drift, 0px)) rotate(360deg);
  }
}

/* --- matrix rain (`matrix` command) ----------------------------- */

#matrix-rain {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

/* --- crying face (`cry` command) -------------------------------- */

#cry-face {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 6px 0 2px;
  pointer-events: none;
  color: var(--cyan);
}

.cry-eyes {
  font-size: 1.4rem;
  letter-spacing: 0.3ch;
}

.cry-tears {
  display: flex;
  gap: 1.2rem;
  margin-top: 2px;
  height: 2.2em;
  overflow: hidden;
}

.cry-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  animation: cry-scroll 1.4s linear infinite;
}

@keyframes cry-scroll {
  from { transform: translateY(-50%); }
  to   { transform: translateY(0); }
}

.cry-puddle {
  margin-top: 0.6em;
  height: 2px;
  width: 0;
  background: var(--cyan);
  transition: width 0.3s linear, background 0.3s linear;
}

.cry-puddle.intense { background: var(--red); }

/* --- disco mode (`party` command) --------------------------------- */

@keyframes party-hue {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}

/* Applied to #terminal rather than <body>: an animated `filter` on an
   ancestor of the fixed-position overlays (#particles, #chips, etc.)
   would make them containing-block-relative to that ancestor instead
   of the viewport, so they'd drift with scroll instead of staying put. */
#terminal.party {
  animation: party-hue 1.2s linear infinite;
}

/* --- wheel of names (`wheel spin`) -------------------------------- */

#wheel-overlay {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: wheel-fade-in 0.2s ease-out;
}

#wheel-overlay.fade-out {
  animation: wheel-fade-out 0.6s ease-in forwards;
}

.wheel-rig {
  position: relative;
}

.wheel-canvas {
  display: block;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 4px var(--bg-glow), 0 8px 32px rgba(0, 0, 0, 0.5);
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 16px solid var(--bright);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

@keyframes wheel-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes wheel-fade-out { to { opacity: 0; } }

/* --- fixed-width blocks, e.g. ascii art (`art` command) --------- */

.ascii {
  margin: 0;
  overflow-x: auto;
  font: inherit;
  line-height: 1.15;
}

/* --- copyright footer -------------------------------------------- */

#copyright {
  position: fixed;
  right: 12px;
  bottom: 8px;
  z-index: 10;
  font-size: 11px;
  color: var(--dim);
  pointer-events: none;
}

@media (max-width: 699px) {
  /* #chips owns the bottom bar on narrow screens. */
  #copyright { display: none; }
}

noscript .copy {
  margin-top: 1.5em;
  font-size: 12px;
  color: var(--dim);
}

/* --- reduced motion -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  #particles, #matrix-rain, #cry-face, #wheel-overlay { display: none; }
  .cry-col { animation: none; }
  #terminal.party { animation: none; }
}

/* --- noscript --------------------------------------------------- */

noscript .nojs {
  display: block;
  max-width: 78ch;
  margin: 0 auto;
  padding: 24px 20px;
}
noscript blockquote {
  margin: 0 0 1.2em;
  padding-left: 1.25ch;
  border-left: 2px solid rgba(126, 231, 135, 0.28);
  color: var(--bright);
}
noscript cite {
  display: block;
  color: var(--amber);
  font-style: normal;
}

/* --- key/value rows (help, work, contact) ----------------------- */

.row {
  display: flex;
  gap: 1.5ch;
  padding-left: 2ch;
}

.row .k {
  flex: none;
  width: 18ch;
  color: var(--bright);
}

.row .k.cmd-name { color: var(--accent); }
.row .k.label    { color: var(--dim); }
.row .k.narrow   { width: 10ch; }

.row .v {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--dim);
}

/* Narrow screens: tighten the columns but keep them aligned, so a
   wrapped value stays inside its own column instead of running back
   under the label. */
@media (max-width: 560px) {
  .row { gap: 1ch; padding-left: 1ch; }
  .row .k        { width: 17ch; }
  .row .k.narrow { width: 9ch; }
}
