/* ============================================================
   williamperacchio.com — the monospace ledger
   cream ledger-book by day, amber terminal by night
   ============================================================ */

:root {
  --bg: #f4eee0;
  --ink: #33291e;
  --muted: #7d7060;
  --faint: #a3957f;
  --rule: #d9cfba;
  --accent: #9c3c22;
  --live: #3f7d3f;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #0e0d0b;
  --ink: #e6dcc8;
  --muted: #94886f;
  --faint: #5f5641;
  --rule: #2a2620;
  --accent: #ffb454;
  --live: #7dd87d;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { background: var(--accent); color: var(--bg); }

::selection { background: var(--accent); color: var(--bg); }

strong { font-weight: 700; }

/* ---------- ascii rules ---------- */

.rule {
  overflow: hidden;
  white-space: nowrap;
  color: var(--rule);
  user-select: none;
}
.rule::before {
  content: "────────────────────────────────────────────────────────────────────────────────────────────────";
}

/* ---------- masthead ---------- */

.masthead { margin-bottom: 56px; }

.mast-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.mast-name { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }

.mast-loc { color: var(--faint); font-size: 12.5px; }

.mast-right { display: flex; align-items: baseline; gap: 18px; }

.theme-toggle {
  font-family: var(--mono);
  font-size: 12.5px;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--accent); color: var(--bg); }

.mast-tag {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

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

.hero { margin-bottom: 64px; }

h1 {
  font-size: clamp(21px, 3.4vw, 28px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  min-height: 2.9em; /* reserve space for the typewriter so layout doesn't jump */
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.06s steps(1) infinite;
}
.caret.done { animation: blink 1.06s steps(1) 3; animation-fill-mode: forwards; opacity: 0; }

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

@media (prefers-reduced-motion: reduce) {
  .caret { display: none; }
  h1 { min-height: 0; }
}

.lede { color: var(--muted); max-width: 60ch; margin-bottom: 32px; }

/* ---------- status ---------- */

.status { margin-bottom: 32px; }

.label {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.status ul { list-style: none; }
.status li { display: flex; align-items: baseline; gap: 10px; }

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  align-self: center;
}
.dot.live { background: var(--live); box-shadow: 0 0 6px color-mix(in srgb, var(--live) 55%, transparent); }

/* ---------- actions ---------- */

.actions { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.actions a { white-space: nowrap; }

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

.section { margin-bottom: 64px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.section-title::before { content: "──"; color: var(--rule); font-weight: 400; }
.section-title::after {
  content: "──────────────────────────────────────────────────────────────────────";
  color: var(--rule);
  font-weight: 400;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- experience entries ---------- */

.entry {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: start;
  padding-top: 4px;
}

.entry-date { color: var(--faint); font-size: 13px; white-space: nowrap; }

.entry-body h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }

.entry-body p { color: var(--muted); font-size: 14px; max-width: 58ch; }
.entry-body p + p { margin-top: 8px; }

.pub { color: var(--ink) !important; }

@media (max-width: 560px) {
  .entry { grid-template-columns: 1fr; gap: 4px; margin-bottom: 30px; }
  .entry-meta { justify-content: flex-start; }
}

/* ---------- index lists (writing / education / honors) ---------- */

.index { list-style: none; }

.index li {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: baseline;
}
.index li:first-child { border-top: 1px dashed var(--rule); }

.index-meta {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.index a, .index-title { font-size: 14px; }

@media (max-width: 560px) {
  .index li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- contact ---------- */

.contact p { color: var(--muted); margin-bottom: 16px; }

.contact-email {
  display: inline-block;
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 700;
  margin-bottom: 24px;
}

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

.footer p {
  margin-top: 14px;
  color: var(--faint);
  font-size: 12px;
}
