/* Global color palette */
:root {
  /* Brand — Apple system blue / red, calmer than pure RGB. */
  --primary-blue: #007AFF;   /* links, cursor */
  --accent-red:   #FF3B30;   /* link hover */
  --soft-gray:    #98989D;   /* dark-mode link hover, muted secondary text */

  /* Light theme */
  --light-bg: #ffffff;
  --light-text: #333333;
  --light-secondary-bg: #f5f5f5;
  --light-highlight: #ffffd0;

  /* Dark theme */
  --dark-bg: #1a1a1a;
  --dark-text: #ffffff;
  --dark-secondary-bg: #2d2d2d;
  --dark-highlight: #2d2d2d;

  /* Misc */
  --black: #000000;
  --white: #ffffff;
  --transparent: transparent;
}

/* ================================================================
   Body font + motion tokens.

   To swap font:
   1. Pick ONE preset below by uncommenting its --font-body line.
   2. If it's a Google Font (Inter / Lato / IBM Plex Sans), update the
      Google Fonts <link> in _layouts/default.html and index.html.
      For system stacks no <link> is needed.
   3. Hard-reload.

   Preset                   --font-body                                                                Google Fonts URL
   --------                 -----------                                                                ----------------
   Apple system (default)   -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif (none — system fonts)
   Inter                    'Inter', system-ui, sans-serif                                              family=Inter:wght@400;500;600;700
   Lato                     'Lato', system-ui, sans-serif                                               family=Lato:wght@400;700
   IBM Plex Sans            'IBM Plex Sans', system-ui, sans-serif                                      family=IBM+Plex+Sans:wght@400;500;600;700
   Helvetica Neue           'Helvetica Neue', Helvetica, Arial, sans-serif                              (none — system fonts)
   ================================================================ */
:root {
  /* Body — Inter (Google Font). Falls back to system stack if blocked. */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  /* Display — serif used for bold titles / section headings. */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;

  /* Motion. easeOutCubic is the canonical "Apple" curve — gentle deceleration. */
  --ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-fast: 180ms;
  --duration-base: 280ms;
  --duration-slow: 420ms;
}

html {
  scroll-behavior: smooth;
  /* Anchor jumps land below the sticky site header. */
  scroll-padding-top: 64px;
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-cubic),
              opacity var(--duration-fast) var(--ease-out-cubic);
}

a:focus,
a:hover {
  color: var(--accent-red);
  text-decoration: none;
}

body {
  background-color: #F0EEE6;
}

[data-theme="dark"] body {
  background-color: var(--dark-bg);
}

