:root {
  --bg: #f6f3ed;
  --bg-warm: #efe8dc;
  --ink: #1c1917;
  --ink-muted: #57534e;
  --ink-faint: #78716c;
  --accent: #7c2d12;
  --line: rgba(28, 25, 23, 0.12);
  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Newsreader", Georgia, serif;
  --max: 38rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* bookshelf cards — shadows / radii aligned with jakub.kr “details” guidance */
  --book-r-outer: 18px;
  --book-pad-inline: 14px;
  --book-border-shadow: rgba(28, 25, 23, 0.06);
  --book-cover-r: calc(var(--book-r-outer) - var(--book-pad-inline));
  --shadow-book-card:
    0 0 0 1px var(--book-border-shadow),
    0 1px 2px -1px rgba(28, 25, 23, 0.06),
    0 2px 8px rgba(28, 25, 23, 0.05);
  --shadow-book-card-hover:
    0 0 0 1px rgba(28, 25, 23, 0.08),
    0 1px 4px -1px rgba(28, 25, 23, 0.08),
    0 10px 24px rgba(28, 25, 23, 0.08);
  /* surfaces — jakub.kr-style stacked shadows vs hard borders */
  --shadow-surface:
    0 0 0 1px rgba(28, 25, 23, 0.06),
    0 1px 2px -1px rgba(28, 25, 23, 0.06),
    0 2px 6px rgba(28, 25, 23, 0.04);
  /* project cards — concentric radius (inner = outer − padding) + shadow stack, jakub.kr details */
  --project-card-r: 22px;
  --project-card-pad: 16px;
  --project-card-inner-r: calc(var(--project-card-r) - var(--project-card-pad));
  --shadow-project-card:
    0 0 0 1px rgba(28, 25, 23, 0.06),
    0 1px 2px -1px rgba(28, 25, 23, 0.06),
    0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-project-card-hover:
    0 0 0 1px rgba(28, 25, 23, 0.08),
    0 1px 4px -1px rgba(28, 25, 23, 0.08),
    0 10px 24px rgba(28, 25, 23, 0.07);
  --radius-ui: 10px;
  --enter: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Page load — calm deceleration, portfolio-style (cf. nikosalkola.com) */
  --ease-page: cubic-bezier(0.16, 1, 0.3, 1);
  --page-dur-hero: 1s;
  --page-dur-block: 0.95s;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--grain), radial-gradient(ellipse 120% 80% at 50% -20%, var(--bg-warm), transparent 55%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(124, 45, 18, 0.35);
  text-underline-offset: 0.2em;
  transition:
    color 0.28s var(--enter),
    text-decoration-color 0.28s var(--enter);
}

