/* Portfolio — styles */

/* ---------- Fonts ---------- */
@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --paper: #f5f1ea;
  --paper-2: #ebe5d9;
  --cream: #e8e2d6;
  --ink: #1a1a1a;
  --ink-2: #2a2a28;
  --slate: #555;
  --slate-2: #8a857c;
  --rule: #d8d1c2;
  --accent: #5a4a8a;
  --accent-ink: #463a6d;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --max: 1180px;
  --reading: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

.mono { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.02em; }
.serif { font-family: var(--serif); }
.caps { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
.muted { color: var(--slate); }

/* ---------- Shared layout ---------- */
.shell {
  min-height: 100vh;
  width: 100%;
  position: relative;
  padding: 0 40px;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}

hr.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* ---------- Links w/ hover underline draw ---------- */
.link-hover {
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s ease;
  padding-bottom: 2px;
}
.link-hover:hover { background-size: 100% 1px; }

.link-accent:hover { color: var(--accent-ink); }

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 280px;
  background: #fffef9;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 20px 50px -20px rgba(40, 30, 10, 0.25);
  z-index: 999;
  font-family: var(--sans);
  font-size: 13px;
}
.tweaks h4 {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--slate);
  font-weight: 500;
}
.tweaks .row { margin-bottom: 12px; }
.tweaks .row:last-child { margin-bottom: 0; }
.tweaks label {
  display: block;
  font-size: 11px;
  color: var(--slate);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.tweaks .seg {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}
.tweaks .seg button {
  flex: 1;
  padding: 7px 8px;
  font-size: 12px;
  background: transparent;
  transition: background 0.15s;
  border-right: 1px solid var(--rule);
}
.tweaks .seg button:last-child { border-right: 0; }
.tweaks .seg button:hover { background: var(--paper-2); }
.tweaks .seg button.active {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Keyboard hint / command bar ---------- */
.kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 5px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--slate);
}

.search-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 8, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.search-box {
  width: 560px;
  max-width: calc(100% - 40px);
  background: #fffef9;
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 30px 80px -20px rgba(40,30,10,0.4);
  overflow: hidden;
}
.search-box input {
  width: 100%;
  font-family: var(--serif);
  font-size: 22px;
  padding: 20px 24px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.search-results { max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--rule); }
.search-result {
  padding: 12px 24px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  transition: background 0.12s;
}
.search-result:hover, .search-result.active { background: var(--paper); }
.search-result:last-child { border-bottom: 0; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 50;
  transition: width 0.1s linear;
}

/* ---------- Essay view shared ---------- */
.reading {
  max-width: var(--reading);
  margin: 0 auto;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-2);
}
.reading p { margin: 0 0 1.1em; }
.reading p:first-of-type::first-line { font-variant: small-caps; letter-spacing: 0.06em; }
.reading h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45em;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 2em 0 0.6em;
  color: var(--ink);
}
.reading h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.18em;
  line-height: 1.25;
  margin: 1.6em 0 0.5em;
  color: var(--ink);
}
.reading h4 {
  font-family: var(--mono);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  margin: 1.6em 0 0.5em;
}
.reading a { color: var(--accent-ink); border-bottom: 1px solid rgba(70, 58, 109, 0.3); }
.reading a:hover { border-bottom-color: var(--accent-ink); }
.reading strong { font-weight: 600; color: var(--ink); }
.reading em { font-style: italic; }
.reading ul, .reading ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.reading li { margin-bottom: 0.4em; }
.reading li > p { margin: 0 0 0.4em; }
.reading blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--accent);
  color: var(--slate);
  font-style: italic;
}
.reading blockquote p { margin: 0 0 0.6em; }
.reading code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 3px;
}
.reading pre {
  font-family: var(--mono);
  font-size: 0.82em;
  line-height: 1.55;
  background: #fffdf6;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1.2em 0;
}
.reading pre code { background: none; padding: 0; font-size: 1em; }
.reading hr { border: 0; border-top: 1px solid var(--rule); margin: 2em auto; width: 60px; }
.reading img { max-width: 100%; height: auto; display: block; margin: 1.4em auto; border-radius: 3px; }

/* ---------- Subtle motion primitives ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.6s ease forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.stagger > * { opacity: 0; animation: fadeUp 0.5s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.11s; }
.stagger > *:nth-child(3) { animation-delay: 0.17s; }
.stagger > *:nth-child(4) { animation-delay: 0.23s; }
.stagger > *:nth-child(5) { animation-delay: 0.29s; }
.stagger > *:nth-child(6) { animation-delay: 0.35s; }
.stagger > *:nth-child(7) { animation-delay: 0.41s; }
.stagger > *:nth-child(8) { animation-delay: 0.47s; }

/* ---------- Signature SVG ---------- */
.signature {
  width: 130px;
  height: auto;
  color: var(--ink);
}
.signature path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawSig 2.2s ease 0.3s forwards;
}
@keyframes drawSig { to { stroke-dashoffset: 0; } }

/* ---------- Placeholder image — striped ---------- */
.placeholder {
  aspect-ratio: 16/10;
  width: 100%;
  background:
    repeating-linear-gradient(
      135deg,
      var(--paper-2) 0 14px,
      var(--cream) 14px 28px
    );
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}
.placeholder span { background: var(--paper); padding: 6px 10px; border: 1px solid var(--rule); }

