/* Eric Hu — Notes
   Ledger direction: Helvetica + JetBrains Mono, hairline rules, cursor-tracked details. */

:root {
  --paper: #fbfbfa;
  --ink: #0f0f0f;
  --rule: rgba(15, 15, 15, 0.14);
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 48px;
  --measure: 720px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

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

/* No `to` keyframe and `backwards` fill on purpose: the animation resolves to the
   element's own computed value, and releases it once done — so dimmed links keep
   their opacity and hover transitions still work after the reveal. */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes draw { from { transform: scaleX(0); } }

.rise { animation: rise 0.8s var(--ease) backwards; }
.fade { animation: fade 0.6s ease backwards; }

/* Stagger utility — set --d on the element. */
[style*="--d"] { animation-delay: var(--d); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- chrome ---------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 36px var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.masthead nav {
  display: flex;
  gap: 26px;
}

.masthead nav a { transition: opacity 0.3s ease; }
.masthead nav a[aria-current="page"] { opacity: 1; }
.masthead nav a:not([aria-current="page"]) { opacity: 0.45; }
.masthead nav a:hover { opacity: 1; }

.masthead .back:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- home ---------- */

.lede {
  padding: 52px var(--gutter) 46px;
  border-bottom: 1px solid var(--rule);
}

.lede p {
  margin: 0;
  max-width: 30ch;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}

/* A single flat run of entries — no category columns. */
.ledger {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 34px var(--gutter);
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  margin: 0 -14px;
  transition: background 0.3s ease, color 0.3s ease;
}

.entry:hover,
.entry:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

.entry .title { font-size: 16px; line-height: 1.3; }

.entry .date {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.45;
}

/* ---------- post ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 11;
}

.article {
  padding: 72px var(--gutter) 0;
}

.article > * {
  max-width: var(--measure);
  margin-inline: auto;
  width: 100%;
}

.article .kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.45;
}

.article h1 {
  margin: 22px 0 0;
  font-weight: 500;
  font-size: 46px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}

.article hr {
  height: 1px;
  border: 0;
  background: var(--rule);
  margin: 40px 0 0;
  transform-origin: left;
  animation: draw 0.9s var(--ease) 0.3s backwards;
}

.article p {
  margin: 26px 0 0;
  font-size: 19px;
  line-height: 1.68;
  text-wrap: pretty;
}

.article p:first-of-type { margin-top: 38px; }

.article blockquote {
  margin: 44px 0;
  padding: 0 0 0 26px;
  border-left: 2px solid var(--ink);
  font-size: 27px;
  line-height: 1.28;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}

.article blockquote + p { margin-top: 0; }

.spacer { flex: 1; }

/* ---------- about ---------- */

.about {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 56px;
  padding: 56px var(--gutter) 56px;
  align-items: start;
}

.portrait {
  aspect-ratio: 340 / 425;
  background: repeating-linear-gradient(135deg, #f1f1ef 0 9px, #e7e7e4 9px 18px);
  border: 1px solid var(--rule);
  overflow: hidden;
}

/* The source art carries generous margins of its own; scaling up crops into that
   whitespace so the subject fills the frame. 1.25 is the most it takes before the
   tail and feet start clipping. */
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.25);
}

/* Holds the design's ~550px right-hand column instead of filling the 1fr track. */
.about-body {
  display: flex;
  flex-direction: column;
  max-width: 560px;
}

.about-body h1 {
  margin: 0;
  font-weight: 500;
  font-size: 38px;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}

.about-body p {
  margin: 24px 0 0;
  max-width: 50ch;
  font-size: 18px;
  line-height: 1.62;
  text-wrap: pretty;
}

.about-body p + p { margin-top: 18px; }

/* The closing line reads as a coda, so it sits back from the rest. */
.about-body p:last-child { opacity: 0.62; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .about { grid-template-columns: 1fr; gap: 40px; }
  .portrait { max-width: 340px; }
}

@media (max-width: 720px) {
  :root { --gutter: 24px; }

  .masthead { padding: 24px var(--gutter); }

  .lede { padding: 36px var(--gutter) 32px; }
  .lede p { font-size: 26px; }

  .ledger { padding: 28px var(--gutter); }

  .article { padding: 44px var(--gutter) 0; }
  .article h1 { font-size: 32px; }
  .article p { font-size: 17px; }
  .article blockquote { font-size: 21px; margin: 32px 0; padding-left: 18px; }

  .about-body h1 { font-size: 28px; }
}
