/* ============================================================
   SITE — implementation layer. Builds the personal site on top
   of the design system (css/styles.css). Every value reads from
   a token, so a design refresh stays a token change.
   ============================================================ */

:root { --gutter: var(--space-6); }   /* 32px page gutter */

html { scroll-behavior: smooth; }
body { min-height: 100vh; }

/* Generic centered measure */
.wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Accessible visually-hidden (for headings the design keeps implicit) */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Links inside running text ---- */
.link {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-soft);
  font-weight: var(--weight-medium);
  transition: text-decoration-color .18s ease;
}
.link:hover { text-decoration-color: var(--accent); }

/* ============================================================
   HEADER — sticky, washi-blur, hairline base. (Hidden on home.)
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-header__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-4) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 30px; }
.nav__link {
  position: relative;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color .18s ease;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
.nav__link:hover { color: var(--text); }
.nav__link:hover::after,
.nav__link[aria-current="page"]::after { transform: scaleX(1); }
.nav__link[aria-current="page"] { color: var(--text); }

/* ============================================================
   FOOTER — floating social row, centered at the page foot.
   ============================================================ */
.social {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
}
.social__link {
  display: inline-flex;
  color: var(--text-muted);
  transition: color .18s ease;
}
.social__link:hover { color: var(--accent-deep); }
.social__link svg { display: block; }

/* ============================================================
   HOME — a still, centered landing.
   ============================================================ */
.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 var(--gutter);
  gap: var(--space-6);
}
.home__avatar {
  width: 84px; height: 84px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1px solid var(--hairline);
}
.home__name {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, var(--text-3xl));
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.home__kicker { margin-top: var(--space-3); white-space: nowrap; }
.home__links {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-2);
}

/* Underlined text link used on home + "keep reading" */
.home-link {
  position: relative;
  font-family: var(--font-body);
  font-size: var(--text-md);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color .18s ease;
}
.home-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--text);
  opacity: 0.55;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.home-link:hover { color: var(--text); }
.home-link:hover::after { transform: scaleX(1); }
.home-link--primary { color: var(--accent-deep); }
.home-link--primary::after { background: var(--accent); opacity: 1; transform: scaleX(1); }

/* ============================================================
   ABOUT
   ============================================================ */
.about {
  min-height: calc(100vh - 61px);
  display: flex;
  align-items: center;
  padding: var(--space-5) var(--gutter);
}
.about__inner { max-width: 46rem; margin-inline: auto; width: 100%; }
.about__head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: var(--space-6);
}
.about__avatar {
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1px solid var(--hairline);
  flex: none;
}
.about__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
}
.about__body { font-size: var(--text-base); line-height: 1.7; color: var(--text); }
.about__body p + p { margin-top: var(--space-4); }
.about__body .muted { color: var(--text-muted); }

/* ============================================================
   WRITING INDEX
   ============================================================ */
.writing {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-9) var(--gutter);
}
.writing__empty {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

/* PostCard — one entry in the writing list. Self-themes via data-theme. */
.post-card {
  display: block;
  position: relative;
  padding: 28px 0 28px 28px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
}
.post-card::before {
  content: "";
  position: absolute;
  left: 0; top: 32px;
  width: 3px; height: 18px;
  background: var(--accent);
  transition: height .25s ease;
}
.post-card:hover::before { height: 44px; }
.post-card__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.post-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  margin-top: 10px;
  color: var(--text);
  transition: color .18s ease;
}
.post-card:hover .post-card__title { color: var(--accent-deep); }
.post-card__excerpt {
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 40rem;
  font-size: var(--text-base);
}
.post-card__tags { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ============================================================
   TAG — small hairline topic marker.
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
}
.tag--accent {
  color: var(--accent-deep);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}
.tag--solid {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

/* ============================================================
   DIVIDER — ink hairline, optional seal ornament.
   ============================================================ */
.divider { border: 0; height: 1px; background: var(--hairline); margin: 0; }
.divider--ornament {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 0;
  background: none;
  height: auto;
}
.divider--ornament::before,
.divider--ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}
.divider--ornament > span {
  width: 6px; height: 6px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  flex: none;
}

/* ============================================================
   POST — bespoke reading view. The <article> carries data-theme.
   ============================================================ */
