/* ===== Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

a {
  color: #1a6fc4;
}

a:hover {
  color: #12518f;
}

/* ===== Header ===== */
#site-header {
  margin-bottom: 56px;
}

#site-title {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a1a;
}

#site-tagline {
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 400;
  color: #757575;
}

/* ===== Sections ===== */
section {
  margin-bottom: 36px;
}

.section-heading {
  font-size: 1.6rem;
  font-weight: 700;
  color: #333;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  margin-bottom: 28px;
}

/* ===== About =====
   McKinsey-meets-Apple: one idea, sharp hierarchy, generous whitespace.
   A quiet eyebrow, a single positioning headline, one supporting line —
   with the proof pulled out into an exhibit-style metrics row below. */
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
}

.about-photo img {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  /* drop-shadow (not box-shadow) so the shadow follows the photo's actual
     shape, not the transparent rectangular padding baked into the PNG. */
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.16));
  transform: perspective(900px) rotateX(0deg) rotateY(0deg) scale(1);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, filter;
  backface-visibility: hidden;
}

.about-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a9a9a;
  margin-bottom: 18px;
}

.about-headline {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: #1a1a1a;
  margin-bottom: 20px;
}

.about-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #555;
  max-width: 46ch;
}

/* Primary + secondary calls to action, side by side (wrap on narrow widths). */
.about-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 26px;
  margin-top: 28px;
}

.about-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #1a1a1a;
  text-decoration: none;
  transition: gap 0.25s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.about-cta:hover {
  color: #1a6fc4;
  gap: 12px;
}

/* Quieter secondary action (e.g. the Goodreads follow) — subordinate to the
   primary CTA, in the muted gray used elsewhere. */
.about-cta--secondary {
  font-weight: 500;
  font-size: 0.92rem;
  color: #86868b;
}

.about-cta-arrow {
  font-weight: 400;
}

/* Quiet label framing the metrics as results, not stray numbers. Matches the
   "ABOUT" eyebrow treatment and carries the top spacing for the row. */
.metrics-eyebrow {
  margin-top: 64px;
  margin-bottom: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a9a9a;
}

/* Exhibit-style proof row: the metrics that were buried in prose, now
   front and center — big figures, quiet labels, a thin rule above each. */
.about-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 0;
}

/* "On the run" — a featured achievement, not a second stats grid. One hero
   number (the half marathon) with two lighter supporting stats. Reuses the
   numeral/rule/caption language of .about-metrics so it aligns, but the
   asymmetry + lighter supporting rules mark it as its own, secondary group. */
/* Three even columns spanning the full width (like the work row) so the group
   isn't left-heavy with empty space on the right. Hero stays dominant via its
   larger numeral. */
.run {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 40px;
  align-items: start;
}

/* Label + a short intro line that names the hobby (so the numbers read as
   running stats). The whole header block is bounded by a single hairline under
   the intro — a distinct line treatment vs the work row's per-item top rules,
   and the numbers below sit rule-free. Scoped so the work label is unaffected. */
#run-eyebrow {
  margin-top: 0; /* now its own section — rely on the section gap above it */
  margin-bottom: 8px;
}

.run-sub {
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 1.05rem;
  line-height: 1.55;
  color: #555;
  /* full-width so the ruler spans the whole row (over all three stats),
     while the short sentence simply stays left-aligned within it */
}

.run-hero .metric-label {
  max-width: 24ch;
}

/* Supporting stats (4, 100%): smaller numerals so they read as secondary to
   the hero and to the work row. */
.run-stat .run-stat-value {
  font-size: 1.6rem;
}

@media (max-width: 600px) {
  /* Hero spans the top; the two stats split the row below, so the right side
     stays filled on mobile too. */
  .run {
    grid-template-columns: 1fr 1fr;
    gap: 22px 28px;
  }
  .run-hero {
    grid-column: 1 / -1;
  }
}

.metric {
  border-top: 2px solid #1a1a1a;
  padding-top: 16px;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #1a1a1a;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #757575;
}