body,
td,
th,
tr,
p {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Links inherit size from their parent so they don't shrink inside
   bigger paragraphs (e.g., the about / say-hi blocks). */
a {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

strong {
  font-family: var(--font-body);
  font-size: inherit;
  font-weight: 600;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
}

h2 {
  margin: 0;
  font-weight: 700;
  font-size: 32px;
}

.papertitle {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.name {
  padding-top: 12px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.one {
  width: 160px;
  height: 160px;
  position: relative;
}

.two {
  width: 160px;
  height: 160px;
  position: absolute;
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
}

.fade {
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
}

span.highlight {
  background-color: var(--light-highlight);
}

.colored-box {
    color: var(--black);
    padding: 20px;
    display: inline-block;
    border-radius: 10px;
}

/* Dark theme styles */
[data-theme="dark"] {
  background-color: var(--dark-bg);
  color: var(--dark-text);
}

/* Dark mode reads better with red as the link color (#007AFF on dark is
   muddy) and a calm gray on hover. */
[data-theme="dark"] a {
  color: var(--accent-red);
}

[data-theme="dark"] a:focus,
[data-theme="dark"] a:hover {
  color: var(--soft-gray);
}

[data-theme="dark"] span.highlight {
  background-color: var(--dark-highlight);
}

/* Project row styles */
.project-row {
  background-color: var(--light-secondary-bg);
  color: var(--light-text);
  transition: background-color var(--duration-base) var(--ease-out-cubic),
              box-shadow var(--duration-base) var(--ease-out-cubic);
}

.project-row td {
  color: inherit;
}

.project-row:hover {
  background-color: var(--light-bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .project-row {
  background-color: var(--dark-secondary-bg);
  color: var(--dark-text);
}

[data-theme="dark"] .project-row:hover {
  background-color: var(--dark-highlight);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.project-thumb {
  width: 160px;
  height: 160px;
  position: relative;
  overflow: hidden;
}

.project-thumb img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease-in-out;
}

.project-thumb img.is-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.project-thumb:hover img.is-hover {
  opacity: 1;
}

.project-thumb:hover img.is-base {
  opacity: 0;
}

/* Theme toggle button styles */
.theme-toggle {
  background: none;
  position: fixed;
  margin: 0;
  top: 20px;
  right: 20px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  outline: none;
  background-color: none;
  box-shadow: none;
  cursor: pointer;
  font-size: 1.2em;
  transition: background-color 0.3s ease;
  color: inherit;
}

[data-theme="dark"] .theme-toggle {
  background-color: none;
  color: var(--white);
}

.theme-toggle:hover {
  background-color: var(--transparent);
}

[data-theme="dark"] .theme-toggle:hover {
  background-color: var(--transparent);
}

.theme-toggle:hover i.fa-moon {
  color: var(--primary-blue);
  transition: color 0.5s ease;
}

.theme-toggle:hover i.fa-sun {
  color: var(--accent-red);
  transition: color 0.5s ease;
}

/* Project Page Styles */
.project {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.project-header {
  margin-bottom: 2rem;
}

.project-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.project-subtitle {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 1rem;
  font-weight: normal;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.project-meta span {
  background-color: var(--bg-color);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-color);
}

.project-image {
  margin: 2rem 0;
  text-align: center;
}

.project-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Music page — wider container (1200px) so 2 videos per row breathe. */
body.page-music .project {
  max-width: 1400px;
}

/* ================================================================
   Dashboard — content stats + visitor map. Stats are computed at
   build time via Jekyll/Liquid; ClustrMaps loads visitor data live.
   ================================================================ */
.dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

.dashboard__header {
  margin-bottom: 32px;
}

.dashboard__title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.dashboard__lede {
  margin: 0 0 24px;
  color: var(--soft-gray);
  font-size: 15px;
  max-width: 60ch;
}

.dashboard__section-heading {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--soft-gray);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .dashboard__section-heading {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dashboard__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard__grid--small {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 720px) {
  .dashboard__grid,
  .dashboard__grid--small {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 20px 18px;
  background: rgba(255, 255, 255, 0.4);
  transition: border-color var(--duration-base) var(--ease-out-cubic),
              transform var(--duration-base) var(--ease-out-cubic),
              background-color var(--duration-base) var(--ease-out-cubic);
}

.stat:hover {
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  background: var(--white);
}

[data-theme="dark"] .stat {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .stat:hover {
  border-color: var(--accent-red);
  background: rgba(255, 255, 255, 0.04);
}

.stat__value {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: inherit;
}

.stat__label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--soft-gray);
  margin: 0;
}

.dashboard__map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .dashboard__map {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.dashboard__map-link {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Places page — keep the title/subtitle, but strip the website link and
   the back-to-home link so only the title block + map remain. */
body.page-places .project-links,
body.page-places .project > div:last-child {
  display: none;
}

/* The project shell goes full-width on this page; pull the header back
   into a readable centered column so the title doesn't stretch edge-to-edge. */
body.page-places .project-header {
  max-width: 800px;
  margin: 0 auto 1rem;
  padding: 1rem 1rem 0;
}

/* Map fills the viewport width; iframe is oversized + offset so the
   Google MyMaps top bar (title / share / fullscreen / profile) is cropped
   off-screen. The visible area is just the map canvas. */
.places-map {
  position: relative;
  width: 100%;
  height: 65vh;
  margin: 0;
  overflow: hidden;
}

.places-map iframe {
  position: absolute;
  top: -64px;          /* crop the MyMaps title bar */
  left: 0;
  width: 100%;
  height: calc(100% + 64px);
  border: 0;
}

.project-content {
  line-height: 1.6;
  color: var(--text-color);
}

.project-content h2 {
  margin: 2rem 0 1rem;
  color: var(--text-color);
}

.project-content ul, 
.project-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.project-links {
  margin-top: 3rem;
  text-align: center;
}

.project-website {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background-color: var(--text-color);
  color: var(--bg-color);
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.project-website:hover {
  opacity: 0.8;
}

/* Custom cursor (single blue dot, no easing) */
.cursor-enabled,
.cursor-enabled a,
.cursor-enabled button {
  cursor: none;
}

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--primary-blue) 75%, transparent);
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  transform: translate3d(-50%, -50%, 0);
  /* Only animate visual changes, never the position transform. */
  transition: width 0.15s ease, height 0.15s ease, background-color 0.15s ease;
}

.cursor-dot.is-hover {
  width: 16px;
  height: 16px;
  background-color: color-mix(in srgb, var(--accent-red) 75%, transparent);
}

/* Soft spotlight that trails the cursor 1:1 — no easing so it stays glued
   to the dot. Sits behind the dot. */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle,
                              color-mix(in srgb, var(--primary-blue) 22%, transparent) 0%,
                              color-mix(in srgb, var(--primary-blue) 10%, transparent) 30%,
                              transparent 65%);
  pointer-events: none;
  z-index: 9998;
  will-change: transform;
  transform: translate3d(-50%, -50%, 0);
  transition: background 0.25s ease, opacity 0.2s ease;
}

.cursor-glow.is-hover {
  background: radial-gradient(circle,
                              color-mix(in srgb, var(--accent-red) 22%, transparent) 0%,
                              color-mix(in srgb, var(--accent-red) 10%, transparent) 30%,
                              transparent 65%);
}

/* Glow reads as a soft white-blue against the dark background. */
[data-theme="dark"] .cursor-glow {
  background: radial-gradient(circle,
                              color-mix(in srgb, var(--primary-blue) 30%, transparent) 0%,
                              color-mix(in srgb, var(--primary-blue) 14%, transparent) 30%,
                              transparent 65%);
  mix-blend-mode: screen;
}

[data-theme="dark"] .cursor-glow.is-hover {
  background: radial-gradient(circle,
                              color-mix(in srgb, var(--accent-red) 30%, transparent) 0%,
                              color-mix(in srgb, var(--accent-red) 14%, transparent) 30%,
                              transparent 65%);
}

/* Hide custom cursor on touch / coarse pointers */
@media (hover: none), (pointer: coarse) {
  .cursor-dot,
  .cursor-glow {
    display: none;
  }
  .cursor-enabled,
  .cursor-enabled a,
  .cursor-enabled button {
    cursor: auto;
  }
}

/* Side-projects section */
.side-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.side-project {
  display: block;
  padding: 16px 18px;
  border-radius: 10px;
  background-color: var(--light-secondary-bg);
  color: var(--light-text);
  text-decoration: none;
  transition: transform var(--duration-base) var(--ease-out-cubic),
              background-color var(--duration-base) var(--ease-out-cubic),
              box-shadow var(--duration-base) var(--ease-out-cubic),
              color var(--duration-fast) var(--ease-out-cubic);
}

.side-project:hover {
  transform: translateY(-3px);
  background-color: var(--light-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  color: var(--primary-blue);
}

.side-project__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 4px 0;
}

.side-project__meta {
  font-size: 12px;
  color: inherit;
  opacity: 0.75;
  margin: 0;
}

[data-theme="dark"] .side-project {
  background-color: var(--dark-secondary-bg);
  color: var(--dark-text);
}

[data-theme="dark"] .side-project:hover {
  background-color: var(--dark-highlight);
  color: var(--primary-blue);
}

/* Project meta chips (shared) */
.project-meta span {
  display: inline-block;
  padding: 4px 10px;
  margin: 0 4px;
  border-radius: 4px;
  font-size: 13px;
  background: var(--light-secondary-bg);
  color: var(--light-text);
}

[data-theme="dark"] .project-meta span {
  background: var(--dark-secondary-bg);
  color: var(--dark-text);
}

.project-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.project-website {
  display: inline-block;
  padding: 10px 22px;
  background: transparent;
  color: var(--primary-blue);
  border: 1px solid var(--primary-blue);
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--duration-base) var(--ease-out-cubic),
              color var(--duration-base) var(--ease-out-cubic),
              border-color var(--duration-base) var(--ease-out-cubic);
}

.project-website:hover {
  background: var(--primary-blue);
  color: #fff;
}

/* Food Diaries — dynamic gallery
   Width is handled at the page level via body.page-wide .page-container. */
.foodiaries {
  margin: 0 auto;
}

.foodiaries__intro {
  margin-bottom: 24px;
}

.foodiaries__filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
  padding: 18px;
  background: var(--light-secondary-bg);
  border-radius: 8px;
}

[data-theme="dark"] .foodiaries__filters {
  background: var(--dark-secondary-bg);
}

.foodiaries__filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.foodiaries__label {
  font-weight: 700;
  font-size: 13px;
  min-width: 70px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.foodiaries__chip {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--light-secondary-bg);
  background: var(--light-bg);
  color: var(--light-text);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out-cubic),
              border-color var(--duration-fast) var(--ease-out-cubic),
              color var(--duration-fast) var(--ease-out-cubic);
}

.foodiaries__chip:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.foodiaries__chip.is-active {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

[data-theme="dark"] .foodiaries__chip {
  background: var(--dark-bg);
  color: var(--dark-text);
  border-color: var(--dark-secondary-bg);
}

.foodiaries__chip-count {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.foodiaries__chip.is-active .foodiaries__chip-count {
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .foodiaries__chip-count {
  color: #888;
}

.foodiaries__year-range {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 260px;
}

/* Dual-thumb range slider.
   Two range inputs are overlaid on the same track. The :before bar shows
   the full track; --range-start and --range-end (set from JS) tint the
   selected segment. pointer-events on the inputs are tuned so both thumbs
   stay grabbable even when overlapping. */
.foodiaries__dual-range {
  position: relative;
  flex: 1;
  height: 28px;
  --range-start: 0%;
  --range-end: 100%;
}

.foodiaries__dual-range::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--light-secondary-bg);
  border-radius: 2px;
  transform: translateY(-50%);
}

.foodiaries__dual-range::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 4px;
  background: var(--primary-blue);
  border-radius: 2px;
  transform: translateY(-50%);
  left: var(--range-start);
  right: calc(100% - var(--range-end));
}

[data-theme="dark"] .foodiaries__dual-range::before {
  background: var(--dark-bg);
}

.foodiaries__dual-range input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  background: transparent;
  appearance: none;
  pointer-events: none;
  margin: 0;
}

.foodiaries__dual-range input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary-blue);
  cursor: pointer;
  pointer-events: auto;
  margin-top: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.foodiaries__dual-range input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary-blue);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.foodiaries__dual-range input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
}