a:hover {
  color: #431407;
  text-decoration-color: rgba(67, 24, 7, 0.5);
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

@media (min-width: 640px) {
  .wrap {
    padding: 4.5rem 2rem 6rem;
  }
}

header {
  margin-bottom: 3.5rem;
}

header .name {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6vw, 3.35rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.5rem;
  opacity: 0;
  animation: rise var(--page-dur-hero) var(--ease-page) forwards;
  text-wrap: balance;
}

header .hero-role {
  margin: 0 0 1.35rem;
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0;
  animation: rise var(--page-dur-hero) var(--ease-page) 0.14s forwards;
  text-wrap: balance;
}

/* Section h2 — type on scroll (hero h1 uses rise only, no typewriter) */
.heading-typeable__static {
  display: none;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

html.no-js .heading-typeable__static {
  display: block;
}

html.no-js .heading-typeable__measure,
html.no-js .heading-typeable__row {
  display: none !important;
}

main h2.heading-typeable,
.heading-typeable {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

main h2.heading-typeable > .heading-typeable__measure,
main h2.heading-typeable > .heading-typeable__row,
.heading-typeable > .heading-typeable__measure,
.heading-typeable > .heading-typeable__row {
  grid-area: 1 / 1;
}

.heading-typeable__measure {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.heading-typeable__row {
  display: inline-flex;
  align-items: baseline;
  min-height: 1.2em;
}

.heading-typeable__caret {
  display: inline-block;
  flex-shrink: 0;
  width: 0;
  height: 0.72em;
  margin-inline-start: 0;
  translate: 0 0.08em;
  background-color: currentColor;
  opacity: 0;
  animation: none;
}

main h2.heading-typeable.heading-typeable--typing .heading-typeable__caret,
.heading-typeable.heading-typeable--typing .heading-typeable__caret {
  width: 2px;
  height: 0.72em;
  margin-inline-start: 3px;
  opacity: 0.85;
  animation: nameCaretBlink 1s steps(2, jump-end) infinite;
}

main h2.heading-typeable.heading-typeable--caret-off .heading-typeable__caret,
.heading-typeable.heading-typeable--caret-off .heading-typeable__caret {
  animation: none;
  opacity: 0;
  width: 0;
  margin-inline-start: 0;
}

@keyframes nameCaretBlink {
  50% {
    opacity: 0;
  }
}

html.no-js main h2.heading-typeable,
html.no-js .heading-typeable {
  display: block;
}

header .hero-lede,
header .hero-tail {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 28px;
  color: var(--ink-muted);
  opacity: 0;
  text-wrap: pretty;
}

header .hero-lede {
  animation: rise var(--page-dur-hero) var(--ease-page) 0.28s forwards;
}

header .hero-tail {
  margin-top: 1rem;
  animation: rise var(--page-dur-hero) var(--ease-page) 0.42s forwards;
}

header .hero-lede a,
header .hero-tail a,
.bookshelf-lede a {
  color: inherit;
  text-decoration-color: currentColor;
}

header .hero-lede a:hover,
header .hero-tail a:hover,
.bookshelf-lede a:hover {
  color: #7c2d12;
  text-decoration-color: currentColor;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.62rem 0.85rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  opacity: 0;
  animation: rise var(--page-dur-hero) var(--ease-page) 0.52s forwards;
}

.hero-actions li {
  display: inline-flex;
}

/* Ghost pills: link reset + surface stack (jakub.kr) + ≥40px target + 0.96 press */
a.hero-btn {
  text-decoration: none;
  text-decoration-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.85rem;
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  border: none;
  border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-surface);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    color 0.28s var(--enter),
    background 0.28s var(--enter),
    box-shadow 0.28s var(--enter),
    transform 0.22s var(--enter);
}

a.hero-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(28, 25, 23, 0.08),
    0 1px 4px -1px rgba(28, 25, 23, 0.08),
    0 6px 14px rgba(28, 25, 23, 0.06);
}

a.hero-btn:focus-visible {
  outline: 2px solid rgba(124, 45, 18, 0.45);
  outline-offset: 3px;
}

a.hero-btn:active {
  transform: scale(0.96);
  transition-duration: 0.15s;
}

/* Outlined secondary — pairs with default filled primary */
a.hero-btn.hero-btn--secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-muted);
  border: 1px solid rgba(28, 25, 23, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 1px 2px rgba(28, 25, 23, 0.04);
  transition:
    color 0.28s var(--enter),
    background 0.28s var(--enter),
    border-color 0.28s var(--enter),
    box-shadow 0.28s var(--enter),
    transform 0.22s var(--enter);
}

a.hero-btn.hero-btn--secondary:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(28, 25, 23, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(28, 25, 23, 0.06),
    0 2px 8px rgba(28, 25, 23, 0.07);
}

/* Text-style tertiary — subpage back navigation */
a.hero-btn.hero-btn--tertiary {
  gap: 0.375rem;
  padding: 0.35rem 0.625rem;
  margin-inline-start: -0.35rem;
  background: transparent;
  box-shadow: none;
  color: var(--ink-faint);
  justify-content: center;
  align-items: center;
}

a.hero-btn.hero-btn--tertiary:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
}

a.hero-btn.hero-btn--tertiary .hero-btn__icon {
  flex-shrink: 0;
  display: block;
  width: 13px;
  height: 13px;
  opacity: 0.85;
}

a.hero-btn.hero-btn--tertiary .hero-btn__label {
  line-height: 1;
  padding-block: 0.08em;
}

