/* ---- tokens (lifted from the reference site's Tailwind scale) ---- */
:root {
  --color-bg: #ffffff;
  --color-fg: #000000;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-800: #262626;
  --neutral-900: #171717;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #000000;
    --color-fg: #ffffff;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-fg);
}

p, ul, ol, h1, h2, h3 {
  margin: 0; /* all spacing is controlled by explicit classes below */
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.page {
  max-width: 36rem; /* max-w-xl */
  width: 100%;
  margin-top: 2rem; /* mt-8 */
  display: flex;
  flex-direction: column;
  padding-left: 1rem;
  padding-right: 1rem;
  transition: max-width 0.2s var(--ease);
}

/* widened while the archive view is active, so the gallery, its heading,
   and the shared footer all stay aligned to the same edge */
.page.page--wide {
  max-width: 1040px;
}

/* ---- nav ---- */
.nav-wrap {
  margin-left: -8px;
  margin-bottom: 4rem; /* mb-16 */
  letter-spacing: -0.025em; /* tracking-tight */
}

.nav {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  position: relative;
  overflow-x: auto;
}

.nav-links {
  display: flex;
  flex-direction: row;
  padding-right: 2.5rem;
}

.nav-link {
  transition: all 0.15s var(--ease);
  display: flex;
  align-items: center;
  position: relative;
  padding: 0.25rem 0.5rem;
  margin: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
  color: var(--neutral-800);
}

@media (prefers-color-scheme: dark) {
  .nav-link:hover,
  .nav-link.active {
    color: var(--neutral-200);
  }
}

/* ---- shared type ---- */
.view { width: 100%; }

.name-heading {
  margin-bottom: 2rem; /* mb-8 */
  font-size: 1.5rem; /* text-2xl */
  line-height: 2rem;
  font-weight: 600; /* semibold */
  letter-spacing: -0.05em; /* tracking-tighter */
}

.section-label {
  margin-bottom: 1rem; /* mb-4 */
  font-weight: 600;
}

.body-text { margin-bottom: 1rem; line-height: 1.5; }

/* gives a <p> a list-style bullet without making it an <li> */
.bullet-p {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem; /* space-y-2, matches Louis's li spacing */
}

.bullet-p::before {
  content: "\2022";
  position: absolute;
  left: 0.25rem;
  color: currentColor;
}

/* nested sub-point under a .bullet-p, matches Louis's list-[circle] sub-list */
.bullet-sub {
  position: relative;
  padding-left: 1.25rem;
  margin-left: 1.25rem; /* nests under the parent bullet's indent */
  margin-bottom: 0.25rem; /* space-y-1 */
}

.bullet-sub::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.55em;
  width: 0.28em;
  height: 0.28em;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent; /* hollow ring, matches native list-style-type: circle */
}

.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-6 { margin-top: 1.5rem; }
.my-8 { margin: 2rem 0; }
.ml-2 { margin-left: 0.5rem; }

.bullet-list {
  list-style-type: disc;
  padding-left: 1.25rem;
}

.bullet-list li + li { margin-top: 0.5rem; } /* space-y-2 */

.link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- post list (home + blog page) ---- */
.post-list { list-style-type: disc; }

.post-list li a {
  display: inline;
  transition: color 0.15s var(--ease);
}

.post-list li a:hover { color: var(--neutral-500); }

.post-list h3 {
  display: inline;
  margin: 0;
  color: var(--neutral-800);
  font-size: 1rem;
  font-weight: 400;
}

@media (prefers-color-scheme: dark) {
  .post-list h3 { color: var(--neutral-200); }
}

.post-list .post-date {
  font-size: 0.75rem;
  color: var(--neutral-400);
  font-variant-numeric: tabular-nums;
  margin-left: 0.5rem;
}

/* ---- portrait ---- */
.portrait-box {
  position: relative;
  width: 320px;
  height: 400px;
  max-width: 100%;
  margin-bottom: 3rem; /* mb-12 */
  overflow: hidden;
  background: var(--neutral-200);
}

@media (prefers-color-scheme: dark) {
  .portrait-box { background: var(--neutral-900); }
}

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

/* ---- blog post view ---- */
.post-title {
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.05em;
  margin: 0;
}

.post-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

#post-date {
  font-size: 0.875rem;
  color: var(--neutral-600);
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  #post-date { color: var(--neutral-400); }
}

.prose { max-width: none; text-align: left; }

.prose p {
  margin-top: 1rem;
  margin-bottom: 1rem;
  color: var(--neutral-800);
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .prose p { color: var(--neutral-200); }
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--neutral-400);
  text-underline-offset: 2px;
  text-decoration-thickness: 0.1em;
  transition: all 0.15s var(--ease);
}

