@font-face {
  font-family: "CMU Sans";
  src: url("fonts/cmunss.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "CMU Sans";
  src: url("fonts/cmunssi.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
}

:root {
  --max-width: 1300px;
  --gap: 48px;
  --body-font-size: 21.5px; /* <-- your original text size */
}

/* --- Dark mode + smooth transition --- */
html, body {
  transition: background-color 220ms ease, color 220ms ease;
}

.page, .content, .layout, .photo-caption, h1, h2, p, li {
  transition: color 220ms ease;
}

/* Dark mode palette */
html.dark body {
  background: #1f1f1f;   /* dark grey */
  color: #ffffff;        /* all text white */
}

/* Keep links as-is (don’t force white) */
html.dark a {
  color: #1a73e8;        /* your link blue */
}

.theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;

  width: 38px;
  height: 38px;
  padding: 0;

  border: none;                 /* ← removes outline */
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);

  display: grid;                /* ← true centering */
  place-items: center;          /* ← true centering */

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover { transform: scale(1.04); }

html.dark .theme-toggle {
  border-color: rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.35);
}

.theme-toggle svg {
  display: block;               /* ← kills inline SVG baseline offset */
  width: 18px;
  height: 18px;
}

html.dark .moon-icon {
  color: rgba(255,255,255,0.85);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "CMU Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: var(--body-font-size);  /* <-- makes body text consistent */
  line-height: 1.55;
}

.page {
  max-width: var(--max-width);
  margin: 40px auto;
  padding: 0 24px;
}

.layout {
  display: flex;
  gap: var(--gap);
  align-items: flex-start; /* align tops of photo and content */
}

/* photo column: stack + centered */
.photo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  margin-top: 8px; /* align top of photo border with top of "L" in Liam */
}

/* image itself */
.photo {
  display: block;
  width: 280px;      /* fixed visual width */
  max-width: 100%;   /* don't overflow on small screens */
  height: 350px;     /* fixed height for vertical crop */
  object-fit: cover; /* crop to fit */
  object-position: center 60%; /* shifted up within frame */
  border: 2.25px solid #555; /* dark grey border */
}

html.dark .photo {
  border-color: #aaa; /* light grey in dark mode */
}

/* caption under the image */
.photo-caption {
  margin-top: 8px;
  font-size: 14px;
  color: #9a9a9a;
  text-align: center;
}

/* content should expand and be allowed to get wide */
.content {
  flex: 1 1 0;
  min-width: 0;
  max-width: 950px; /* widen your text block (adjust as you like) */
}

h1 {
  margin: 0 0 18px 0;
  font-size: 56px;
  letter-spacing: 0.2px;
  line-height: 1.05;
}

p {
  margin: 0 0 22px 0;
  font-size: inherit; /* inherit from body (21.5px) */
  max-width: none;
}