.foodiaries__year-display {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 110px;
  text-align: right;
}

.foodiaries__count {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 14px;
}

.foodiaries__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.foodiaries__card {
  background: var(--light-bg);
  border: 1px solid var(--light-secondary-bg);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--light-text);
  text-decoration: none;
  transition: border-color var(--duration-base) var(--ease-out-cubic),
              transform var(--duration-base) var(--ease-out-cubic),
              box-shadow var(--duration-base) var(--ease-out-cubic);
}

.foodiaries__card:hover {
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
  color: var(--light-text);
}

[data-theme="dark"] .foodiaries__card,
[data-theme="dark"] .foodiaries__card:hover {
  background: var(--dark-secondary-bg);
  border-color: var(--dark-secondary-bg);
  color: var(--dark-text);
}

[data-theme="dark"] .foodiaries__card:hover {
  border-color: var(--primary-blue);
}

.foodiaries__media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--light-secondary-bg);
  overflow: hidden;
}

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

/* Carousel arrows — visible only on hover, large touch target on mobile. */
.foodiaries__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  z-index: 2;
}

.foodiaries__nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.foodiaries__nav--prev { left: 6px; }
.foodiaries__nav--next { right: 6px; }

.foodiaries__card-wrap:hover .foodiaries__nav {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  /* On touch devices, always show the arrows. */
  .foodiaries__nav { opacity: 1; width: 30px; height: 30px; font-size: 22px; }
}