a.hero-btn.hero-btn--tertiary:hover .hero-btn__icon {
  opacity: 1;
}

header .hero-lede em {
  font-style: italic;
  color: var(--ink);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 0.75rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

main > section {
  opacity: 1;
}

/* Headings lead each block; body follows (~100ms stagger per jakub.kr-style cadence) */
main h2 {
  text-wrap: balance;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) forwards;
}

main > section:nth-of-type(1) > h2 {
  animation-delay: 0.58s;
}

main > section:nth-of-type(2) > h2 {
  animation-delay: 0.68s;
}

main > section:nth-of-type(3) > h2 {
  animation-delay: 0.78s;
}

main > section:nth-of-type(4) > h2 {
  animation-delay: 0.88s;
}

main > section:nth-of-type(n + 5) > h2 {
  animation-delay: 0.98s;
}

main > section > *:not(h2) {
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) forwards;
}

main > section:nth-of-type(1) > *:not(h2) {
  animation-delay: 0.68s;
}

main > section:nth-of-type(2) > *:not(h2) {
  animation-delay: 0.78s;
}

main > section:nth-of-type(3) > *:not(h2) {
  animation-delay: 0.88s;
}

main > section:nth-of-type(4) > *:not(h2) {
  animation-delay: 0.98s;
}

main > section:nth-of-type(n + 5) > *:not(h2) {
  animation-delay: 1.08s;
}

main hr.decor {
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.85s forwards;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  header .name {
    animation: none;
    opacity: 1;
    transform: none;
  }

  header .hero-role,
  header .hero-lede,
  header .hero-tail,
  .hero-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }

  a.hero-btn,
  a.hero-btn.hero-btn--secondary,
  a.hero-btn.hero-btn--tertiary {
    transition-property: color, background, box-shadow, border-color, opacity;
  }

  a.hero-btn:active {
    transform: none;
  }

  main > section {
    opacity: 1;
  }

  main h2,
  main > section > *:not(h2),
  main hr.decor {
    animation: none;
    opacity: 1;
    transform: none;
  }

  footer {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .footer-dots__dot {
    animation: none !important;
    opacity: 0.55;
    transform: none;
  }

  .page-sub .subpage-nav,
  .page-sub .subpage-portrait,
  .page-sub .subpage-title,
  .page-sub .subpage-lede,
  .page-sub .subpage-subtitle,
  .page-sub main.subpage .work-experience .writing-list,
  .page-sub main.subpage .work-experience .work-list-tail {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .project-card:hover,
  .project-card:active {
    transform: none;
  }

  .project-card {
    transition: none;
  }

  .project-card__cta {
    transition: none;
    opacity: 1;
    transform: none;
    color: var(--ink-faint);
  }

  .project-card:hover .project-card__cta,
  .project-card:focus-visible .project-card__cta {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.42);
  }
}

main p {
  text-wrap: pretty;
}

section {
  margin-bottom: 3rem;
}

section:last-of-type {
  margin-bottom: 0;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  color: var(--ink);
}

p {
  margin: 0 0 1rem;
  color: var(--ink-muted);
}

p:last-child {
  margin-bottom: 0;
}

#mailing > p {
  line-height: 28px;
}

.writing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.writing-list li {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding: 0.95rem 0;
  border-bottom: none;
  box-shadow: 0 1px 0 0 rgba(28, 25, 23, 0.07);
}

.writing-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.writing-head a {
  flex: 1 1 auto;
  min-width: min(14rem, 100%);
  font-weight: 500;
  line-height: 28px;
  color: var(--ink);
  text-decoration: none;
  transition:
    color 0.26s var(--enter),
    text-decoration-color 0.26s var(--enter);
}

.writing-head a:hover {
  color: var(--accent);
}

.writing-head a:focus-visible {
  outline: 2px solid rgba(124, 45, 18, 0.45);
  outline-offset: 3px;
  border-radius: 2px;
}

.writing-date {
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  white-space: nowrap;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  margin-inline-start: auto;
  text-align: right;
}

.writing-list li:first-child {
  padding-top: 0;
}