mark {
  color: inherit;
  padding: 0.05em 0.25em;
  border-radius: 3px;
  background-color: transparent;
  background-image: linear-gradient(#fff176, #fff176);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

mark.is-visible {
  background-size: 100% 100%;
}

/* ===== Card grids (Experience / Education / Projects) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Carousel prev/next controls — only shown on mobile (see the ≤600px block),
   where the grids become swipeable carousels. Apple-style circular buttons. */
.carousel-nav {
  display: none;
}

.carousel-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(210, 210, 215, 0.72);
  color: rgba(0, 0, 0, 0.56);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.carousel-btn:hover {
  background: rgba(210, 210, 215, 1);
  color: rgba(0, 0, 0, 0.72);
}

.carousel-btn:active {
  background: rgba(190, 190, 196, 1);
}

.carousel-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.carousel-btn svg {
  width: 20px;
  height: 20px;
}

/* Experience & Education cards */
.exp-card {
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
}

/* Clickable cards (entries with a url) */
.exp-card--link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.exp-card--link:focus-visible {
  outline: 2px solid #1a6fc4;
  outline-offset: 2px;
}

.exp-card .logo-area {
  background: #fff;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.exp-card .logo-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.exp-card .card-footer {
  background: #cfe3f5;
  padding: 14px 16px;
  flex: 1;
}

.exp-card .card-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #1a1a1a;
}

.exp-card .card-sub {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #4a5a68;
}

/* Project cards */
.project-card {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.project-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.project-tags .tag {
  background: #f0f0f0;
  color: #555;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.project-desc {
  font-size: 0.88rem;
  color: #444;
  line-height: 1.55;
  flex: 1;
}

.project-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.88rem;
}

/* ===== Contact ===== */
#contact-items {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 48px;
}

.contact-item {
  font-size: 1rem;
}

/* ===== Load-error notice (file:// fallback) ===== */
.load-error {
  border: 1px solid #f0c36d;
  background: #fff8e1;
  border-radius: 10px;
  padding: 20px 24px;
  line-height: 1.7;
}

.load-error code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #site-title {
    font-size: 2.4rem;
  }
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Center the photo once it stacks above the text, and on mobile crop it to
     a shorter, smaller portrait: keep the face + stickers (anchored to the
     top), trim the lower torso, and re-round the corners via CSS since the
     baked-in rounding is lost once the image is cover-cropped. */
  .about-photo img {
    margin-left: auto;
    margin-right: auto;
    width: 210px;
    max-width: 210px;
    height: 230px;
    object-fit: cover;
    object-position: top center;
    border-radius: 22px;
  }

  /* Center the name + tagline and pull them closer to the photo */
  #site-header {
    text-align: center;
    margin-bottom: 28px;
  }

  .metrics-eyebrow {
    margin-top: 48px;
  }

  .about-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 32px;
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  /* Experience / Education / Projects become an Apple-style horizontal snap
     carousel on phones: full-bleed edge-to-edge, swipeable, one card in focus
     per snap with the next card peeking. No scrollbar; the peek is the cue. */
  .card-grid {
    display: flex;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* bleed to the screen edges, then re-pad so the first card lines up under
       the section heading and there's room for card shadow + hover lift */
    margin: 0 -26px;
    padding: 6px 26px 16px;
    scroll-padding-left: 26px;
  }

  .card-grid::-webkit-scrollbar {
    display: none;
  }

  .card-grid > * {
    flex: 0 0 80%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* Show the prev/next controls, right-aligned under the carousel */
  .carousel-nav {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
  }

  .container {
    padding: 40px 26px 64px;
  }

  #site-title {
    font-size: 2rem;
  }

  #contact-items {
    flex-direction: column;
    gap: 12px;
  }

  .about-headline {
    font-size: 1.95rem;
  }

  .about-lead {
    font-size: 1.05rem;
  }

  /* Drop the "|" and stack the tagline into two centered lines */
  .tagline-sep {
    display: none;
  }

  .tagline-part {
    display: block;
  }

  .tagline-part:last-child {
    font-size: 0.9em;
    margin-top: 3px;
  }
}