.foodiaries__counter {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.foodiaries__card-wrap:hover .foodiaries__counter {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .foodiaries__counter { opacity: 1; }
}

/* Search input */
.foodiaries__search {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--light-secondary-bg);
  background: var(--light-bg);
  color: var(--light-text);
  min-width: 220px;
}

.foodiaries__search:focus {
  outline: none;
  border-color: var(--primary-blue);
}

[data-theme="dark"] .foodiaries__search {
  background: var(--dark-bg);
  color: var(--dark-text);
  border-color: var(--dark-secondary-bg);
}

.foodiaries__body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.foodiaries__caption {
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.foodiaries__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.foodiaries__pill {
  background: var(--light-secondary-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

[data-theme="dark"] .foodiaries__pill {
  background: var(--dark-bg);
}

.foodiaries__empty {
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--light-secondary-bg);
  border-radius: 8px;
  opacity: 0.7;
}

/* Music — YouTube video gallery */
.music {
  margin: 0 auto;
}

.music__filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--light-secondary-bg);
  border-radius: 8px;
}

[data-theme="dark"] .music__filters {
  background: var(--dark-secondary-bg);
}

.music__filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.music__label {
  font-weight: 700;
  font-size: 13px;
  min-width: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.music__count {
  font-size: 13px;
  opacity: 0.7;
  margin: 0 0 14px;
}

.music__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 480px) {
  .music__grid { grid-template-columns: 1fr; }
}

