/* ==========================================================================
   alexsmo.li – site styles
   Geist + Geist Mono, navy & municipal orange, light/dark
   ========================================================================== */

:root {
  --bg: #FBFBFA;
  --fg: #14213D;
  --muted: #5E6779;
  --rule: #DDE1E8;
  --line: #B8BFCC;
  --accent: #E06A00;
  --accent-strong: #C85A00;
  --card: #EEF1F5;
  --stamp-bg: rgba(251, 251, 250, .92);
  --shadow: rgba(20, 33, 61, .18);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1320;
  --fg: #ECEEF2;
  --muted: #959DAD;
  --rule: #232B3D;
  --line: #4A5468;
  --accent: #FF8A2A;
  --accent-strong: #FF9A45;
  --card: #18202F;
  --stamp-bg: rgba(14, 19, 32, .92);
  --shadow: rgba(0, 0, 0, .45);
  color-scheme: dark;
}
/* Without JS: follow the system setting */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0E1320; --fg: #ECEEF2; --muted: #959DAD; --rule: #232B3D; --line: #4A5468;
    --accent: #FF8A2A; --accent-strong: #FF9A45; --card: #18202F; --stamp-bg: rgba(14, 19, 32, .92);
    --shadow: rgba(0, 0, 0, .45); color-scheme: dark;
  }
}

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

html {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: .03em;
  color: var(--fg);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  transition: background-color .2s ease, color .2s ease;
}
@media (prefers-reduced-motion: reduce) { html { transition: none; } }

body { min-height: 100vh; }

.wrap {
  max-width: 35rem;
  margin: 0 auto;
  padding: 7rem 1.5rem 6rem;
}
.wrap--wide { max-width: 48rem; }
@media (max-width: 640px) {
  .wrap { padding: 4rem 1.5rem 4rem; }
}
/* Desktop: anchored left like alexsmo.li, so name + nav sit in the same spot on every page */
@media (min-width: 900px) {
  .wrap { margin-left: max(0rem, calc(8vw - 1.5rem)); margin-right: 0; }
  .site-header { max-width: 32rem; }
}

p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.mono { font-family: 'Geist Mono', ui-monospace, Menlo, monospace; letter-spacing: 0; }
.muted { color: var(--muted); }

h1, h2, h3 { font-size: 1rem; font-weight: 400; line-height: 1.6; }

.stack > * + * { margin-top: 2.5rem; }

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header__name { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.site-header__name a { text-decoration: none; }

.crumb { color: var(--muted); min-width: 0; }
.crumb a { color: var(--fg); }
.site-header__tools { display: flex; align-items: center; gap: 1.5rem; flex-shrink: 0; }
.site-nav { display: flex; gap: 1.5rem; }
.site-header--home .site-header__name h1 { white-space: nowrap; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }

.theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 44px; height: 44px;
  margin-right: -10px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--fg); background: var(--card); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 560px) {
  .site-header--home { flex-wrap: wrap; row-gap: .25rem; }
  .site-header--home .site-header__tools { width: 100%; justify-content: space-between; }
}

/* ── Home ─────────────────────────────────────────────────────────────── */
.bio p { margin-bottom: 1.4rem; }
.bio p:last-child { margin-bottom: 0; }

.plain-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }

.recent-books { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.recent-books li { display: flex; gap: 1rem; align-items: center; line-height: 1.5; }
.recent-books__cover {
  flex: 0 0 auto;
  width: 42px; height: 62px;
  border-radius: 2px;
  object-fit: cover;
  background: var(--card);
  box-shadow: 0 1px 3px var(--shadow);
}
.recent-books__ph {
  flex: 0 0 auto;
  width: 42px; height: 62px;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 500;
}

/* Stamp gimmick */
.bz { position: relative; display: inline; }
.bz-btn {
  font: inherit; letter-spacing: inherit; color: inherit;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
}
.stamp {
  position: absolute; left: 30%; bottom: 1.7em;
  pointer-events: none; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px;
  border: 2.5px solid var(--accent-strong);
  border-radius: 5px;
  color: var(--accent-strong);
  background: var(--stamp-bg);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 16px; line-height: 1; letter-spacing: .12em;
  opacity: 0;
  transform: rotate(-9deg) scale(1.6);
  transition: opacity .12s ease, transform .18s cubic-bezier(.3, 1.6, .5, 1);
}
.stamp small { font-size: 11px; letter-spacing: .06em; }
.bz:hover .stamp, .bz:focus-within .stamp { opacity: 1; transform: rotate(-9deg) scale(1); }
@media (prefers-reduced-motion: reduce) { .stamp { transition: none; } }

/* ── Notes archive ────────────────────────────────────────────────────── */
.archive { display: flex; flex-direction: column; gap: 2.25rem; }
.archive__year { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 0 1rem; }
.archive__year > span { color: var(--muted); }
.archive ul { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.archive li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.archive li a { min-width: 0; }
.archive li .mono { flex: 0 0 auto; color: var(--muted); }

/* ── Single note ──────────────────────────────────────────────────────── */
.note-head { display: flex; flex-direction: column; gap: .2rem; }
.note-head .mono { color: var(--muted); }
.note-body p { margin-bottom: 1.4rem; }
.note-body h2 { margin: 2.5rem 0 .75rem; font-weight: 500; }
.note-body h3 { margin: 2rem 0 .5rem; font-weight: 500; }
.note-body ul, .note-body ol { margin: 0 0 1.4rem 1.25rem; }
.note-body li { margin-bottom: .3rem; }
.note-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  margin: 2rem 0;
}
.note-body strong { font-weight: 500; }
.note-body > p:last-child::after {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  margin-left: .5rem;
  vertical-align: middle;
}
.note-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; color: var(--muted); }