.writing-list li:last-child {
  box-shadow: none;
  padding-bottom: 0.05rem;
}

.writing-meta {
  font-size: 0.9375rem;
  line-height: 24px;
  color: var(--ink-faint);
  text-wrap: pretty;
  letter-spacing: 0.02em;
}

.writing-primary {
  font-weight: 500;
  color: var(--ink);
  display: block;
  margin-bottom: 0.15rem;
  font-size: 1rem;
  text-wrap: balance;
}

/* Projects — jakub.kr-style linked cards */
.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 520px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
    gap: 1rem 1.125rem;
  }
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  height: 100%;
  padding: var(--project-card-pad);
  border-radius: var(--project-card-r);
  border: none;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-project-card);
  color: inherit;
  text-decoration: none;
  transition-property: transform, box-shadow;
  transition-duration: 0.42s;
  transition-timing-function: var(--enter);
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-project-card-hover);
}

.project-card:hover .project-card__cta,
.project-card:focus-visible .project-card__cta {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
}

.project-card__cta {
  position: absolute;
  top: calc(var(--project-card-pad) - 6px);
  right: calc(var(--project-card-pad) - 6px);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-ui);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.35;
  color: var(--ink-faint);
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(2px, -2px, 0);
  transition:
    opacity 0.28s var(--enter),
    transform 0.28s var(--enter),
    color 0.28s var(--enter),
    background 0.28s var(--enter);
}

.project-card__cta-arrow {
  flex-shrink: 0;
  display: block;
  width: 10px;
  height: 10px;
  opacity: 0.85;
  translate: 0 0.04em;
}

.project-card:hover .project-card__cta-arrow,
.project-card:focus-visible .project-card__cta-arrow {
  opacity: 1;
}

.project-card:active {
  transform: translateY(-1px) scale(0.96);
  transition-duration: 0.18s;
}

.project-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-grow: 1;
  min-width: 0;
}

.project-card:focus-visible {
  outline: 2px solid rgba(124, 45, 18, 0.45);
  outline-offset: 3px;
}

.project-card__logo {
  align-self: flex-start;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--project-card-inner-r);
  object-fit: cover;
  flex-shrink: 0;
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.05);
}

.project-card__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
  transition: color 0.32s var(--enter);
}

.project-card:hover .project-card__name {
  color: var(--accent);
}

.project-card__desc {
  display: block;
  margin: 0;
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-muted);
  text-wrap: pretty;
  flex-grow: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags a {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: none;
  box-shadow: 0 1px 0 0 rgba(87, 83, 78, 0.22);
  transition:
    color 0.26s var(--enter),
    box-shadow 0.26s var(--enter);
}

.tags a:hover {
  color: var(--accent);
  box-shadow: 0 1px 0 0 rgba(124, 45, 18, 0.35);
}

.tags.tags--static {
  align-items: baseline;
  column-gap: 0;
  row-gap: 0.35rem;
}

.tags.tags--static li {
  display: inline-flex;
  align-items: baseline;
  font-size: 0.9375rem;
  line-height: 24px;
  color: var(--ink-muted);
  padding: 0.15rem 0;
  border-bottom: none;
  box-shadow: 0 1px 0 0 rgba(87, 83, 78, 0.22);
  transition:
    color 0.26s var(--enter),
    box-shadow 0.26s var(--enter),
    opacity 0.26s var(--enter);
}

.tags.tags--static li:hover {
  color: var(--ink);
  box-shadow: 0 1px 0 0 rgba(28, 25, 23, 0.18);
}

.tags.tags--static li:has(> a) {
  box-shadow: none;
  color: inherit;
}

.tags.tags--static li:has(> a):hover {
  box-shadow: none;
  color: inherit;
}

.tags.tags--static li > a {
  display: inline-block;
  font-size: inherit;
  line-height: 24px;
  color: var(--ink-muted);
  text-decoration: none !important;
  text-decoration-thickness: 0 !important;
  padding: 0;
  border-bottom: none;
  box-shadow: 0 1px 0 0 rgba(87, 83, 78, 0.22);
  transition:
    color 0.26s var(--enter),
    box-shadow 0.26s var(--enter);
}

