/* Blog UI Kit — page-level styles.
   Inherits tokens from ../../colors_and_type.css */

html, body { margin: 0; padding: 0; background: var(--paper); }
/* Reserve scrollbar gutter on all pages so short pages (contact, about)
   don't shift right when the scrollbar is absent.                     */
html { scrollbar-gutter: stable; }
body.ds-root {
  font-family: var(--font-sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── App shell ───────────────────────────────────────── */
.sl-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 96px 80px;
  box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────── */
.sl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 48px;
  margin-bottom: 128px;
}
.sl-wordmark {
  font-style: italic;
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  cursor: default;
}

.sl-nav {
  display: flex;
  gap: 36px;
  align-items: baseline;
  padding-top: 18px;
}
.sl-nav .sl-nav-item {
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--dur-base) var(--ease-soft);
}
.sl-nav .sl-nav-item:hover { background-size: 100% 1px; }
.sl-nav .sl-nav-item.is-active { color: var(--ink); }
.sl-nav .sl-nav-item.is-active:hover { background-size: 100% 1px; }

/* ── Content area ───────────────────────────────────── */
.sl-main {
  flex: 1;
  animation: sl-enter var(--dur-slow) var(--ease-out);
}
@keyframes sl-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Entry list (homepage) ──────────────────────────── */
.sl-entry-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
  align-items: start;
}
.sl-col {
  display: flex;
  flex-direction: column;
  gap: 64px;
}
.sl-entry {
  cursor: pointer;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.sl-entry:hover { opacity: 0.7; }
.sl-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 32px;
}
.sl-entry-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  margin: 0;
  max-width: 22ch;
}
.sl-entry-num {
  font-size: 14px;
  color: var(--ink);
  flex-shrink: 0;
  font-weight: 400;
}
.sl-entry-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
  white-space: pre-line;
  text-wrap: pretty;
}
.sl-entry-more {
  display: inline-block;
  margin-top: 14px;
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
  background-image: none;
  text-decoration: none;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.sl-entry-more:hover { opacity: 0.55; }

/* ── Post page ──────────────────────────────────────── */
.sl-post {
  max-width: 62ch;
  margin: 0 auto;
}
.sl-back {
  font-size: 14px;
  color: var(--ink-3);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 48px;
  background-image: none;
  transition: color var(--dur-base) var(--ease-soft);
}
.sl-back:hover { color: var(--ink); }

.sl-post-head { margin-bottom: 64px; }
.sl-post-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 18px;
  text-wrap: balance;
}
.sl-post-meta {
  font-size: 14px;
  color: var(--ink-3);
}

.sl-post-subtitle {
  font-size: 22px;
  line-height: 1.4;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-2);
  margin: -8px 0 28px;
  letter-spacing: -0.005em;
  max-width: 56ch;
  text-wrap: balance;
}

.sl-post-photo {
  margin: 0 0 64px;
}
.sl-post-photo img {
  display: block;
  width: 100%;
  height: auto;
}
.sl-post-photo figcaption {
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 10px;
}

.sl-prose p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 22px;
  text-wrap: pretty;
}
.sl-prose p.lead { /* first paragraph keeps its own leading indent in copy */ }

/* Inline body image — sits between paragraphs */
.sl-prose figure {
  margin: 48px 0;
}
.sl-prose figure img {
  display: block;
  width: 100%;
  height: auto;
}
.sl-prose figure figcaption {
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 10px;
}

/* Side-by-side image pair (Notion column_list → two images) */
.sl-prose .sl-img-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 48px 0;
}
.sl-prose .sl-img-pair figure {
  margin: 0;
}
.sl-prose .sl-img-pair figure img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 540px) {
  .sl-prose .sl-img-pair {
    grid-template-columns: 1fr;
  }
}

/* ── Gallery (additional photos below body) ───────────── */
.sl-gallery {
  margin: 64px 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
.sl-gallery figure { margin: 0; }
.sl-gallery img {
  display: block;
  width: 100%;
  height: auto;
}
.sl-gallery figcaption {
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 10px;
}
@media (min-width: 720px) {
  .sl-gallery.cols-2 { grid-template-columns: 1fr 1fr; gap: 24px; }
}

.sl-post-nav {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.sl-post-nav a {
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  max-width: 24ch;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--dur-base) var(--ease-soft), opacity var(--dur-base) var(--ease-soft);
  padding-bottom: 2px;
}
.sl-post-nav a:hover { background-size: 100% 1px; }

/* ── Projects page ──────────────────────────────────── */
.sl-projects {}
.sl-projects-h {
  font-size: 40px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}
.sl-projects-sub {
  font-size: 16px;
  color: var(--ink-3);
  margin: 0 0 64px;
}
.sl-projects-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sl-project {
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  cursor: pointer;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.sl-project:hover { opacity: 0.7; }
.sl-project:last-child { border-bottom: 1px solid var(--rule); }
.sl-app a.sl-project-link {
  display: block;
  color: inherit;
  text-decoration: none;
  background-image: none;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.sl-app a.sl-project-link:hover { opacity: 0.7; }
.sl-project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
}
.sl-project-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.sl-project-year {
  font-size: 14px;
  color: var(--ink-3);
}
.sl-project-note {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0;
  max-width: 56ch;
}

/* ── About page ─────────────────────────────────────── */
.sl-about {}
.sl-about .sl-prose { max-width: 62ch; }
.sl-about-h {
  font-size: 40px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  margin: 0 0 48px;
  color: var(--ink);
}
.sl-about-contact {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--ink-3);
}
.sl-about-contact a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: opacity var(--dur-base) var(--ease-soft);
  padding-bottom: 1px;
}
.sl-about-contact a:hover { opacity: 0.55; }

