/* Static pages styled after the Notion published view. */

@font-face {
  font-family: "Lyon-Text";
  src: url("/static/fonts/lyon/lyon-text-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "Lyon-Text";
  src: url("/static/fonts/lyon/lyon-text-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "Lyon-Text";
  src: url("/static/fonts/lyon/lyon-text-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "Lyon-Text";
  src: url("/static/fonts/lyon/lyon-text-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: optional;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --text: #2c2c2b;
  --text-light: #787774;
  --text-tertiary: #a19e99;
  --text-secondary: #7d7a75;
  --bg: #ffffff;
  --bg-secondary: #f7f6f3;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --border: rgba(55, 53, 47, 0.12);
  --link: #387dc9;
  --code-text: #eb5757;
  --inline-code-bg: rgba(135, 131, 120, 0.15);
  --serif: "Lyon-Text", "Source Serif 4", Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs: 17px;
  --lh: 1.6;
  --content-width: 708px;
  --page-padding: 96px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #d4d4d4;
    --text-light: #9b9b9b;
    --text-tertiary: rgba(212, 212, 212, 0.5);
    --text-secondary: #9b9b9b;
    --bg: #191919;
    --bg-secondary: #252525;
    --bg-hover: rgba(255, 255, 255, 0.055);
    --border: rgba(255, 255, 255, 0.094);
    --link: #529cca;
    --code-text: #ff7369;
    --inline-code-bg: rgba(135, 131, 120, 0.25);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: 48px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--fs);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.notion-page {
  max-width: calc(var(--content-width) + 12px);
  margin: 0 auto;
  padding: 82px 6px 96px;
}

body.is-home .notion-page {
  max-width: none;
  padding-top: 88px;
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
}

body.is-home { --fs: 15px; }

body.is-memory .notion-page {
  max-width: 1440px;
  padding-top: 72px;
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
}

.page-blocks { padding: 0 6px; }
.page-blocks > *:last-child, .page-blocks > * > *:last-child { margin-bottom: 0; }

/* page header */

.page-icon-wrap { padding: 16px 16px 0; }

.page-icon {
  width: 124px;
  height: 124px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.post .page-title { font-size: 40px; line-height: 1.2; }

.page-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin: 20px 0 4px;
  padding: 0 8px;
  letter-spacing: -0.01em;
}

.post-props {
  padding: 0 8px;
  margin: 6px 0 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  font-size: 14px;
  line-height: 21px;
}

.prop-row { display: flex; align-items: center; gap: 0; min-height: 32px; }
.prop-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 150px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}
.prop-icon { width: 14px; height: 14px; flex: 0 0 auto; }
.prop-value { display: flex; align-items: center; gap: 6px; color: var(--text); }
.post-props + .page-blocks { margin-top: 28px; }

/* blocks */

.notion-page p { margin: 0 0 8px; padding: 3px 2px; }
.notion-page p:last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--text);
  margin: 0 0 8px;
  padding: 3px 2px;
  scroll-margin-top: 72px;
}

h1 { font-size: 1.875em; font-weight: 600; line-height: 1.3; margin-top: 30px; }
h2 { font-size: 1.5em; font-weight: 600; line-height: 1.3; margin-top: 22px; }
h3 { font-size: 1.25em; font-weight: 600; line-height: 1.3; margin-top: 20px; }
h4 { font-size: 1.05em; font-weight: 600; line-height: 1.3; margin-top: 18px; }

.notion-page > h1:first-of-type { margin-top: 20px; }

.notion-page a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.notion-page a:hover { text-decoration: underline; }
.notion-page a.c-blue { color: var(--link); }

.callout {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 16px 0 4px;
  padding: 20px 16px 30px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.callout-icon { flex: 0 0 20px; font-size: 15px; line-height: 24px; margin-top: 3px; }
.notion-icon { display: inline-block; width: 23px; height: 23px; line-height: 0; flex: 0 0 auto; }
.notion-icon svg { width: 23px; height: 23px; display: block; }
.notion-icon .ni-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .notion-icon .ni-light { display: none; }
  .notion-icon .ni-dark { display: inline; }
}

.callout-body { flex: 1 1 auto; min-width: 0; }
.callout-body > * { margin-top: 0; margin-bottom: 11px; }
.callout-body > *:last-child { margin-bottom: 0; }

blockquote {
  margin: 6px 0;
  padding: 3px 2px 3px 14px;
  border-left: 3px solid currentColor;
  font-size: 1em;
}

ul, ol { margin: 2px 0; padding-left: 1.6em; }
li { padding: 2px 0; }
li > ul, li > ol { margin: 2px 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

.inline-code {
  font-family: var(--mono);
  font-size: 85%;
  color: var(--code-text);
  background: var(--inline-code-bg);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: break-spaces;
}

.code-block { margin: 8px 0; }
.code-block pre {
  margin: 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 85%;
  line-height: 1.5;
  overflow-x: auto;
}
.code-block code { font-family: inherit; }

.code-block figcaption, .image-block figcaption {
  color: var(--text-secondary);
  font-size: 0.85em;
  padding: 6px 2px 0;
}

.image-block { margin: 8px 0; }
.image-block img { max-width: 100%; height: auto; border-radius: 3px; display: block; }

.table-block { margin: 8px 0; overflow-x: auto; }
.table-block table { border-collapse: collapse; font-size: 0.95em; }
.table-block th, .table-block td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.table-block th { background: var(--bg-secondary); font-weight: 600; }

.toggle { margin: 2px 0; }
.toggle > summary { cursor: pointer; padding: 3px 2px; list-style: none; }
.toggle > summary::-webkit-details-marker { display: none; }
.toggle > summary::before { content: "▸"; display: inline-block; width: 18px; color: var(--text-light); }
.toggle[open] > summary::before { content: "▾"; }

.todo { display: flex; gap: 8px; align-items: flex-start; padding: 3px 2px; }
.todo input { margin: 6px 0 0; }

.math-inline .katex { font-size: 1em; }
.math-block { padding: 8px 2px; text-align: center; overflow-x: auto; overflow-y: hidden; }
.math-block .katex-display { margin: 0.4em 0; }
.math-block .katex-display > .katex { font-size: 1.05em; }

.bookmark { display: block; margin: 6px 0; padding: 12px; border: 1px solid var(--border); border-radius: 4px; color: inherit; text-decoration: none; }
.bookmark:hover { background: var(--bg-hover); text-decoration: none; }
.bookmark-title { display: block; font-weight: 500; }
.bookmark-url { display: block; color: var(--text-secondary); font-size: 0.85em; }

.child-page { display: block; padding: 3px 2px; }

/* table of contents */

.toc { margin: 24px 0 32px; font-size: 0.85em; line-height: 1.9; }
.toc a { display: block; color: var(--text-secondary); padding: 1px 2px; text-decoration: none; }
.toc a:hover { color: var(--text); text-decoration: underline; }
.toc .toc-h2 { padding-left: 0; }
.toc .toc-h3 { padding-left: 24px; }

/* database views */

.db-view { margin: 4px 0 87px; }
.db-list { display: flex; flex-direction: column; }

.db-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}
.db-row:hover { background: var(--bg-hover); text-decoration: none; }

.doc-icon { width: 18px; height: 18px; color: var(--text-tertiary); fill: currentColor; flex: 0 0 auto; }
.db-row-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.db-date { font-size: 14px; line-height: 21px; color: var(--text); white-space: nowrap; }

.tag { font-family: var(--sans); font-size: 13px; line-height: 18px; padding: 0 8px; border-radius: 4px; white-space: nowrap; }

.tag-default { background: rgba(227, 226, 224, 0.5); color: #32302c; }
.tag-gray { background: #e3e2e0; color: #32302c; }
.tag-brown { background: #eee0da; color: #442a1e; }
.tag-orange { background: rgba(209, 156, 0, 0.282); color: #655121; }
.tag-yellow { background: #fdecc8; color: #3f2c00; }
.tag-green { background: #dbeddb; color: #1c3829; }
.tag-blue { background: #d3e5ef; color: #183347; }
.tag-purple { background: #e8deee; color: #412454; }
.tag-pink { background: #f5e0e9; color: #4c2338; }
.tag-red { background: #ffe2dd; color: #5d1715; }

@media (prefers-color-scheme: dark) {
  .tag-default { background: rgba(255, 255, 255, 0.094); color: #d4d4d4; }
  .tag-gray { background: #5a5a5a; color: #e3e2e0; }
  .tag-brown { background: #603b2c; color: #eee0da; }
  .tag-orange { background: #854c1d; color: #fadec9; }
  .tag-yellow { background: #89632a; color: #fdecc8; }
  .tag-green { background: #2b593f; color: #dbeddb; }
  .tag-blue { background: #28456c; color: #d3e5ef; }
  .tag-purple { background: #492f64; color: #e8deee; }
  .tag-pink { background: #69314c; color: #f5e0e9; }
  .tag-red { background: #6e3630; color: #ffe2dd; }
}

/* memory gallery */

.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 24px; margin: 0 0 40px; }
.memory-item { margin: 0; }
.memory-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 3px; display: block; }
.memory-item figcaption { padding: 8px 2px 0; }
.memory-title { display: block; font-size: 0.9em; line-height: 1.4; }
.memory-date { display: block; font-size: 0.8em; color: var(--text-secondary); margin-top: 2px; }
.memory-desc { display: block; font-size: 0.8em; color: var(--text-secondary); margin-top: 2px; }

/* responsive */

@media (max-width: 900px) {
  body.is-home .notion-page,
  body.is-memory .notion-page { padding-left: 32px; padding-right: 32px; }
}

@media (max-width: 600px) {
  :root { --fs: 16px; }
  body.is-home .notion-page,
  body.is-memory .notion-page { padding-left: 16px; padding-right: 16px; }
  .notion-page { padding-bottom: 64px; }
  .page-title { font-size: 26px; }
  .db-row-meta .tag { display: none; }
  body.is-memory .notion-page { padding-top: 72px; padding-bottom: 48px; }
  .memory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
  .memory-title { font-size: 0.82em; }
  .memory-date, .memory-desc { font-size: 0.72em; }
}

/* site nav (matches the worker header) */

#site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 9999;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(55, 53, 47, 0.13);
  font: 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #37352f;
}

#site-nav .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 0 24px;
}

#site-nav .brand { font-family: ui-serif, Georgia, serif; font-weight: 700; font-size: 15px; color: inherit; text-decoration: none; white-space: nowrap; }
#site-nav nav { display: flex; align-items: center; gap: 18px; overflow-x: auto; scrollbar-width: none; }
#site-nav nav::-webkit-scrollbar { display: none; }
#site-nav nav a { color: rgba(55, 53, 47, 0.62); text-decoration: none; white-space: nowrap; padding: 4px 0; }
#site-nav nav a:hover { color: #37352f; text-decoration: none; }
#site-nav nav a[aria-current="true"] { color: #37352f; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  #site-nav { background: rgba(25, 25, 25, 0.85); border-bottom-color: rgba(212, 212, 212, 0.16); color: #d4d4d4; }
  #site-nav nav a { color: rgba(212, 212, 212, 0.6); }
  #site-nav nav a:hover { color: #d4d4d4; }
  #site-nav nav a[aria-current="true"] { color: #d4d4d4; }
}

@media (max-width: 600px) {
  #site-nav .inner { padding: 0 12px; gap: 10px; }
  #site-nav .brand { font-size: 13px; }
  #site-nav nav { gap: 10px; font-size: 12.5px; }
  #site-nav nav a[data-target="home"] { display: none; }
}

.notion-page .toc a { text-decoration: none; }
.notion-page .toc a:hover { text-decoration: none; background: var(--bg-hover); }
.notion-page .db-row, .notion-page .db-row:hover { text-decoration: none; }

/* ---------- friends ---------- */

body.is-friends .notion-page {
  max-width: 520px;
  padding: 0 32px 96px;
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
  margin: 20px 0 48px;
  padding: 0 8px;
}

.friend-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: inherit;
  transition: background-color 120ms ease;
}

.notion-page .friend-card, .notion-page .friend-card:hover { text-decoration: none; }
.notion-page .friend-card:hover { background: var(--bg-hover); }

.friend-avatar {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-secondary);
}

.friend-body { display: block; padding: 8px 10px 10px; }

.friend-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.friend-intro {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}

.friend-host {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-tertiary);
}

@media (max-width: 720px) {
  body.is-friends .notion-page { padding-left: 20px; padding-right: 20px; }
  .friend-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

@media (max-width: 420px) {
  body.is-friends .notion-page { padding-left: 12px; padding-right: 12px; }
  .friend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .friend-body { padding: 6px 8px 8px; }
  .friend-intro { font-size: 12px; line-height: 18px; }
}

.friend-bio {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 19px;
  color: var(--text-tertiary);
}

/* carousel: built by /scripts/friends.js on top of the grid above */

.friend-carousel {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 20px 0 48px;
  padding: 0 8px;
}

.friend-stage {
  position: relative;
  flex: 0 0 auto;
  width: 380px;
  transition: height 280ms ease;
}

.friend-stage .friend-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  visibility: hidden;
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 280ms ease, transform 280ms ease, background-color 120ms ease, visibility 0s linear 280ms;
}

.friend-stage .friend-card.is-active {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 280ms ease, transform 280ms ease, background-color 120ms ease, visibility 0s linear 0s;
}

.friend-thumbs {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 368px;
}

.friend-thumb {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 160ms ease;
}

.friend-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.friend-thumb:hover { opacity: 0.78; }
.friend-thumb.is-current { opacity: 1; }
.friend-thumb:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

@media (max-width: 720px) {
  .friend-carousel { flex-direction: column; align-items: center; gap: 14px; }
  .friend-stage { flex: 0 0 auto; width: 100%; max-width: 340px; }
  .friend-thumbs { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; max-height: none; }
  .friend-thumb { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .friend-stage,
  .friend-stage .friend-card,
  .friend-stage .friend-card.is-active { transition: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 404 */
body.is-404 .notion-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: none;
  min-height: calc(100vh - 48px);
  padding: 0 var(--page-padding) 96px;
  text-align: center;
}
body.is-404 p { margin: 0; }
.not-found-code { font-size: 76px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; }
.not-found-text { margin-top: 16px; font-size: 15px; color: var(--text-secondary); }
.not-found-link { display: inline-block; margin-top: 24px; font-size: 15px; color: var(--text-secondary); }
.not-found-link:hover { color: var(--text); }