.tags.tags--static li > a:hover {
  color: var(--accent);
  box-shadow: 0 1px 0 0 rgba(124, 45, 18, 0.35);
}

.tags.tags--static li > a:focus-visible {
  outline: 2px solid rgba(124, 45, 18, 0.45);
  outline-offset: 3px;
  border-radius: 2px;
}

.tags.tags--static li:not(:last-child)::after {
  content: "";
  display: block;
  width: 0.1875rem;
  height: 0.1875rem;
  margin: 0 0.5rem;
  border-radius: 50%;
  background: var(--ink-faint);
  opacity: 0.7;
  align-self: center;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

.bookshelf-lede {
  margin: 0 0 1.1rem;
  font-size: 1rem;
  line-height: 28px;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.books {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 480px) {
  .books {
    grid-template-columns: repeat(2, 1fr);
  }
}

.book {
  --book-gap: 1rem;
  display: flex;
  align-items: center;
  gap: var(--book-gap);
  padding: calc(var(--book-pad-inline) + 1px) 1.1rem calc(var(--book-pad-inline) + 1px)
    var(--book-pad-inline);
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-radius: var(--book-r-outer);
  box-shadow: var(--shadow-book-card);
  transition:
    transform 0.42s var(--enter),
    box-shadow 0.42s var(--enter);
}

.book:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-book-card-hover);
}

.book:active {
  transform: translateY(-1px);
  transition-duration: 0.18s;
}

.book:hover .book-cover img {
  box-shadow:
    0 6px 16px rgba(28, 25, 23, 0.1),
    0 2px 4px rgba(28, 25, 23, 0.04),
    0 0 0 1px rgba(28, 25, 23, 0.08);
}

.book-cover {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  /* optical: pull cover slightly nearer to card edge vs text block (icon-side padding) */
  margin-left: -2px;
}

.book-cover img {
  display: block;
  width: clamp(4.25rem, 28vw, 5.25rem);
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: cover;
  border-radius: var(--book-cover-r);
  outline: 1px solid rgba(28, 25, 23, 0.1);
  outline-offset: -1px;
  box-shadow:
    0 1px 2px rgba(28, 25, 23, 0.05),
    0 4px 12px rgba(28, 25, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: box-shadow 0.42s var(--enter);
}

.book-text {
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}

.book-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

.book-author {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-faint);
  text-wrap: pretty;
}

.subscribe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-width: 24rem;
}

.subscribe input[type="email"] {
  flex: 1 1 12rem;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.62rem 0.82rem;
  border: none;
  border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: var(--shadow-surface);
  transition:
    box-shadow 0.3s var(--enter),
    background 0.3s var(--enter);
}

.subscribe input[type="email"]::placeholder {
  color: var(--ink-faint);
}

.subscribe input[type="email"]:focus {
  outline: none;
  border: none;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 0 0 1px rgba(124, 45, 18, 0.2),
    0 2px 6px rgba(28, 25, 23, 0.06),
    0 0 0 4px rgba(124, 45, 18, 0.08);
}

.subscribe button {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.62rem 1.15rem;
  border: none;
  border-radius: var(--radius-ui);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.12);
  transition:
    background 0.28s var(--enter),
    transform 0.22s var(--enter),
    box-shadow 0.28s var(--enter);
}

.subscribe button:hover {
  background: #292524;
  box-shadow: var(--shadow-surface);
}

.subscribe button:active {
  transform: scale(0.98);
}

.gate-modal {
  padding: 0;
  border: none;
  margin: auto;
  max-width: calc(100vw - 2rem);
  background: transparent;
  color: var(--ink);
}

.gate-modal::backdrop {
  background: rgba(28, 25, 23, 0.38);
  backdrop-filter: blur(3px);
}

.gate-modal__panel {
  padding: 1.45rem 1.35rem 1.25rem;
  width: min(21rem, calc(100vw - 2.25rem));
  border-radius: var(--project-card-r);
  background: var(--bg);
  box-shadow:
    0 0 0 1px rgba(28, 25, 23, 0.08),
    0 12px 40px rgba(28, 25, 23, 0.14);
}