.music__card {
  background: var(--light-bg);
  border: 1px solid var(--light-secondary-bg);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--light-text);
  transition: border-color var(--duration-base) var(--ease-out-cubic),
              transform var(--duration-base) var(--ease-out-cubic),
              box-shadow var(--duration-base) var(--ease-out-cubic);
}

.music__card:hover {
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] .music__card,
[data-theme="dark"] .music__card:hover {
  background: var(--dark-secondary-bg);
  border-color: var(--dark-secondary-bg);
  color: var(--dark-text);
}

[data-theme="dark"] .music__card:hover {
  border-color: var(--primary-blue);
}

.music__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.music__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-base) var(--ease-out-cubic),
              filter var(--duration-fast) var(--ease-out-cubic);
}

.music__card:hover .music__media img {
  transform: scale(1.03);
  filter: brightness(0.92);
}

.music__media iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.music__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out-cubic);
}

.music__play:hover {
  transform: scale(1.06);
}

.music__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.music__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.music__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.music__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.music__pill {
  background: var(--light-secondary-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

[data-theme="dark"] .music__pill {
  background: var(--dark-bg);
}

.music__empty {
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--light-secondary-bg);
  border-radius: 8px;
  opacity: 0.7;
}

/* Thinking — category filter chips */
.writing-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.writing-chip {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--light-secondary-bg);
  background: var(--light-bg);
  color: var(--light-text);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out-cubic),
              border-color var(--duration-fast) var(--ease-out-cubic),
              color var(--duration-fast) var(--ease-out-cubic);
}