/* ===== Top navigation ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* "IW" monogram — refined graphite app-icon style */
.nav-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: linear-gradient(180deg, #3a3a3c 0%, #1d1d1f 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  border-radius: 9px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-brand:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-links a {
  color: #1d1d1f;
  opacity: 0.72;
  text-decoration: none;
  font-weight: 400;
  font-size: 0.83rem;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease;
}

.nav-links a:hover {
  opacity: 1;
}

.nav-links a.active {
  opacity: 1;
  font-weight: 500;
}

/* ===== Footer ===== */
.site-footer {
  background: #f5f5f7;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-copy {
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  color: #86868b;
}

/* ===== Back-to-top button ===== */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  color: #1d1d1f;
  cursor: pointer;
  /* hidden + non-interactive until scrolled down */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s ease,
              visibility 0.3s;
}

.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.to-top:active {
  transform: scale(0.96);
}

.to-top:focus-visible {
  outline: 2px solid #1a6fc4;
  outline-offset: 3px;
}

.to-top svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ===== Blog listing ===== */
.container--narrow {
  max-width: 720px;
}

.page-title {
  font-size: 2.6rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.post-search {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
  color: #333;
  margin-bottom: 22px;
}

.post-search:focus {
  outline: none;
  border-color: #1a6fc4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.post-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 48px;
}

.filter-pill {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  background: #f0f0f0;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
  background: #e4e4e4;
}

.filter-pill--active {
  background: #1a1a1a;
  color: #fff;
}

.filter-count {
  opacity: 0.6;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.post-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

.post-thumb {
  display: block;
  border-radius: 12px;
  overflow: hidden;
}

.post-thumb img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.post-cat {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a6fc4;
}

.post-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: #999;
}

.post-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.post-card-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.post-card-title a:hover {
  color: #1a6fc4;
}

.post-excerpt {
  color: #555;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.post-readmore {
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  color: #1a6fc4;
}

.post-readmore:hover {
  text-decoration: underline;
}

.post-empty {
  color: #777;
}

/* ===== Bookshelf ===== */
.page-intro {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #555;
  max-width: 60ch;
  margin: -12px 0 32px; /* pull up under the page title */
}

.book-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 40px;
}

/* Reuse the blog's filter pills; drop their bottom margin here. */
.book-controls .post-filters {
  margin-bottom: 0;
}

.book-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.book-sort-label {
  font-size: 0.82rem;
  color: #86868b;
}

.book-sort select {
  font-family: inherit;
  font-size: 0.85rem;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  padding: 7px 32px 7px 12px;
  background: #fff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.book-sort select:focus {
  outline: none;
  border-color: #1a6fc4;
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.12);
}

.book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px;
}

/* Card shares the Experience/Project card treatment for a native feel. */
.book-card {
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  background: #fff;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.10);
}

.book-cover {
  aspect-ratio: 2 / 3;
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* keep the tile at its 2:3 height when the card is stretched */
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* No cover image: a quiet, low-saturation color panel (hue derived per book —
   see hueFromString in bookshelf.js) with a subtle book icon, so it reads as an
   intentional placeholder, not a missing image. The caption below is identical
   to cover cards, so every card has the same white footer and aligned meta. */
.book-cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--tile-h, 210), 30%, 94%);
  color: hsl(var(--tile-h, 210), 34%, 68%);
}

.book-cover-icon {
  width: 38%;
  max-width: 68px;
  height: auto;
}

.book-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative; /* anchor for the full-title popover */
}

.book-title {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  color: #1a1a1a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em; /* always reserve two lines so author + meta line up */
}

/* Truncated titles become tappable/hoverable to reveal the full text. */
.book-title.is-clamped {
  cursor: pointer;
}

.book-title-tip {
  display: none;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 6px); /* float just above the title */
  z-index: 30;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.32;
  color: #1a1a1a;
}

.book-title.is-clamped:hover + .book-title-tip,
.book-title.is-clamped:focus-visible + .book-title-tip,
.book-title.is-clamped.is-open + .book-title-tip {
  display: block;
}

.book-author {
  margin-top: 2px;
  font-size: 0.74rem;
  color: #6b6b6b;
}