.post__top { max-width: var(--container); margin-inline: auto; padding: var(--space-5) var(--gutter) 0; }
.post__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: color .18s ease;
}
.post__back:hover { color: var(--text); }
.post__back svg { width: 15px; height: 15px; }

.post__hero-wrap { margin-top: var(--space-5); }

/* — Hero variant: note (default) — quiet tinted wash, vertical tag label — */
.post-hero {
  background: var(--bg-tint);
  border-bottom: 1px solid var(--hairline);
}
.post-hero__inner {
  max-width: 52rem;
  margin-inline: auto;
  padding: var(--space-9) var(--gutter) var(--space-7);
  position: relative;
}
.post-hero__vlabel {
  position: absolute;
  right: var(--gutter);
  top: var(--space-9);
  writing-mode: vertical-rl;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
}
.post-hero__title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
  max-width: 18ch;
}

/* — Hero variant: manifesto — full-bleed accent band — */
.post-hero--manifesto {
  background: var(--accent);
  color: var(--on-accent);
  border-bottom: 0;
}
.post-hero--manifesto .post-hero__inner {
  padding: var(--space-9) var(--gutter) var(--space-8);
}
.post-hero--manifesto .post-hero__eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: var(--space-5);
}
.post-hero--manifesto .post-hero__title {
  font-size: clamp(2.4rem, 5vw, var(--text-4xl));
  font-weight: var(--weight-bold);
  line-height: 1.08;
  max-width: 16ch;
}

/* — Hero variant: diagram — mono statechart node graph — */
.post-hero--diagram {
  background: var(--bg-tint);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.post-hero--diagram .post-hero__inner { padding: var(--space-8) var(--gutter); }
.post-hero--diagram .post-hero__title { font-weight: var(--weight-bold); }
.statechart {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
}
.statechart__node {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 14px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--accent-deep);
  white-space: nowrap;
}
.statechart__node--active { background: var(--accent); color: var(--on-accent); }
.statechart__arrow { color: var(--accent); }
.statechart__loop { margin-left: 8px; color: var(--accent); }

/* — Post body — comfortable reading column — */
.post__body { max-width: 38rem; margin-inline: auto; padding: var(--space-8) var(--gutter) 0; }
.post__tags { display: flex; gap: 8px; margin-bottom: var(--space-6); flex-wrap: wrap; }
.post__lede {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--text);
  margin-bottom: var(--space-6);
}
.post__prose { font-size: var(--text-md); line-height: 1.85; color: var(--text); }
.post__prose p { margin-bottom: var(--space-5); }
.post__prose p.muted { color: var(--text-muted); }
.post__prose blockquote {
  margin: var(--space-6) 0;
  padding-left: var(--space-5);
  border-left: 3px solid var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.4;
  color: var(--accent-deep);
}
.post__prose pre {
  background: var(--sumi-900);
  color: #e8e3d8;
  padding: var(--space-5);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
  margin: var(--space-6) 0;
}
.post__byline {
  margin: var(--space-8) 0 var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* — Keep reading — */
.post__more { max-width: var(--container); margin-inline: auto; padding: var(--space-7) var(--gutter) 0; }
.post__more-label { margin: var(--space-6) 0 var(--space-3); }
.more-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  gap: 20px;
}
.more-link__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  transition: color .18s ease;
}
.more-link:hover .more-link__title { color: var(--accent-deep); }
.more-link__arrow { color: var(--accent); font-family: var(--font-mono); flex: none; }

/* Bottom padding so floating social never overlaps content */
.page-foot-space { height: var(--space-9); }

/* ============================================================
   MOTION — thoughtful, restrained: calm fades, no bounce.
   ============================================================ */
@keyframes jp-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes jp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes jp-seal {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: none; }
}
.jp-rise { opacity: 0; animation: jp-rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards; animation-delay: var(--d, 0s); }
.jp-seal-in { opacity: 0; animation: jp-seal 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards; animation-delay: var(--d, 0s); }
.jp-screen { animation: jp-fade 0.5s ease both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .jp-rise, .jp-seal-in, .jp-screen { animation: none; opacity: 1; transform: none; }
}