/* Photo print effect – keeps the white print in both modes */
.photo-print {
  background: #fff;
  padding: .75rem .75rem 2.5rem;
  box-shadow: 0 3px 16px var(--shadow), 0 1px 4px rgba(0, 0, 0, .08);
  margin: 2.5rem 0 3.5rem;
  display: block;
  position: relative;
  transform: rotate(-1.8deg);
}
.note-body figure.photo-print:nth-of-type(even) { transform: rotate(1.4deg); }
.photo-print::before {
  content: '';
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  width: 64px; height: 26px;
  background: rgba(195, 215, 170, .70);
  border-radius: 2px;
  z-index: 1;
}
.photo-print img { width: 100%; height: auto; display: block; }
.photo-print figcaption {
  margin-top: .85rem;
  font-family: 'Reenie Beanie', cursive;
  font-size: 1.25rem;
  color: #555;
  text-align: center;
  letter-spacing: .03em;
}

/* ── Meet me at ───────────────────────────────────────────────────────── */
.events { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.events li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0 1rem; line-height: 1.6; }
.events .mono { color: var(--muted); white-space: nowrap; }
.events__what { color: var(--muted); }
.events__talk { display: block; margin-top: .45rem; }
.events__talk:first-of-type { margin-top: .15rem; }
.events li.events__item { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.events li.events__item .mono { flex: 0 0 auto; }
.events__icon { flex: 0 0 auto; align-self: flex-start; margin-right: -.25rem; width: 15px; height: 15px; margin-top: .3rem; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.events__body { flex: 1 1 auto; min-width: 0; }
.events--past li { color: var(--muted); }
.events--past li a { color: var(--muted); }
@media (max-width: 420px) {
  .events li { grid-template-columns: 1fr; }
}

/* ── Bookshelf ────────────────────────────────────────────────────────── */
.chip {
  appearance: none; border: 0; background: none; padding: 0; margin: 0;
  font: inherit; letter-spacing: inherit;
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
  display: inline-flex; align-items: center; gap: .4rem;
}
.chip:hover { color: var(--fg); }
.chip.active, .chip[aria-pressed="true"] {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.chip .mono { font-size: 13px; color: var(--muted); }
.linkish {
  appearance: none; border: 0; background: none; padding: 0; margin: 0;
  font: inherit; letter-spacing: inherit; color: var(--fg); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line);
  text-decoration-thickness: 1px; text-underline-offset: 6px;
}
.linkish:hover { text-decoration-color: var(--accent); }

.books-controls { display: flex; flex-direction: column; gap: .25rem; }
.filter-group { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.filter-select { display: none; }
.books-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem;
  border-top: 1px solid var(--rule);
}
.books-search { position: relative; flex: 1 1 12rem; min-width: 0; }
.books-search input {
  width: 100%;
  font: inherit; letter-spacing: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: .45rem 1.75rem .45rem 0;
  outline: none;
}
.books-search input:focus { border-bottom-color: var(--accent); }
.books-search input::placeholder { color: var(--muted); }
.books-search input::-webkit-search-cancel-button { display: none; }
.books-search__clear {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; display: none;
}
.view-toggle { display: flex; gap: 1.25rem; }
.books-hint { font-size: 14px; color: var(--muted); }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 1.75rem 1.1rem;
}
.book-card { cursor: pointer; display: block; transition: transform .2s ease; }
.book-card[hidden] { display: none !important; }
.book-card:hover { transform: translateY(-3px); }
.book-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.book-card__cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  position: relative;
  overflow: hidden;
  border-radius: 2px 4px 4px 2px;
  box-shadow: inset 3px 0 0 rgba(0, 0, 0, .12), 0 2px 8px var(--shadow);
  background: var(--card);
}
.book-card__placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 500; color: #fff;
  user-select: none;
}
.book-card__cover {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.book-card__body { display: none; }
.book-list-head { display: none; }
.book-grid__empty { grid-column: 1 / -1; color: var(--muted); padding: 2rem 0; display: none; }
@media (prefers-reduced-motion: reduce) { .book-card { transition: none; } }

/* List view */
.book-grid.is-list { display: flex; flex-direction: column; gap: 0; }
.book-grid.is-list .book-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--rule);
}
.book-grid.is-list .book-card:hover { transform: none; }
.book-grid.is-list .book-card__cover-wrap { width: 34px; box-shadow: 0 1px 3px var(--shadow); }
.book-grid.is-list .book-card__placeholder { font-size: .8rem; }
.book-grid.is-list .book-card__body { display: contents; }
.book-card__main { min-width: 0; line-height: 1.5; }
.book-card__title { overflow-wrap: break-word; }
.book-card__subtitle { display: none; }
.book-card__author { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-card__year { font-family: 'Geist Mono', ui-monospace, monospace; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.book-card__publisher { display: none; }

.books-credit { font-size: 14px; color: var(--muted); }

/* Book sheet / dialog */
#bk-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 12, 22, .45);
  z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
}
#bk-overlay[hidden] { display: none; }
.bk-panel {
  position: relative;
  width: 100%;
  max-height: 85vh; overflow-y: auto;
  background: var(--bg);
  color: var(--fg);
  border-radius: 16px 16px 0 0;
  padding: .75rem 1.5rem 2rem;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
  animation: bk-up .22s ease-out;
}
.bk-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--rule); margin: 0 auto 1.1rem; }
.bk-top { display: flex; gap: 1.25rem; align-items: flex-start; }
.bk-cover-col { flex-shrink: 0; width: 84px; }
.bk-cover { width: 84px; border-radius: 2px 4px 4px 2px; box-shadow: 0 4px 14px var(--shadow); display: none; }
.bk-cover-ph {
  width: 84px; aspect-ratio: 2 / 3;
  border-radius: 2px 4px 4px 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 500; color: #fff;
}
.bk-info { flex: 1; min-width: 0; line-height: 1.5; }
.bk-title { font-size: 1rem; font-weight: 400; }
.bk-subtitle, .bk-authors { color: var(--muted); }
.bk-meta, .bk-isbn { font-family: 'Geist Mono', ui-monospace, monospace; letter-spacing: 0; font-size: 13px; color: var(--muted); margin-top: .35rem; }
.bk-rating { margin-top: .35rem; letter-spacing: 2px; }
.bk-rating .sf { color: var(--accent); }
.bk-rating .se { color: var(--line); }
.bk-close {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  width: 44px; height: 44px; margin: -.5rem -.75rem 0 0;
  border-radius: 50%; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.bk-close:hover { background: var(--card); color: var(--fg); }
.bk-section { margin-top: 1.5rem; }
.bk-label { font-size: 14px; color: var(--muted); }
.bk-note { margin-top: .25rem; }
.bk-description { margin-top: .25rem; color: var(--muted); }
.bk-desc-source { display: inline-block; margin-top: .4rem; font-size: 14px; color: var(--muted); }
.bk-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.5rem; font-size: 15px; }
.bk-save[disabled] { opacity: .6; cursor: default; }
@keyframes bk-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bk-fade { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 720px) {
  #bk-overlay { align-items: center; padding: 1.5rem; }
  .bk-panel { max-width: 520px; border-radius: 12px; padding: 1.75rem 2rem 2rem; animation: bk-fade .18s ease-out; }
  .bk-grab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bk-panel { animation: none; } }

/* Home: one book from the shelf */
.pick__book { display: flex; gap: 1.1rem; align-items: center; margin-top: 1rem; text-decoration: none; color: inherit; line-height: 1.5; }
.pick__cover { flex: 0 0 auto; width: 64px; height: 96px; border-radius: 2px; background: var(--card); box-shadow: 0 1px 3px var(--shadow); overflow: hidden; }
.pick__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick__title { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.pick__book:hover .pick__title { color: var(--accent); }
.pick__again { margin-top: .9rem; color: var(--muted); font-size: .9em; }