.gate-modal__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}

.gate-modal__lede {
  margin: 0 0 0.95rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.gate-modal__config {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.gate-modal__config code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8125em;
  color: var(--ink);
  word-break: break-word;
}

.gate-modal__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.62rem 0.82rem;
  border: none;
  border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: var(--shadow-surface);
  transition:
    box-shadow 0.3s var(--enter),
    background 0.3s var(--enter);
}

.gate-modal__input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 0 0 1px rgba(124, 45, 18, 0.2),
    0 2px 6px rgba(28, 25, 23, 0.06),
    0 0 0 4px rgba(124, 45, 18, 0.08);
}

.gate-modal__error {
  margin: 0.55rem 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--accent);
}

.gate-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.gate-modal__btn {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.55rem 1.05rem;
  border: none;
  border-radius: var(--radius-ui);
  cursor: pointer;
  transition:
    background 0.28s var(--enter),
    color 0.28s var(--enter),
    transform 0.22s var(--enter),
    box-shadow 0.28s var(--enter);
}

.gate-modal__btn:active {
  transform: scale(0.98);
}

.gate-modal__btn--secondary {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-muted);
  box-shadow: var(--shadow-surface);
}

.gate-modal__btn--secondary:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.gate-modal__btn--primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.12);
}

.gate-modal__btn--primary:hover {
  background: #292524;
}

hr.decor {
  border: none;
  height: 1px;
  margin: 2.75rem 0;
  background: rgba(28, 25, 23, 0.075);
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.05);
}

footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  text-align: center;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 1.08s forwards;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
}

.footer-tag {
  font-size: 0.9375rem;
  color: var(--ink-faint);
  font-style: italic;
  margin: 0 0 1rem;
}

.footer-symbol {
  margin: 0;
  line-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 48px;
  min-height: 0;
}

.footer-dots {
  display: grid;
  grid-template-columns: repeat(12, 3px);
  grid-template-rows: repeat(8, 3px);
  column-gap: 2px;
  row-gap: 2px;
  justify-content: center;
  pointer-events: none;
}

.footer-dots__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-faint);
  opacity: 0.08;
  transform: scale(0.6);
  animation-name: footer-dot-load;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}

.footer-symbol.is-in-view .footer-dots__dot {
  animation-play-state: running;
}