.book-meta {
  /* Pinned to the bottom of the card so the rating/year/badge row lines up
     across every card in a row — regardless of title length or whether the
     card has a cover image or a text placeholder. */
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 1.6em; /* reserve a consistent row height (e.g. year-only cards) */
}

.book-rating {
  font-size: 0.82rem;
  letter-spacing: 1px;
  line-height: 1;
}

.star {
  color: #d2d2d7;
}

.star--on {
  color: #1d1d1f;
}

.book-year {
  font-size: 0.72rem;
  color: #86868b;
}

.book-unrated {
  font-size: 0.72rem;
  color: #b0b0b0;
}

.book-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: #4a5a68;
  background: #eef2f6;
  border-radius: 999px;
  padding: 3px 9px;
}

.book-empty {
  list-style: none;
  color: #777;
  grid-column: 1 / -1;
}

/* Controls stay hidden until books load (and while showing loading/error). */
.book-controls[hidden] {
  display: none;
}

/* ----- Loading skeletons ----- */
.book-skeleton {
  pointer-events: none;
}

.book-skeleton-cover {
  background: #eef0f2;
}

.skeleton-line {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: #eef0f2;
  margin-top: 9px;
}

.skeleton-line--title { width: 82%; }
.skeleton-line--sub { width: 52%; }

.book-skeleton-cover,
.skeleton-line {
  background-image: linear-gradient(90deg, #eef0f2 0%, #f6f7f8 50%, #eef0f2 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ----- Error / empty notice (Apple-style empty state) ----- */
.books-notice {
  grid-column: 1 / -1;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  max-width: 360px;
  margin: 24px auto;
  padding: 48px 24px;
}

.books-notice-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f5f5f7;
  color: #bcbcc2;
  margin-bottom: 6px;
}

.books-notice-icon svg { width: 28px; height: 28px; }

.books-notice-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
}

.books-notice-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #86868b;
}

.books-retry {
  margin-top: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: #1d1d1f;
  border: none;
  border-radius: 999px;
  padding: 9px 22px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.books-retry:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.books-retry:active { transform: translateY(0); }

.books-retry:focus-visible {
  outline: 2px solid #1a6fc4;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .book-skeleton-cover,
  .skeleton-line { animation: none; }
  .books-retry { transition: none; }
}

@media (max-width: 600px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .book-controls {
    gap: 16px;
  }
}

/* ===== Single post ===== */
.post-back {
  display: inline-block;
  margin-bottom: 28px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  color: #1a6fc4;
}

.post-back:hover {
  text-decoration: underline;
}

.single-post .post-meta {
  margin-bottom: 14px;
}

.post-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  margin-bottom: 24px;
}

.post-hero {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 32px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.post-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #333;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 36px 0 14px;
}

.post-content ul {
  margin: 0 0 20px 1.2em;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 4px solid #cfe3f5;
  color: #555;
  font-style: italic;
}

.post-content figure {
  margin: 24px 0;
}

.post-content figure img {
  width: 100%;
  border-radius: 12px;
}

.post-content figcaption {
  font-size: 0.85rem;
  color: #999;
  text-align: center;
  margin-top: 8px;
}

@media (max-width: 700px) {
  .post-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .post-thumb img {
    height: 200px;
  }

  .page-title {
    font-size: 2rem;
  }

  .post-title {
    font-size: 1.8rem;
  }
}

/* ===== Motion: gentle Apple-style reveals & hovers ===== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Blog thumbnail hover lift */
.post-thumb img {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.post-thumb:hover img {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

/* Card float on hover — Experience, Education, and Past Projects share this.
   Declared after .reveal.is-visible so the hover transform wins the cascade. */
.project-card,
.exp-card--link {
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.project-card:hover,
.exp-card--link:hover,
.exp-card--link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.10);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }

  mark {
    background-size: 100% 100%;
    transition: none;
  }

  .about-photo img,
  .post-thumb img,
  .project-card,
  .exp-card--link {
    transition: none;
  }

  .to-top {
    transition: opacity 0.2s linear, visibility 0.2s;
    transform: none;
  }

  .to-top.is-shown,
  .to-top:hover,
  .to-top:active {
    transform: none;
  }
}
