/* ---------------------------------------------------------------
   justin sun — chill builder
   lowercase, warm quiet gray, one sage accent.
   nothing shouts. light by default; the switch flips the night on.
   --------------------------------------------------------------- */

:root {
  --paper:  #f6f5f2;   /* warm quiet gray                  */
  --ink:    #2a2824;   /* warm near-black                  */
  --dim:    #6f6a61;   /* secondary text                   */
  --sage:   #5a6e50;   /* the one accent                   */
  --sage-soft: rgba(110, 131, 98, 0.5);
  --star:   #9c7a14;   /* golden, dark enough to read on light  */
  --line:   rgba(42, 40, 36, 0.1);
  --toggle: #c9c5bd;   /* switch track                     */
  --dock-bg: rgba(255, 255, 255, 0.45);
  --dock-line: rgba(42, 40, 36, 0.12);
  --nn-pos: #5b7fa6;   /* muted blue, positive weight  */
  --nn-neg: #b0645a;   /* muted red, negative weight   */
}

:root[data-theme="dark"] {
  --paper: #1b1a18;
  --ink:   #e6e3dc;
  --dim:   #9a948a;
  --sage:  #a3b894;
  --sage-soft: rgba(163, 184, 148, 0.45);
  --star:  #e8c25e;
  --line:  rgba(230, 227, 220, 0.12);
  --toggle: #47443f;
  --dock-bg: rgba(45, 45, 45, 0.55);
  --dock-line: rgba(255, 255, 255, 0.14);
  --nn-pos: #82a8cc;
  --nn-neg: #c9857a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 17px; color-scheme: light; }

:root[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: "Karla", system-ui, sans-serif;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  transition: background-color 300ms ease, color 300ms ease;
}

::selection { background: var(--sage-soft); }

:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- theme switch (middle left, scattered on purpose) ------------ */

.theme-toggle {
  position: absolute;
  top: 48vh;
  right: calc(60% + 20rem);
  z-index: 10;
}


#theme-check {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch {
  --a: 0.5s ease-out;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  height: 1em;
  border-radius: 2em;
  box-shadow: 0 0 0 0.33em var(--toggle);
  aspect-ratio: 212.4992 / 84.4688;
  background-color: var(--toggle);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}

.switch svg { height: 100%; }

.switch svg path {
  color: var(--paper);
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 136 224;
  transition: all var(--a), 0s transform;
  transform-origin: center;
}

#theme-check:checked ~ .switch svg path {
  stroke-dashoffset: 180;
  transform: scaleY(-1);
}

#theme-check:focus-visible ~ .switch {
  outline: 2px solid var(--sage);
  outline-offset: 0.55em;
}

/* --- ascii portrait (top right, near the text) ------------------- */

.portrait {
  position: absolute;
  top: 1.5rem;
  left: calc(50% + 18.5rem);
  user-select: none;
  pointer-events: none;
  font-family: "Spline Sans Mono", monospace;
  font-size: 4px;
  line-height: 1.05;
  color: var(--dim);
}

/* the repel canvas covers the whole page (in-document, so it
   rubber-bands with the content on overscroll) — no edges to hit */
.portrait-fx {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
}

:root[data-theme="dark"] .portrait-light { display: none; }
:root:not([data-theme="dark"]) .portrait-dark { display: none; }

/* --- vertical dock (floating beside the stuff section) ----------- */

.dock {
  position: absolute;
  top: 40rem;
  left: calc(55% + 19.5rem);
  z-index: 20;
  padding: 8px;
  border-radius: 18px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-line);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.dock-rail { position: relative; width: 44px; }

.dock-app {
  position: absolute;
  right: 0;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  transition: opacity 260ms ease;
}

/* collapsed: only finder shows; tap it to unfold the rest */
.dock:not(.expanded) .dock-app:not(:first-child) {
  opacity: 0;
  pointer-events: none;
}

.dock-app img {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.dock-app img.rounded { border-radius: 22%; }

/* running-app dot on the outer edge, like a side-docked mac */
.dock-app::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dim);
  opacity: 0;
}

.dock-app.running::after { opacity: 0.9; }

@media (max-width: 1100px) {
  .dock { display: none; }
}

/* --- tiny neural net (bottom left, beside experience) ------------ */

.nn {
  position: absolute;
  top: 54rem;                       /* js re-anchors to the section */
  right: calc(55% + 20.5rem);
  z-index: 10;
}

.nn circle {
  fill: var(--ink);
  stroke: var(--dim);
  stroke-width: 1;
  transition: fill-opacity 340ms ease;
}

.nn .pos { stroke: var(--nn-pos); }
.nn .neg { stroke: var(--nn-neg); }

@media (max-width: 1100px) {
  .nn { display: none; }
}

/* phones / narrow windows: portrait becomes a small avatar beside the
   headline, the toggle drops in-flow under the now: line, and the repel
   effect stays a desktop thing. */
@media (max-width: 1100px) {
  .portrait {
    top: 2.6rem;
    left: auto;
    right: 1.25rem;
    font-size: 2px;
  }
  .portrait-fx { display: none; }
  main { padding-top: 3rem; }
  .theme-toggle {
    position: static;
    display: inline-block;
    margin-top: 1.6rem;
  }
}

/* small phones: shrink type so the byline and now: line stay one line */
@media (max-width: 640px) {
  html { font-size: 15px; }
  main { padding-left: 1.25rem; padding-right: 1.25rem; }
  .byline { font-size: 0.95rem; }
  .now { font-size: 0.7rem; }
}

/* --- layout ----------------------------------------------------- */

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: clamp(4rem, 14vh, 8rem) 1.5rem 3rem;
}

section { margin-top: 3.75rem; }

/* --- hero ------------------------------------------------------- */

h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.byline {
  margin-top: 1rem;
  color: var(--dim);
  max-width: 32rem;
}

.cs,
.math {
  color: var(--sage);
  font-weight: 500;
  cursor: default;
}

.now {
  margin-top: 1.5rem;
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.82rem;
  color: var(--dim);
}

.now-label { color: var(--sage); font-weight: 500; }

/* --- section labels --------------------------------------------- */

.label {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 1rem;
}

/* --- stuff ------------------------------------------------------ */

.stuff { list-style: none; }

.stuff li + li {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.stuff a {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}

.stuff a:hover {
  text-decoration: underline;
  text-decoration-color: var(--sage);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.stuff p {
  margin-top: 0.2rem;
  color: var(--dim);
  font-size: 0.95rem;
}

/* links inside description text: plain inline links, not bold titles */
.stuff p a {
  font-weight: 400;
  font-size: inherit;
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--sage-soft);
  text-underline-offset: 4px;
}

.stuff p a:hover {
  text-decoration-thickness: 1px;
  text-decoration-color: var(--sage);
}

.oss {
  font-family: "Spline Sans Mono", monospace;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--sage);
}

.stars { color: var(--star); }

/* --- elsewhere --------------------------------------------------- */

.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.3rem;
}

.links a,
.support a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--sage-soft);
  text-underline-offset: 4px;
  transition: text-decoration-color 140ms ease;
}

.links a:hover,
.support a:hover { text-decoration-color: var(--sage); }

.support {
  margin-top: 1.1rem;
  font-size: 0.85rem;
  color: var(--dim);
}

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

footer {
  margin-top: 4.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--dim);
}