.footer-dots__dot:nth-child(1) { grid-row: 1; grid-column: 5; animation-duration: 9.803s; animation-delay: 0s; }
.footer-dots__dot:nth-child(2) { grid-row: 1; grid-column: 6; animation-duration: 9.638s; animation-delay: 0.165s; }
.footer-dots__dot:nth-child(3) { grid-row: 2; grid-column: 4; animation-duration: 9.473s; animation-delay: 0.33s; }
.footer-dots__dot:nth-child(4) { grid-row: 2; grid-column: 5; animation-duration: 9.308s; animation-delay: 0.495s; }
.footer-dots__dot:nth-child(5) { grid-row: 2; grid-column: 6; animation-duration: 9.143s; animation-delay: 0.66s; }
.footer-dots__dot:nth-child(6) { grid-row: 2; grid-column: 7; animation-duration: 8.978s; animation-delay: 0.825s; }
.footer-dots__dot:nth-child(7) { grid-row: 2; grid-column: 8; animation-duration: 8.813s; animation-delay: 0.99s; }
.footer-dots__dot:nth-child(8) { grid-row: 3; grid-column: 3; animation-duration: 8.648s; animation-delay: 1.155s; }
.footer-dots__dot:nth-child(9) { grid-row: 3; grid-column: 4; animation-duration: 8.483s; animation-delay: 1.32s; }
.footer-dots__dot:nth-child(10) { grid-row: 3; grid-column: 5; animation-duration: 8.318s; animation-delay: 1.485s; }
.footer-dots__dot:nth-child(11) { grid-row: 3; grid-column: 6; animation-duration: 8.153s; animation-delay: 1.65s; }
.footer-dots__dot:nth-child(12) { grid-row: 3; grid-column: 7; animation-duration: 7.988s; animation-delay: 1.815s; }
.footer-dots__dot:nth-child(13) { grid-row: 3; grid-column: 8; animation-duration: 7.823s; animation-delay: 1.98s; }
.footer-dots__dot:nth-child(14) { grid-row: 3; grid-column: 9; animation-duration: 7.658s; animation-delay: 2.145s; }
.footer-dots__dot:nth-child(15) { grid-row: 4; grid-column: 2; animation-duration: 7.493s; animation-delay: 2.31s; }
.footer-dots__dot:nth-child(16) { grid-row: 4; grid-column: 3; animation-duration: 7.328s; animation-delay: 2.475s; }
.footer-dots__dot:nth-child(17) { grid-row: 4; grid-column: 4; animation-duration: 7.163s; animation-delay: 2.64s; }
.footer-dots__dot:nth-child(18) { grid-row: 4; grid-column: 5; animation-duration: 6.998s; animation-delay: 2.805s; }
.footer-dots__dot:nth-child(19) { grid-row: 4; grid-column: 6; animation-duration: 6.833s; animation-delay: 2.97s; }
.footer-dots__dot:nth-child(20) { grid-row: 4; grid-column: 7; animation-duration: 6.668s; animation-delay: 3.135s; }
.footer-dots__dot:nth-child(21) { grid-row: 4; grid-column: 8; animation-duration: 6.503s; animation-delay: 3.3s; }
.footer-dots__dot:nth-child(22) { grid-row: 4; grid-column: 9; animation-duration: 6.338s; animation-delay: 3.465s; }
.footer-dots__dot:nth-child(23) { grid-row: 5; grid-column: 3; animation-duration: 6.173s; animation-delay: 3.63s; }
.footer-dots__dot:nth-child(24) { grid-row: 5; grid-column: 4; animation-duration: 6.008s; animation-delay: 3.795s; }
.footer-dots__dot:nth-child(25) { grid-row: 5; grid-column: 5; animation-duration: 5.843s; animation-delay: 3.96s; }
.footer-dots__dot:nth-child(26) { grid-row: 5; grid-column: 6; animation-duration: 5.678s; animation-delay: 4.125s; }
.footer-dots__dot:nth-child(27) { grid-row: 5; grid-column: 7; animation-duration: 5.513s; animation-delay: 4.29s; }
.footer-dots__dot:nth-child(28) { grid-row: 5; grid-column: 8; animation-duration: 5.348s; animation-delay: 4.455s; }
.footer-dots__dot:nth-child(29) { grid-row: 5; grid-column: 9; animation-duration: 5.183s; animation-delay: 4.62s; }
.footer-dots__dot:nth-child(30) { grid-row: 6; grid-column: 4; animation-duration: 5.018s; animation-delay: 4.785s; }
.footer-dots__dot:nth-child(31) { grid-row: 6; grid-column: 5; animation-duration: 4.853s; animation-delay: 4.95s; }
.footer-dots__dot:nth-child(32) { grid-row: 6; grid-column: 6; animation-duration: 4.688s; animation-delay: 5.115s; }
.footer-dots__dot:nth-child(33) {
  grid-row: 6;
  grid-column: 7;
  animation-name: footer-dot-sp;
  animation-duration: 4.523s;
  animation-delay: 5.28s;
  animation-timing-function: ease-in-out;
  background: var(--ink-muted);
}
.footer-dots__dot:nth-child(34) { grid-row: 6; grid-column: 8; animation-duration: 4.358s; animation-delay: 5.445s; }
.footer-dots__dot:nth-child(35) { grid-row: 7; grid-column: 5; animation-duration: 4.193s; animation-delay: 5.61s; }
.footer-dots__dot:nth-child(36) { grid-row: 7; grid-column: 6; animation-duration: 4.028s; animation-delay: 5.775s; }
.footer-dots__dot:nth-child(37) { grid-row: 7; grid-column: 7; animation-duration: 3.863s; animation-delay: 5.94s; }
.footer-dots__dot:nth-child(38) { grid-row: 8; grid-column: 6; animation-duration: 3.698s; animation-delay: 6.105s; }

