/* ----------------------------------------------------------------------------
   Pedro La Rotta — single page. Calm, list-first, light by default.
---------------------------------------------------------------------------- */

:root[data-theme="light"] {
  --bg:      #fcfcfa;
  --text:    #1f1d1a;
  --muted:   #6c6a64;
  --faint:   #a6a39b;
  --rule:    #e7e5df;
  --hover:   #f3f1ea;
  --accent:  #b4532a;   /* warm rust, used sparingly */
}

:root[data-theme="dark"] {
  --bg:      #16150f;
  --text:    #e9e6dc;
  --muted:   #9c988c;
  --faint:   #6a675d;
  --rule:    #2a2820;
  --hover:   #1f1d16;
  --accent:  #e08a5b;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s ease, color 0.4s ease;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 88px) 28px 40px;
}

.group { scroll-margin-top: 80px; }

a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---- Intro ---- */
.intro { margin-bottom: 64px; }

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(34px, 6vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.role {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: var(--muted);
  margin-bottom: 26px;
}

.lede {
  color: var(--muted);
  max-width: 56ch;
  margin-bottom: 26px;
}
.lede a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--faint), var(--faint));
  background-size: 100% 1px;
  background-position: 0 1.15em;
  background-repeat: no-repeat;
  transition: background-image 0.2s, color 0.2s;
}
.lede a:hover {
  color: var(--accent);
  background-image: linear-gradient(var(--accent), var(--accent));
}

/* ---- Top-level link row ---- */
.links {
  display: flex;
  gap: 22px;
  font-size: 15px;
}
.links a {
  position: relative;
  text-decoration: none;
  color: var(--text);
  padding-bottom: 2px;
}
.links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.links a:hover { color: var(--accent); }
.links a:hover::after { transform: scaleX(1); }

/* ---- Groups ---- */
.group { margin-bottom: 52px; }

.group h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}

.list { list-style: none; }
.list li { border-bottom: 1px solid var(--rule); }

/* ---- Rows ---- */
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 14px 16px 16px;
  margin: 0 -14px 0 -16px;
  text-decoration: none;
  border-radius: 8px;
  position: relative;
  transition: background 0.2s ease;
}
.row::before {
  /* slim accent bar that grows on hover */
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.row:hover { background: var(--hover); }
.row:hover::before { opacity: 1; transform: scaleY(1); }

.row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.row-title {
  font-weight: 500;
  line-height: 1.35;
  transition: color 0.2s ease;
}
.row:hover .row-title { color: var(--accent); }

/* little arrow that appears on hover, after the title */
.row-title::after {
  content: " ↗";
  color: var(--accent);
  opacity: 0;
  margin-left: 2px;
  transition: opacity 0.2s ease;
}
.row:hover .row-title::after { opacity: 1; }

.row-desc {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* static rows (experience) — no link affordances */
.row--static { cursor: default; }
.row--static:hover { background: transparent; }
.row--static:hover::before { opacity: 0; transform: scaleY(0.4); }
.row--static:hover .row-title { color: var(--text); }
.row--static .row-title::after { content: none; }
.at { color: var(--muted); font-weight: 400; }

.row-meta {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  padding-top: 2px;
}

.more {
  display: inline-block;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
}
.more:hover { color: var(--accent); transform: translateX(3px); }

/* ---- Robot arm (corner widget, opt-in) ---- */
#robot {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 300px;
  height: 300px;
  z-index: 30;
  pointer-events: none;   /* clicks pass through except the toggle */
  user-select: none;
}
#arm {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;   /* arm is tracked via window listeners */
  opacity: 0;
  transition: opacity 0.5s ease;
}
#robot.active #arm { opacity: 1; }

.arm-seg   { stroke: var(--text); stroke-width: 6; stroke-linecap: round; }
.arm-joint { fill: var(--bg); stroke: var(--text); stroke-width: 3; }
.arm-grip  { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }

#robot-toggle {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s, border-color 0.2s, transform 0.2s, background 0.2s;
}
#robot-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
#robot.active #robot-toggle { color: var(--accent); border-color: var(--accent); font-size: 15px; }

@media (max-width: 540px) {
  #robot { width: 220px; height: 220px; }
}

/* ---- Footer ---- */
footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 28px 60px;
  font-size: 13px;
  color: var(--faint);
}

/* ---- Top bar (hairline) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.tb-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
}
.tb-brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.tb-nav {
  margin-left: auto;
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.tb-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.tb-nav a:hover { color: var(--accent); }

/* ---- Theme toggle (lives in the bar) ---- */
.theme-toggle {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, color 0.2s, transform 0.3s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(25deg); }
.theme-toggle::before { content: "☾"; font-size: 14px; line-height: 1; }
:root[data-theme="dark"] .theme-toggle::before { content: "☀"; }

/* ---- Motion ---- */
.intro, .group { animation: rise 0.6s ease both; }
.group:nth-of-type(2) { animation-delay: 0.08s; }
.group:nth-of-type(3) { animation-delay: 0.14s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, html { animation: none !important; scroll-behavior: auto; transition: none !important; }
}

@media (max-width: 540px) {
  body { font-size: 16px; }
  .row { gap: 12px; }
  .row-meta { display: none; }
}