a {
  color: #1a73e8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Mobile: stack photo above text */
@media (max-width: 820px) {
  :root {
    --body-font-size: 18px; /* mobile body text size */
  }

  .layout {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .photo-col {
    width: min(320px, 100%);
  }

  .photo {
    width: min(320px, 100%);
    height: 370px;   /* slightly taller on mobile for better proportions */
  }

  h1 {
    font-size: 40px;
  }
}

h2 {
  margin-top: 36px;
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 600;
}

h3 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 600;
}

.reading-list {
  padding-left: 20px;
  margin-bottom: 24px;
}

.reading-list li {
  margin-bottom: 10px;
}

/* Footnotes */
.footnotes {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.9em;
}

html.dark .footnotes {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.footnotes p {
  margin-bottom: 16px;
}

.footnotes img {
  max-width: 100%;
  margin-top: 10px;
  border-radius: 8px;
}

sup a {
  text-decoration: none;
}

/* Footnote number styling */
.footnotes sup {
  font-size: 1em;
  vertical-align: baseline;
}

.footnotes sup a {
  color: inherit;
}

/* Blockquotes */
blockquote {
  margin: 24px 0;
  padding-left: 24px;
  border-left: 3px solid rgba(0, 0, 0, 0.15);
  font-style: italic;
  color: rgba(0, 0, 0, 0.8);
}

html.dark blockquote {
  border-left-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

/* Date metadata */
.date-meta {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.5);
  margin-top: -8px;
  margin-bottom: 20px;
}

html.dark .date-meta {
  color: rgba(255, 255, 255, 0.5);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: inherit;
}

table caption {
  font-weight: 600;
  font-size: 1.1em;
  margin-bottom: 12px;
  text-align: left;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html.dark th,
html.dark td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

th {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.03);
}

html.dark th {
  background: rgba(255, 255, 255, 0.03);
}

tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

html.dark tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-note {
  font-size: 0.85em;
  margin-top: 8px;
  font-style: italic;
  opacity: 0.7;
}

/* --- Row of book covers (Currently reading) --- */

.book-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}

/* Book item wrapper (contains card + review link) */
.book-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Card sizing: a bit smaller than before */
.book-card {
  position: relative;
  width: 215px;              /* desktop size */
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  overflow: hidden;
  display: block;

  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;

  outline: none;             /* avoid default focus ring */
  -webkit-tap-highlight-color: transparent;
}

/* ✅ Dark mode: use a “white” shadow with same intensity (idle) */
html.dark .book-card {
  box-shadow: 0 14px 36px rgba(255, 255, 255, 0.16);
}

/* Optional: accessible focus ring only when keyboarding */
.book-card:focus-visible {
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(26, 115, 232, 0.35);
}

/* ✅ Dark mode focus: keep focus ring, swap base shadow to white */
html.dark .book-card:focus-visible {
  box-shadow:
    0 14px 36px rgba(255, 255, 255, 0.16),
    0 0 0 3px rgba(26, 115, 232, 0.35);
}

/* Cover image */
.book-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition:
    filter 200ms ease,
    transform 200ms ease;
}

/* Overlay text */
.book-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px;

  opacity: 0;
  transition: opacity 180ms ease;

  pointer-events: none; /* lets taps/focus go to the card */
}

/* Hover OR tap-focus: blur + darken + grow + show overlay */
.book-card:hover img,
.book-card:focus img,
.book-card:focus-visible img {
  filter: blur(5px) brightness(0.74);
  transform: scale(1.06);
}

.book-card:hover,
.book-card:focus,
.book-card:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

/* ✅ Dark mode: “white” shadow with same intensity (hover/focus) */
html.dark .book-card:hover,
html.dark .book-card:focus,
html.dark .book-card:focus-visible {
  box-shadow: 0 28px 70px rgba(255, 255, 255, 0.22);
}

.book-card:hover .book-overlay,
.book-card:focus .book-overlay,
.book-card:focus-visible .book-overlay {
  opacity: 1;
}

/* Title / author */
.book-title {
  font-size: 28px;
  line-height: 1.05;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 10px;
}