.prose a:hover { text-decoration-color: var(--neutral-600); }

.prose img { width: 100%; border-radius: 0.5rem; margin: 0; }

.prose h1, .prose h2, .prose h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  font-weight: 500;
}

.prose h2, .prose h3 { font-size: 1.25rem; line-height: 1.75rem; }

.prose ul { list-style-type: disc; padding-left: 1.25rem; }

.prose pre {
  border-radius: 0.5rem;
  border: 1px solid var(--neutral-200);
  background: #fafafa;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
}

@media (prefers-color-scheme: dark) {
  .prose pre { border-color: var(--neutral-900); background: var(--neutral-900); }
}

/* ---- archive view ---- */
.archive-grid {
  column-count: 3;
  column-gap: 1rem;
}

@media (max-width: 900px) {
  .archive-grid { column-count: 2; }
}

@media (max-width: 560px) {
  .archive-grid { column-count: 1; }
}

.archive-item {
  position: relative;
  margin-bottom: 1rem;
  break-inside: avoid;
  cursor: zoom-in;
  overflow: hidden;
  background: var(--neutral-200);
}

@media (prefers-color-scheme: dark) {
  .archive-item { background: var(--neutral-900); }
}

.archive-item img,
.archive-item video {
  width: 100%;
  height: auto;
  display: block;
}

/* clicking the video toggles play/pause, not zoom — only the expand
   button opens the full view, so the parent's zoom-in cursor is wrong here */
.archive-item--video video {
  cursor: pointer;
}

/* video grid thumbnails: autoplaying-muted preview + play badge/timeline/mute */
.video-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  color: #fff;
  pointer-events: none;
}

.video-icon {
  display: flex;
  flex: none;
  width: 11px;
  height: 11px;
}

/* without an explicit size, a sourceless <svg> falls back to its intrinsic
   300x150 and gets clipped away by the cell's overflow:hidden in Safari
   (Chrome happens to shrink it to fit instead) — size every icon's svg
   explicitly so both engines render it the same */
.video-icon svg,
.video-mute-btn svg,
.video-expand-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.video-timeline {
  flex: 1;
  /* visual bar stays 3px tall; the padding+negative-margin trick grows the
     actual tap target to ~24px without widening the overlay's layout */
  height: 3px;
  padding: 10px 0;
  margin: -10px 0;
  background: rgba(255, 255, 255, 0.35);
  background-clip: content-box;
  border-radius: 2px;
  cursor: pointer;
  pointer-events: auto;
  box-sizing: content-box;
  touch-action: none; /* dragging the bar scrubs — it shouldn't also scroll the page */
}

.video-timeline-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

/* icons stay visually small; padding + negative margin grows the actual
   tap target to ~30px for comfortable thumb use without widening the bar */
.video-expand-btn {
  flex: none;
  box-sizing: content-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 8px;
  margin: -8px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

.video-mute-btn {
  flex: none;
  box-sizing: content-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 7px;
  margin: -7px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}

/* ---- lightbox (full-quality view) ---- */
.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 50;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s var(--ease);
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-close svg {
  width: 16px;
  height: 16px;
}

.lightbox-content {
  cursor: default;
  max-width: 100%;
  max-height: 100%;
  transform: scale(0.96);
  transition: transform 0.2s var(--ease);
}

.lightbox.is-open .lightbox-content {
  transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem); /* avoids iOS Safari's address-bar jump */
  width: auto;
  height: auto;
}

@media (max-width: 560px) {
  .lightbox { padding: 0.75rem; }
  .lightbox-content img,
  .lightbox-content video {
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
  }
}

/* ---- connect view ---- */
.social-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.social-link {
  display: inline-flex;
  align-items: center;
  transition: all 0.15s var(--ease);
  color: var(--neutral-600);
}

.social-link:hover { color: var(--neutral-800); }

@media (prefers-color-scheme: dark) {
  .social-link { color: var(--neutral-300); }
  .social-link:hover { color: #f5f5f5; }
}

/* ---- footer ---- */
.footer { margin-bottom: 4rem; }

.footer-links {
  list-style: none;
  padding: 0;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--neutral-600);
}

@media (min-width: 768px) {
  .footer-links { flex-direction: row; gap: 1rem; }
}

@media (prefers-color-scheme: dark) {
  .footer-links { color: var(--neutral-300); }
}

.footer-link {
  display: flex;
  align-items: center;
  transition: all 0.15s var(--ease);
}

.footer-link:hover { color: var(--neutral-800); }

@media (prefers-color-scheme: dark) {
  .footer-link:hover { color: #f5f5f5; }
}

.copyright {
  margin-top: 2rem;
  color: var(--neutral-600);
}

@media (prefers-color-scheme: dark) {
  .copyright { color: var(--neutral-300); }
}