.writing-chip:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.writing-chip.is-active {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

[data-theme="dark"] .writing-chip {
  background: var(--dark-bg);
  color: var(--dark-text);
  border-color: var(--dark-secondary-bg);
}

.writing-chip__count {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.writing-chip.is-active .writing-chip__count {
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .writing-chip__count { color: #888; }

/* Sort toggle (newest ↔ oldest) — sits at the right end of the filter row */
.writing-sort {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--light-secondary-bg);
  border-radius: 999px;
  color: var(--light-text);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out-cubic),
              color var(--duration-fast) var(--ease-out-cubic);
}

.writing-sort:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.writing-sort__icon {
  font-size: 14px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .writing-sort {
  color: var(--dark-text);
  border-color: var(--dark-secondary-bg);
}

/* Per-row category pill (sits next to the date in the index) */
.writing-index__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.writing-index__chip {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--light-secondary-bg);
  color: var(--light-text);
  text-transform: uppercase;
  white-space: nowrap;
}

[data-theme="dark"] .writing-index__chip {
  background: var(--dark-secondary-bg);
  color: var(--dark-text);
}

/* Thinking — writings index (arslan.io-style hover micro-interactions) */
.writing-index {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.writing-index__item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  transition: border-color var(--duration-base) var(--ease-out-cubic);
}

[data-theme="dark"] .writing-index__item {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.writing-index__link {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 18px 4px;     /* extra right pad reserves space for the arrow */
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-base) var(--ease-out-cubic),
              padding-left var(--duration-base) var(--ease-out-cubic);
}

/* Slide right on hover — no background tint. */
.writing-index__link:hover {
  transform: translateX(4px);
}

/* Arrow → slides in from the left edge of the right padding on hover. */
.writing-index__link::after {
  content: "→";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  opacity: 0;
  font-size: 18px;
  color: var(--primary-blue);
  transition: opacity var(--duration-base) var(--ease-out-cubic),
              transform var(--duration-base) var(--ease-out-cubic);
}

.writing-index__link:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

[data-theme="dark"] .writing-index__link::after {
  color: var(--accent-red);
}

.writing-index__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-blue);
  letter-spacing: -0.01em;
  transition: color var(--duration-base) var(--ease-out-cubic);
}

.writing-index__link:hover .writing-index__title {
  color: var(--accent-red);
}

[data-theme="dark"] .writing-index__title {
  color: var(--accent-red);
}

[data-theme="dark"] .writing-index__link:hover .writing-index__title {
  color: var(--soft-gray);
}

.writing-index__date {
  font-size: 12px;
  opacity: 0.55;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: opacity var(--duration-base) var(--ease-out-cubic);
}

.writing-index__link:hover .writing-index__date {
  opacity: 0.9;
}

.writing-index__excerpt {
  margin: 6px 0 0;
  padding: 0 28px 0 4px;
  font-size: 13.5px;
  opacity: 0.7;
  line-height: 1.5;
  transition: opacity var(--duration-base) var(--ease-out-cubic);
}

.writing-index__item:hover .writing-index__excerpt {
  opacity: 0.95;
}

/* Thinking — single writing */
.writing {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 8px;
}

.writing-header {
  margin-bottom: 32px;
}

.writing-meta {
  font-size: 13px;
  opacity: 0.7;
  margin: 0 0 12px;
}

.writing-title {
  font-size: 28px;
  line-height: 1.3;
  margin: 0 0 8px;
}

.writing-subtitle {
  font-size: 16px;
  font-style: italic;
  opacity: 0.8;
  margin: 0;
}

.writing-content {
  font-size: 15px;
  line-height: 1.7;
}

.writing-content p {
  margin: 0 0 1.1em;
}

.writing-content blockquote {
  margin: 1.4em 0;
  padding: 4px 18px;
  border-left: 3px solid var(--primary-blue);
  font-style: italic;
  opacity: 0.9;
}

.writing-content h2,
.writing-content h3 {
  margin: 1.8em 0 0.5em;
  font-weight: 700;
}

.writing-content h2 { font-size: 20px; }
.writing-content h3 { font-size: 17px; }

.writing-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6em auto;
  border-radius: 6px;
}

.writing-source {
  font-size: 13px;
  margin: 0 0 18px;
  padding: 8px 14px;
  border-left: 3px solid var(--primary-blue);
  background: var(--light-secondary-bg);
  border-radius: 0 4px 4px 0;
}