/* ── Contact placeholder ────────────────────────────── */
.sl-contact {}
.sl-contact-h {
  font-size: 40px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}
.sl-contact p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 22px;
  max-width: 62ch;
}
.sl-contact a {
  color: var(--ink);
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  text-decoration: none;
}

/* ── Footer ─────────────────────────────────────────── */
.sl-footer {
  margin-top: 128px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.sl-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}
.sl-footer-mark {
  font-style: italic;
  font-size: 14px;
  color: var(--ink);
}
.sl-footer-meta {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* ── Responsive — collapse to one column under 800 ─── */
@media (max-width: 900px) {
  .sl-app { padding: 32px 24px 48px; }
  .sl-header { flex-direction: column; align-items: flex-start; gap: 32px; margin-bottom: 64px; }
  .sl-wordmark { font-size: 36px; }
  .sl-nav { padding-top: 0; flex-wrap: wrap; gap: 24px; }
  .sl-entry-list { grid-template-columns: 1fr; gap: 64px; }
  .sl-post-title { font-size: 32px; }
}

/* ── Static-site overrides (no-JS build) ────────────────
   Whole-entry anchor wrapping for the homepage cards.
   Higher specificity (.sl-app a.sl-entry-link) to beat .ds-root a. */
.sl-app a.sl-entry-link {
  display: block;
  color: inherit;
  text-decoration: none;
  background-image: none;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.sl-app a.sl-entry-link:hover { opacity: 0.7; }
.sl-app a.sl-entry-link .sl-entry-more {
  display: inline-block;
  margin-top: 14px;
  background-image: none;
}

/* ── Feed (homepage) — search + infinite scroll ──────── */
.sl-feed-tools {
  margin-bottom: 96px;
}
.sl-search {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 8px;
  transition: border-color var(--dur-base) var(--ease-soft);
}
.sl-search:focus-within { border-bottom-color: var(--ink); }

.sl-search input {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 20px;
  font-style: italic;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: 4px 0;
  min-width: 0;
}
.sl-search input::placeholder {
  color: var(--ink-4);
  font-style: italic;
}
/* Strip the native search-input clear button */
.sl-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.sl-search-meta {
  font-size: 13px;
  color: var(--ink-3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.sl-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: row;
  column-gap: 96px;
  row-gap: 0;
  align-items: start;
}

.sl-feed-entry {
  /* default — falls back to visible if no JS */
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
}
/* Top two cards (first row) have no top border */
.sl-feed-entry:nth-child(1),
.sl-feed-entry:nth-child(2) { border-top: none; padding-top: 0; }

/* When JS is in charge, entries fade in once revealed. Otherwise visible. */
body.js-on .sl-feed-entry:not(.is-revealed) {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}
body.js-on .sl-feed-entry.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.sl-entry-date {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
}

.sl-feed-end,
.sl-feed-empty {
  margin: 64px 0 32px;
  text-align: center;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-3);
}

.sl-sentinel {
  height: 1px;
  width: 100%;
}

/* ── Responsive — collapse feed to one column ──────── */
@media (max-width: 900px) {
  .sl-feed { grid-template-columns: 1fr; column-gap: 0; }
  .sl-feed-entry:nth-child(1) { border-top: none; padding-top: 0; }
  .sl-feed-entry:nth-child(2) { border-top: 1px solid var(--rule); padding-top: 32px; }
  .sl-feed-tools { margin-bottom: 64px; }
  .sl-search input { font-size: 18px; }
}

/* ── Cross-document page transitions ────────────────────────────
   Chrome 126+ / Safari 18.2+. Firefox falls back to instant nav.
   Matches the existing sl-enter vocabulary: fade + small Y shift. */
@view-transition {
  navigation: auto;
}

@keyframes sl-vt-out {
  to { opacity: 0; transform: translateY(-3px); }
}
@keyframes sl-vt-in {
  from { opacity: 0; transform: translateY(5px); }
}

::view-transition-old(root) {
  animation: 160ms ease-in both sl-vt-out;
}
::view-transition-new(root) {
  animation: 300ms cubic-bezier(0.16, 1, 0.3, 1) both sl-vt-in;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.01ms;
  }
}

/* Always carry a transition on chrome so un-hover also animates gradually.
   The 90 ms delay on restore covers inter-card mouse gaps — if the mouse
   re-enters a card within that window the restore cancels silently.      */
.sl-header,
.sl-feed-tools,
.sl-footer {
  transition: opacity 0.5s var(--ease-soft) 0.09s;
}

/* Dim chrome when any entry is being hovered */
body:has(.sl-feed-entry:hover) .sl-header,
body:has(.sl-feed-entry:hover) .sl-feed-tools,
body:has(.sl-feed-entry:hover) .sl-footer {
  opacity: 0.15;
}

/* Dim sibling entries — 90 ms delay on restore to prevent inter-card flicker */
.sl-feed-entry {
  transition: opacity 0.48s var(--ease-soft) 0.09s, transform 0.48s var(--ease-soft) 0.09s !important;
}
.sl-feed:has(.sl-feed-entry:hover) .sl-feed-entry:not(:hover) {
  opacity: 0.18;
}

/* Lift + scale the hovered entry; faster enter than exit (exit uses the base rule above) */
body.js-on .sl-feed-entry.is-revealed:hover,
.sl-feed-entry:hover {
  transform: translateY(-14px) scale(1.022) !important;
  transition: opacity 0.22s var(--ease-soft), transform 0.22s var(--ease-soft) !important;
}

/* Keep hovered entry's link fully opaque — entry controls opacity now */
.sl-feed-entry:hover a.sl-entry-link,
.sl-feed-entry:hover a.sl-entry-link:hover {
  opacity: 1;
}