/* ---------- Editorial layout ---------- */
header.top {
  padding: 28px 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
}
.mark {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
nav a {
  font-size: 13px;
  margin-left: 22px;
  color: var(--slate);
}
nav a.current { color: var(--ink); }
nav a:hover { color: var(--accent-ink); }

.hero {
  padding: 90px 0 32px;
  max-width: 760px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.hero .lede {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.55;
  color: var(--slate);
  max-width: 560px;
  margin: 0;
}

.now {
  display: flex;
  gap: 20px;
  padding: 18px 22px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fffdf6;
  margin: 0 0 40px;
  max-width: 680px;
  align-items: flex-start;
}
.now .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 9px; flex: none;
  box-shadow: 0 0 0 4px rgba(90, 74, 138, 0.12);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(90, 74, 138, 0.12); }
  50% { box-shadow: 0 0 0 8px rgba(90, 74, 138, 0.04); }
}
.now .label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--slate); margin-bottom: 4px; }
.now .body { font-family: var(--serif); font-size: 16px; line-height: 1.55; color: var(--ink-2); }

section.block { padding: 60px 0; border-top: 1px solid var(--rule); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 32px;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  font-style: italic;
  margin: 0;
}
.section-head .more { font-size: 13px; color: var(--slate); }

.essay-list { display: flex; flex-direction: column; }
.essay-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 28px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  cursor: pointer;
  transition: transform 0.25s ease, padding 0.25s ease;
}
.essay-row:hover { transform: translateX(4px); }
.essay-row:hover .essay-title { color: var(--accent-ink); }
.essay-row .date { font-family: var(--mono); font-size: 11px; color: var(--slate-2); letter-spacing: 0.05em; }
.essay-row .essay-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.3;
  transition: color 0.2s;
}
.essay-row .essay-excerpt {
  margin-top: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--slate);
  line-height: 1.5;
}
.essay-row .meta { font-family: var(--mono); font-size: 11px; color: var(--slate-2); text-align: right; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.project-card {
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fffdf6;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -12px rgba(40,30,10,0.18);
  border-color: var(--accent);
}
.project-card .plabel {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  margin-bottom: 14px;
}
.project-card .plabel .status {
  color: var(--accent-ink);
  background: rgba(90, 74, 138, 0.08);
  padding: 2px 8px;
  border-radius: 100px;
}
.project-card .plabel .status.status-developing {
  color: #8a6f2e;
  background: rgba(138, 111, 46, 0.10);
}
.project-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 10px;
}
.project-card p {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  color: var(--slate);
  margin: 0;
}
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.project-card .tags { margin-top: 16px; }
.tag {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

/* ---------- Projects index rows ---------- */
.project-index-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 24px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  cursor: pointer;
  transition: transform 0.25s ease, padding 0.25s ease;
}
.project-index-row:hover { transform: translateX(4px); }
.project-index-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.project-index-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.3;
  color: var(--ink);
  transition: color 0.2s ease;
}
.project-index-head {
  color: var(--accent-ink);
  transition: color 0.2s ease;
}
.project-index-row:hover .project-index-head { color: var(--accent); }
.project-index-summary {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--slate);
  margin-top: 4px;
  line-height: 1.5;
}
.project-index-ext {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--slate);
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  align-self: center;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.project-index-ext:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: rgba(90, 74, 138, 0.06);
  transform: translate(2px, -2px);
}
.project-index-status {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate-2);
  margin-right: 10px;
  vertical-align: 0.18em;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: help;
}
.project-index-row:hover .project-index-status { opacity: 0.9; }
.project-index-status.status-shipped { background: #7a8a5e; }
.project-index-status.status-in-beta,
.project-index-status.status-in-early-access {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 74, 138, 0.10);
}

footer.bottom {
  padding: 80px 0 50px;
  border-top: 1px solid var(--rule);
  margin-top: 60px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  flex-wrap: wrap;
}
footer .sig-block { max-width: 360px; }
footer .sig-block .msg { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--slate); margin-bottom: 14px; }
footer .colophon { font-family: var(--mono); font-size: 11px; color: var(--slate-2); text-align: right; line-height: 1.8; }
footer .colophon a { color: var(--slate); }

/* ---------- Essay detail ---------- */
.essay-view {
  padding: 40px 0 120px;
  max-width: 680px;
  margin: 0 auto;
}
.essay-view .essay-back,
.page-view .essay-back {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--slate);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 48px;
}
.essay-view .essay-back:hover,
.page-view .essay-back:hover { color: var(--accent-ink); }
.essay-view .essay-back::before,
.page-view .essay-back::before { content: "←"; }
.essay-view .essay-meta,
.page-view .essay-meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
  margin-bottom: 20px;
}
.essay-view .essay-meta .tag-dot,
.page-view .essay-meta .tag-dot { color: var(--accent-ink); }
.essay-view h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 36px;
}
/* ============================================================
   About + Contact (shared)
   ============================================================ */
.page-view { padding: 60px 0 100px; }
.page-view h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 58px);
  line-height: 1.08;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}
.page-view .bio {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 560px;
  margin-bottom: 40px;
}
.page-view .bio p { margin: 0 0 1.1em; }
.page-view .kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 24px;
  max-width: 560px;
  font-family: var(--mono);
  font-size: 13px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.page-view .kv dt { color: var(--slate); text-transform: uppercase; font-size: 11px; letter-spacing: 0.1em; }
.page-view .kv dd { margin: 0; color: var(--ink); }
.page-view .kv dd a { border-bottom: 1px dotted var(--slate); }
.page-view .kv dd a:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .shell { padding: 0 24px; }
  .projects-grid { grid-template-columns: 1fr; gap: 32px; }
  nav a { margin-left: 14px; font-size: 12px; }
  .essay-row { grid-template-columns: 80px 1fr; }
  .essay-row .meta { display: none; }
}