[data-theme="dark"] .writing-source {
  background: var(--dark-secondary-bg);
}

.writing-source a {
  color: var(--primary-blue);
}

.writing-source a:hover {
  color: var(--accent-red);
}

/* Caption popup — a real tooltip bubble sitting BELOW the card so it can
   extend beyond the card width and isn't clipped by the square thumbnail. */
.foodiaries__card-wrap {
  position: relative;  /* anchor for the absolutely-positioned popup */
}

.foodiaries__overlay {
  position: absolute;
  /* No vertical gap — popup touches card. The visible padding above content
     creates breathing room. This way the cursor can move from card straight
     into the popup without crossing dead space and dismissing it. */
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 380px;
  max-width: min(380px, calc(100vw - 32px));
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  padding: 16px 18px;
  font-size: 12.5px;
  line-height: 1.5;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity var(--duration-base) var(--ease-out-cubic),
              transform var(--duration-base) var(--ease-out-cubic);
  max-height: min(560px, 75vh);
  overflow-y: auto;
  white-space: pre-wrap;
  /* Smoother scroll on touchpads and inertia on iOS. */
  -webkit-overflow-scrolling: touch;
}

.foodiaries__overlay p { margin: 0; }

/* When the card is hovered, reveal the popup AND make it interactive
   (scrollable, hoverable). pointer-events:auto only when visible so it
   doesn't block clicks elsewhere when invisible. */
.foodiaries__card-wrap:hover .foodiaries__overlay {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

@media (hover: none), (pointer: coarse) {
  .foodiaries__card-wrap:focus-within .foodiaries__overlay {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
  }
}

/* Posting density heatmap (rows = years, cols = months) */
.foodiaries__heatmap {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: var(--light-secondary-bg);
  border-radius: 10px;
  overflow-x: auto;
}

[data-theme="dark"] .foodiaries__heatmap {
  background: var(--dark-secondary-bg);
}

.foodiaries__heatmap-loading {
  font-size: 12px;
  opacity: 0.6;
}

.foodiaries__hm-grid {
  display: grid;
  grid-template-columns: 44px repeat(12, 1fr);
  grid-auto-rows: 22px;
  gap: 4px;
  min-width: 540px;
}

.foodiaries__hm-month-label,
.foodiaries__hm-year-label {
  font-size: 10px;
  letter-spacing: 0.05em;
  opacity: 0.65;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.foodiaries__hm-year-label {
  justify-content: flex-end;
  padding-right: 6px;
  font-weight: 600;
}

.foodiaries__hm-cell {
  border: 0;
  padding: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: outline 0.1s ease, transform 0.1s ease;
}

.foodiaries__hm-cell:hover {
  transform: scale(1.15);
  outline: 1px solid var(--primary-blue);
}

.foodiaries__hm-cell.is-selected {
  outline: 2px solid var(--primary-blue);
  transform: scale(1.15);
}

/* Intensity scale: 0 = empty, 1-4 = increasing blue. */
/* Intensity scale: 0 = empty, 1-4 = increasing red (matches --accent-red #D60311). */
.foodiaries__hm-cell[data-level="0"] { background: rgba(214, 3, 17, 0.07); }
.foodiaries__hm-cell[data-level="1"] { background: rgba(214, 3, 17, 0.25); }
.foodiaries__hm-cell[data-level="2"] { background: rgba(214, 3, 17, 0.50); }
.foodiaries__hm-cell[data-level="3"] { background: rgba(214, 3, 17, 0.78); }
.foodiaries__hm-cell[data-level="4"] { background: rgba(214, 3, 17, 1); }

[data-theme="dark"] .foodiaries__hm-cell[data-level="0"] {
  background: rgba(255, 255, 255, 0.05);
}

/* Thin hairline section divider. */
.section-divider {
  display: block;
  width: 100%;
  max-width: 1200px;
  height: 0;
  margin: 42px auto;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
}

[data-theme="dark"] .section-divider {
  border-top-color: rgba(255, 255, 255, 0.10);
}

/* Built-with footer */
.page-footer {
  margin: 40px auto 30px;
  text-align: center;
  font-size: 12px;
  color: #9a9a9a;
}

.page-footer__map {
  position: relative;
  margin: 14px auto 0;
  max-width: 180px;
  opacity: 0.85;
}

.page-footer__map img,
.page-footer__map svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.page-footer a {
  color: inherit;
  border-bottom: 1px dotted currentColor;
}

.page-footer a:hover {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

.page-footer a.page-footer__map-link,
.page-footer a.page-footer__map-link:hover {
  position: absolute;
  inset: 0;
  display: block;
  border-bottom: 0;
  cursor: pointer;
}

[data-theme="dark"] .page-footer { color: #6e6e6e; }
[data-theme="dark"] .page-footer a:hover { color: var(--accent-red); border-bottom-color: var(--accent-red); }

/* ================================================================
   Site header — sticky banner with primary nav. Appears on every page
   via _includes/site-header.html (wired into index.html and the
   default layout). The fixed top-right theme toggle and top-left
   history nav have z-index 50, which keeps them above the header.
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  background: rgba(240, 238, 230, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .site-header {
  background: rgba(26, 26, 26, 0.78);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.site-header__nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 80px;          /* leave room for the fixed top-corner buttons */
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.site-header__link {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: inherit;
  position: relative;
  padding: 4px 2px;
}

.site-header__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--primary-blue);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--duration-base) var(--ease-out-cubic);
}

.site-header__link:hover {
  color: var(--primary-blue);
}

.site-header__link:hover::after {
  transform: scaleX(1);
}

[data-theme="dark"] .site-header__link:hover {
  color: var(--accent-red);
}

[data-theme="dark"] .site-header__link::after {
  background: var(--accent-red);
}

@media (max-width: 600px) {
  .site-header__nav {
    padding: 10px 64px;
    gap: 18px;
  }
  .site-header__link {
    font-size: 14px;
  }
}

/* ================================================================
   Page-level layout containers.
   .hero-band  — full-bleed-ish hero (max ~1200px)
   .narrow     — content sections capped at ~820px (projects, side-projects)
   .full-bleed-page — used by the foodiaries page to break out of the
                      default 800px chrome and use the viewport width.
   ================================================================ */
.hero-band {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 24px;
}

.narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Default page chrome used by _layouts/default.html for project + writing pages. */
.page-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}