@keyframes footer-dot-load {
  0% {
    opacity: 0.08;
    transform: scale(0.6);
  }

  4% {
    opacity: 1;
    transform: scale(1);
  }

  4%,
  88.5% {
    opacity: 1;
    transform: scale(1);
  }

  90.5%,
  100% {
    opacity: 0.08;
    transform: scale(0.6);
  }
}

@keyframes footer-dot-sp {
  0% {
    opacity: 0.08;
    transform: scale(0.6);
    background-color: var(--ink-faint);
  }

  4% {
    opacity: 1;
    transform: scale(1);
    background-color: var(--ink-muted);
  }

  4%,
  65.7% {
    opacity: 1;
    transform: scale(1);
    background-color: var(--ink-muted);
  }

  65.7% {
    opacity: 0.08;
    transform: scale(0.6);
    background-color: var(--ink-faint);
  }

  70.2% {
    opacity: 1;
    transform: scale(1.08);
    background-color: var(--ink);
  }

  74.6% {
    opacity: 0.08;
    transform: scale(0.6);
    background-color: var(--ink-faint);
  }

  79% {
    opacity: 1;
    transform: scale(1.08);
    background-color: var(--ink);
  }

  83.4% {
    opacity: 0.08;
    transform: scale(0.6);
    background-color: var(--ink-faint);
  }

  87.8% {
    opacity: 1;
    transform: scale(1.08);
    background-color: var(--ink);
  }

  87.8%,
  91.3% {
    opacity: 1;
    transform: scale(1);
    background-color: var(--ink-muted);
  }

  92.3%,
  100% {
    opacity: 0.08;
    transform: scale(0.6);
    background-color: var(--ink-faint);
  }
}

footer a {
  text-decoration-color: currentColor;
}

footer a:hover {
  color: #7c2d12;
  text-decoration-color: #7c2d12;
}

.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;
}

/* —— Work page (linked from “About me”) */
.page-sub .subpage-header {
  margin-bottom: 0;
}

.page-sub .subpage-nav {
  margin: 0 0 1.15rem;
  padding: 0;
  list-style: none;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.18s forwards;
}

.page-sub .subpage-nav li {
  display: inline-flex;
}

.page-sub .subpage-portrait {
  display: block;
  width: clamp(7.25rem, 32vw, 10rem);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center center;
  margin: 0 0 2.25rem;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(28, 25, 23, 0.05),
    0 5px 16px rgba(28, 25, 23, 0.08);
  outline: 1px solid rgba(28, 25, 23, 0.1);
  outline-offset: -1px;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.24s forwards;
}

.page-sub .subpage-title {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 54px;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.28s forwards;
}

.page-sub .subpage-lede {
  margin: 0.65rem 0 0.85rem;
  font-size: 1.0625rem;
  line-height: 28px;
  color: var(--ink-muted);
  text-wrap: pretty;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) forwards;
  animation-delay: 0.31s;
}

.page-sub .subpage-portrait + .subpage-lede {
  margin-top: 0;
}

.page-sub .subpage-lede + .subpage-lede {
  margin: 0 0 2.25rem;
  animation-delay: 0.36s;
}

.page-sub .subpage-header > .subpage-lede:last-child {
  margin-bottom: 2.25rem;
}

.page-sub .subpage-subtitle {
  line-height: 40px;
  text-wrap: balance;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) forwards;
  animation-delay: 0.43s;
}

.page-sub main.subpage .work-experience .writing-list {
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.49s forwards;
}

.page-sub main.subpage .work-experience .work-list-tail {
  margin: 1.35rem 0 0;
  font-size: 0.9375rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  line-height: 1.6;
  text-wrap: pretty;
  opacity: 0;
  animation: rise var(--page-dur-block) var(--ease-page) 0.60s forwards;
}

.work-list-tail a {
  color: inherit;
  text-decoration-color: currentColor;
}

.work-list-tail a:hover {
  color: #431407;
  text-decoration-color: rgba(67, 20, 7, 0.5);
}

.page-sub footer {
  animation-delay: 0.66s;
}