.book-author {
  font-size: 20px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

.review-link {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.4);
  text-decoration: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.book-item:hover .review-link,
.book-card:focus + .review-link {
  opacity: 1;
}

.review-link:hover {
  text-decoration: underline;
  transform: scale(1.05);
}

/* Mobile */
@media (max-width: 820px) {
  /* 2 books per row, sized to the viewport */
  .book-row {
    gap: 16px;
  }

  .book-item {
    width: calc((100% - 16px) / 2); /* two columns with one gap */
  }

  .book-card {
    width: 100%;
    max-width: none;                /* IMPORTANT: allow shrink to fit */
    min-width: 0;                   /* IMPORTANT: allow shrink in flex */
  }

  .book-title { font-size: 22px; }
  .book-author { font-size: 16px; }

  /* Mobile review link - keep hover behavior */
  .review-link {
    font-size: 11px;
    margin-top: 6px;
    opacity: 0;
  }

  .book-item:hover .review-link {
    opacity: 1;
  }
}

/* --- Dark mode (legacy vars kept, but harmless) --- */
:root {
  --bg: #ffffff;
  --text: #000000;
}

/* main page colors */
body {
  background: var(--bg);
  color: var(--text);
}

/* dark theme overrides */
.dark {
  --bg: #1f1f1f;
  --text: #ffffff;
}

/* links stay the same */
a { color: #1a73e8; }

/* moon button (duplicate block kept as you had it; harmless) */
.theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;

  width: 38px;
  height: 38px;
  padding: 0;

  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);

  display: grid;
  place-items: center;

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover { opacity: 1; }

.theme-toggle {
  backdrop-filter: blur(6px);
}

.theme-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* ── Recent section ── */
.recent {
  margin-top: 36px;
}
.recent h2 {
  margin-top: 0;
}
.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.recent-item {
  border-bottom: 1px solid rgba(0,0,0,0.15);
}
html.dark .recent-item {
  border-bottom-color: rgba(255,255,255,0.1);
}
.recent-item:last-child {
  border-bottom: none;
}

/* Top row: date | title | type | chevron */
.recent-row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 7px 0;
}
.recent-date {
  font-size: 14px;
  color: rgba(0,0,0,0.4);
  white-space: nowrap;
  min-width: 72px;
}
html.dark .recent-date {
  color: rgba(255,255,255,0.4);
}
.recent-entry {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.recent-entry-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Type label (plain, no interaction) */
.recent-type {
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
  font-size: 12.5px;
  color: rgba(0,0,0,0.38);
  white-space: nowrap;
  line-height: 1.5;
}
html.dark .recent-type {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.38);
}

/* Expand chevron button */
.recent-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  color: rgba(0,0,0,0.25);
  transition: color 140ms;
  line-height: 1;
}
.recent-expand:hover {
  color: rgba(0,0,0,0.5);
}
html.dark .recent-expand {
  color: rgba(255,255,255,0.25);
}
html.dark .recent-expand:hover {
  color: rgba(255,255,255,0.5);
}
.recent-expand-icon {
  display: inline-block;
  transition: transform 200ms ease;
}
.recent-item.open .recent-expand-icon,
.reading-group-item.open .recent-expand-icon {
  transform: rotate(180deg);
}

/* Expandable description */
.recent-desc {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 400ms ease, opacity 200ms ease, padding 200ms ease;
  padding: 0 0 0 92px; /* align with title (72px date + 20px gap) */
  font-size: 15px;
  color: rgba(0,0,0,0.55);
  line-height: 1.5;
}
html.dark .recent-desc {
  color: rgba(255,255,255,0.50);
}
.recent-item.open .recent-desc {
  max-height: none;
  opacity: 1;
  padding-top: 2px;
  padding-bottom: 10px;
  overflow: visible;
}
.recent-desc iframe {
  display: block;
  margin: 2px auto 0;
  width: 100%;
  min-height: 1400px;
  border: none;
  overflow: hidden;
  background: transparent;
  opacity: 0;
  transition: opacity 300ms ease;
}
.recent-desc iframe.loaded {
  opacity: 1;
}
.recent-desc .embed-wrap {
  text-align: center;
}
@media (max-width: 768px) {
  .recent-desc .embed-wrap {
    display: none;
  }
}

/* ── Reading Group section ── */
.reading-group-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.reading-group-item {
  border-bottom: 1px solid rgba(0,0,0,0.15);
}
html.dark .reading-group-item {
  border-bottom-color: rgba(255,255,255,0.1);
}
.reading-group-item:last-child {
  border-bottom: none;
}
.reading-group-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  flex-wrap: wrap;
}
.reading-group-authors {
  font-size: 14px;
  color: rgba(0,0,0,0.4);
  white-space: nowrap;
}
html.dark .reading-group-authors {
  color: rgba(255,255,255,0.4);
}
.reading-group-notes {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 400ms ease, opacity 200ms ease, padding 200ms ease;
  padding: 0 0 0 0;
  font-size: inherit;
  line-height: 1.55;
}
html.dark .reading-group-notes {
  color: #ffffff;
}
.reading-group-item.open .reading-group-notes {
  max-height: none;
  opacity: 1;
  padding-top: 2px;
  padding-bottom: 10px;
  overflow: visible;
}