/* For pages that need full-width canvas (e.g. food diaries gallery). */
body.page-wide .page-container {
  max-width: 1500px;
  padding: 0 24px;
}

.page-nav {
  text-align: center;
  padding: 18px 0 8px;
  font-size: 14px;
}

/* Back / forward — top-left, mirroring the theme toggle in the top-right.
   Hits browser history directly; no stack tracking. */
.page-history-nav {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 8px;
  z-index: 50;
}

.page-history-nav__btn {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out-cubic),
              border-color var(--duration-fast) var(--ease-out-cubic),
              color var(--duration-fast) var(--ease-out-cubic);
}

.page-history-nav__btn:hover {
  background-color: rgba(0, 122, 255, 0.08);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

[data-theme="dark"] .page-history-nav__btn {
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .page-history-nav__btn:hover {
  background-color: rgba(255, 59, 48, 0.12);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.page-main {
  padding: 16px 0 32px;
}

/* Override default .project chrome on the foodiaries page so it's allowed
   to fill the wide container. */
body.page-wide .project {
  max-width: none;
  padding: 0;
}

/* Foodiaries 40/60 split: filters/heatmap on the left, posts on the right.
   Stacks on small screens. */
.foodiaries--split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);  /* 40 / 60 */
  gap: 32px;
  align-items: start;
}

.foodiaries__sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 4px;  /* small gutter from the scrollbar */
}

.foodiaries__main {
  min-width: 0;  /* allow grid contents to shrink, prevent overflow */
}

@media (max-width: 900px) {
  .foodiaries--split {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .foodiaries__sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
}
