/* Light theme (default) */
:root,
[data-theme="light"] {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --text: #111;
  --text-muted: #666;
  --border: #e0e0e0;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-alt: #141414;
  --text: #f5f5f5;
  --text-muted: #888;
  --border: #222;
}

[data-theme="reading"] {
  --bg: #f5f0e8;
  --bg-alt: #ebe4d9;
  --text: #2d2a26;
  --text-muted: #5c5650;
  --border: #d4ccbe;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

body.mobile-menu-open {
  overflow: hidden;
}

/* ---- text ripple (staggered reveal on load) ---- */
.text-ripple-in {
  opacity: 0;
  transform: translateY(10px);
  animation: text-ripple-in 0.45s ease-out forwards;
}

@keyframes text-ripple-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- scroll reveal ---- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- loading skeleton pulse ---- */
.skeleton-pulse {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 6px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

button {
  font: inherit;
  cursor: pointer;
}

/* ---- focus-visible (keyboard accessibility) ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 2px;
  border-radius: 4px;
}

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

a:hover {
  text-decoration: underline;
}

/* ---- layout ---- */
.site-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  max-width: 720px;
  margin: 0 0 0 16px;
  min-height: 100vh;
  padding: 0 24px 0 0;
  box-sizing: border-box;
}

@media (min-width: 800px) {
  .site-shell {
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .site-shell {
    grid-template-columns: 1fr;
    margin: 0;
    padding: 0 12px;
  }
}

@media (max-width: 480px) {
  .site-shell {
    padding: 0 8px;
  }

  .site-shell--dashboard {
    padding: 0 8px;
  }
}

.site-shell--photos,
.site-shell--videos,
.site-shell--books,
.site-shell--movies {
  max-width: 1400px;
  width: 100%;
}

/* ---- sidebar ---- */
.sidebar-admin {
  align-self: flex-start;
  color: var(--text-muted);
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.sidebar-admin:hover {
  color: var(--text);
  background: var(--bg-alt);
}
.sidebar-admin-icon {
  width: 18px;
  height: 18px;
  display: block;
}
.sidebar {
  padding: 48px 24px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .sidebar {
    padding: 20px 0 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    padding: 16px 0 12px;
    gap: 12px 20px;
  }
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.brand-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 640px) {
  .nav {
    flex-direction: row;
    gap: 16px;
  }
}

.nav-link {
  color: var(--text-muted);
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: color var(--transition), padding-left 0.2s ease, border-color 0.2s ease;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
  padding-left: 8px;
  border-left-color: var(--border);
}

.nav-link.active {
  color: var(--text);
  font-weight: 500;
  padding-left: 8px;
  border-left-color: var(--text);
}

/* ---- nav dropdown (library) — inline expand-down, no floating box ---- */
.nav-dropdown {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-dropdown-trigger {
  display: block;
  color: var(--text-muted);
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: default;
  transition: color var(--transition);
}

.nav-dropdown:hover .nav-dropdown-trigger {
  color: var(--text);
}

.nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-menu {
  max-height: 120px;
  opacity: 1;
}

.nav-dropdown-menu .nav-link {
  display: block;
  padding: 4px 0 4px 14px;
  font-size: 13px;
}

.nav-link--mobile-only {
  display: none;
}

@media (max-width: 640px) {
  .nav-dropdown {
    display: none;
  }
  .nav-link--mobile-only {
    display: block;
  }
}

/* ---- sidebar music player (below nav, all pages) ---- */
.sidebar-music {
  margin-top: auto;
  padding-top: 20px;
}

.sidebar-footer {
  padding-top: 16px;
}

.music-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.music-player .music-prev,
.music-player .music-next {
  border: none;
  background: var(--text-muted);
  padding: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  cursor: pointer;
  line-height: 1;
  -webkit-mask-size: 18px;
  mask-size: 18px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  border-radius: 6px;
  transition: background 0.15s ease;
}

/* Prev = left-pointing triangle, Next = right-pointing triangle */
.music-player .music-prev {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 12L18 6v12L6 12z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 12L18 6v12L6 12z'/%3E%3C/svg%3E");
}

.music-player .music-next {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M18 12L6 6v12l12-6z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M18 12L6 6v12l12-6z'/%3E%3C/svg%3E");
}

.music-player .music-prev:hover,
.music-player .music-next:hover {
  background: var(--text);
}

@media (max-width: 640px) {
  .music-player .music-prev,
  .music-player .music-next {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  -webkit-mask-size: 24px;
  mask-size: 24px;
  }
}

.music-art-wrap {
  flex-shrink: 0;
}

.music-art {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  flex-shrink: 0;
}

/* Rotation driven by JS from music-player.js to preserve position when paused */

.music-art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: 1;
  -webkit-mask-size: 24px;
  mask-size: 24px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  border-radius: 50%;
}

.music-play {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7L8 5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7L8 5z'/%3E%3C/svg%3E");
}

.music-play[data-state="playing"] {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 4h4v16H6V4zm8 0h4v16h-4V4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 4h4v16H6V4zm8 0h4v16h-4V4z'/%3E%3C/svg%3E");
}

.music-play:hover {
  background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .music-play {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .music-play:hover {
  background: rgba(255, 255, 255, 0.85);
}

@media (max-width: 640px) {
  .music-play {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    -webkit-mask-size: 28px;
    mask-size: 28px;
  }
}

.music-title {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
}

.music-volume-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 88px;
  padding: 0 5px;
  box-sizing: content-box;
}

.music-volume {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 4px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.15s ease;
  vertical-align: middle;
}

.music-volume:hover {
  background: var(--text-muted);
}

@media (max-width: 640px) {
  .music-volume {
    height: 5px;
  }
}

.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  vertical-align: middle;
}

.music-volume:hover::-webkit-slider-thumb {
  background: var(--text);
}

.music-volume:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

.music-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  margin: 0;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .music-volume::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
  }
}

.music-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.music-volume:hover::-moz-range-thumb {
  background: var(--text);
}

.music-volume:active::-moz-range-thumb {
  transform: scale(1.15);
}

.music-volume::-moz-range-track {
  height: 4px;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .music-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 640px) {
  .sidebar-music {
    margin-top: 0;
    padding-top: 0;
    order: 3;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    width: 100%;
  }

  .music-player {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .music-controls {
    order: 1;
    flex: 0 0 auto;
  }

  .music-title {
    order: 2;
    flex: 1 1 100%;
    text-align: center;
  }

  .music-volume-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: 120px;
    margin: 0 auto;
  }
}

.sidebar-tagline {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-style: italic;
  font-weight: 400;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  opacity: 0;
  animation: tagline-fade 1.2s ease 0.8s forwards;
}

@keyframes tagline-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- main ---- */
.main {
  padding: 48px 0 64px 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 640px) {
  .main {
    padding: 24px 0 48px 0;
  }
}

/* ---- mobile menu (hamburger) - full-screen overlay ---- */
.mobile-menu-btn {
  display: none;
  border: none;
  background: none;
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.mobile-menu-btn:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.mobile-menu-icon {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.mobile-menu-icon::before {
  top: -6px;
}

.mobile-menu-icon::after {
  top: 6px;
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-y: auto;
}

.mobile-nav.is-open {
  display: flex;
}

.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 24px;
}

.mobile-nav-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
}

.mobile-nav-brand:hover {
  text-decoration: none;
  color: var(--text);
}

.mobile-nav-brand-mark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mobile-nav-brand-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mobile-nav-close {
  border: none;
  background: none;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-close:hover {
  color: var(--text);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 20px 32px;
  flex: 1;
}

.mobile-nav-link {
  padding: 14px 0;
  font-size: 16px;
  color: var(--text-muted);
  border: none;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-link:last-child {
  border-bottom: none;
}

.mobile-nav-link:hover {
  color: var(--text);
}

.mobile-nav-link.active {
  color: var(--text);
  font-weight: 500;
}

.mobile-nav-search {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: none;
}

.mobile-nav-socials {
  display: flex;
  gap: 20px;
  padding: 24px 20px 32px;
  border-top: 1px solid var(--border);
}

.mobile-nav-socials .social-link {
  padding: 8px;
  min-width: 40px;
  min-height: 40px;
}

@media (min-width: 641px) {
  .mobile-nav {
    display: none !important;
  }
}

/* ---- mobile music bar (training page only, when sidebar hidden) ---- */
.mobile-music-bar {
  display: none;
}

@media (max-width: 640px) {
  .mobile-music-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 60;
  }

  .mobile-music-prev,
  .mobile-music-next {
    border: none;
    background: var(--text-muted);
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    cursor: pointer;
    -webkit-mask-size: 20px;
    mask-size: 20px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    border-radius: 8px;
    transition: background 0.15s ease;
  }

  .mobile-music-prev {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 12L18 6v12L6 12z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 12L18 6v12L6 12z'/%3E%3C/svg%3E");
  }

  .mobile-music-next {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M18 12L6 6v12l12-6z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M18 12L6 6v12l12-6z'/%3E%3C/svg%3E");
  }

  .mobile-music-prev:hover,
  .mobile-music-next:hover {
    background: var(--text);
  }

  .mobile-music-play {
    border: none;
    background: var(--text-muted);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    -webkit-mask-size: 24px;
    mask-size: 24px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    border-radius: 50%;
    transition: background 0.15s ease;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7L8 5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7L8 5z'/%3E%3C/svg%3E");
  }

  .mobile-music-play[data-state="playing"] {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 4h4v16H6V4zm8 0h4v16h-4V4z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 4h4v16H6V4zm8 0h4v16h-4V4z'/%3E%3C/svg%3E");
  }

  .mobile-music-play:hover {
    background: var(--text);
  }

  .mobile-music-title {
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Space for fixed bottom player (injected by music-player.js) */
  body.has-mobile-music-bar .site-shell > .main {
    padding-bottom: max(72px, calc(40px + 56px + env(safe-area-inset-bottom, 0px)));
  }
}

@media (max-width: 640px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    display: none;
  }

  .header-actions .socials {
    display: none;
  }

  .site-shell {
    grid-template-columns: 1fr;
  }

  .main {
    padding-left: 0;
  }
}

/* ---- header (socials + theme toggle) ---- */
.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

@media (min-width: 920px) {
  .header-actions {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 100;
    margin-bottom: 0;
    flex-direction: row;
    gap: 16px;
  }
}

.socials {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.social-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
  transform: translateY(-2px) scale(1.1);
}

.socials .social-link:nth-child(1),
.mobile-nav-socials .social-link:nth-child(1) { color: #6e7681; }
.socials .social-link:nth-child(1):hover,
.mobile-nav-socials .social-link:nth-child(1):hover { color: #e6edf3; }
.socials .social-link:nth-child(2),
.mobile-nav-socials .social-link:nth-child(2) { color: #6b7280; }
.socials .social-link:nth-child(2):hover,
.mobile-nav-socials .social-link:nth-child(2):hover { color: #0a66c2; }
.socials .social-link:nth-child(3),
.mobile-nav-socials .social-link:nth-child(3) { color: #6b7280; }
.socials .social-link:nth-child(3):hover,
.mobile-nav-socials .social-link:nth-child(3):hover { color: #e4405f; }

[data-theme="light"] .socials .social-link:nth-child(1),
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(1) { color: #57606a; }
[data-theme="light"] .socials .social-link:nth-child(1):hover,
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(1):hover { color: #24292f; }
[data-theme="light"] .socials .social-link:nth-child(2),
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(2) { color: #57606a; }
[data-theme="light"] .socials .social-link:nth-child(2):hover,
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(2):hover { color: #0a66c2; }
[data-theme="light"] .socials .social-link:nth-child(3),
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(3) { color: #57606a; }
[data-theme="light"] .socials .social-link:nth-child(3):hover,
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(3):hover { color: #e4405f; }

.socials .social-link:nth-child(4),
.mobile-nav-socials .social-link:nth-child(4) { color: #6b7280; }
.socials .social-link:nth-child(4) .social-icon,
.mobile-nav-socials .social-link:nth-child(4) .social-icon { transform: scale(1.2) translateY(-1px); transform-origin: center center; }
.socials .social-link:nth-child(4):hover,
.mobile-nav-socials .social-link:nth-child(4):hover { color: #fc4c02; }

[data-theme="light"] .socials .social-link:nth-child(4),
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(4) { color: #57606a; }
[data-theme="light"] .socials .social-link:nth-child(4):hover,
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(4):hover { color: #fc4c02; }

.social-link--resume,
.socials .social-link:nth-child(5),
.mobile-nav-socials .social-link:nth-child(5) { color: #6b7280; }
.social-link--resume:hover,
.socials .social-link:nth-child(5):hover,
.mobile-nav-socials .social-link:nth-child(5):hover { color: #22c55e; }

[data-theme="light"] .social-link--resume,
[data-theme="light"] .socials .social-link:nth-child(5),
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(5) { color: #57606a; }
[data-theme="light"] .social-link--resume:hover,
[data-theme="light"] .socials .social-link:nth-child(5):hover,
[data-theme="light"] .mobile-nav-socials .social-link:nth-child(5):hover { color: #16a34a; }

.social-link:hover {
  text-decoration: none;
}


.social-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
  shape-rendering: geometricPrecision;
}

.mobile-nav-socials .social-icon {
  width: 22px;
  height: 22px;
}

@media (max-width: 480px) {
  .header-actions {
    margin-bottom: 16px;
  }

  .social-link {
    min-width: 32px;
    min-height: 32px;
    padding: 4px;
  }

  .social-icon {
    width: 16px;
    height: 16px;
  }
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 10px 14px;
  min-width: 44px;
  min-height: 44px;
  color: var(--text-muted);
  line-height: 1;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.theme-toggle .theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.theme-icon.sun { display: flex; }

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

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

@media (min-width: 920px) {
  .theme-toggle {
    margin-left: 20px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .theme-toggle .theme-icon svg {
    width: 20px;
    height: 20px;
  }
}

[data-theme="light"] .theme-icon.moon { display: none; }
.theme-icon.moon { display: none; }
[data-theme="dark"] .theme-icon.sun { display: none; }
[data-theme="dark"] .theme-icon.moon { display: flex; }
[data-theme="reading"] .theme-icon.sun { display: none; }
[data-theme="reading"] .theme-icon.moon { display: flex; }

/* reading mode: brown social icons and UI (override brand colors) */
[data-theme="reading"] .socials .social-link:nth-child(1),
[data-theme="reading"] .socials .social-link:nth-child(2),
[data-theme="reading"] .socials .social-link:nth-child(3),
[data-theme="reading"] .socials .social-link:nth-child(4),
[data-theme="reading"] .socials .social-link:nth-child(5),
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(1),
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(2),
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(3),
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(4),
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(5),
[data-theme="reading"] .social-link--resume,
[data-theme="reading"] .sidebar-admin { color: #5c5650; }
[data-theme="reading"] .sidebar-admin:hover { color: #2d2a26; }
[data-theme="reading"] .socials .social-link:nth-child(1):hover,
[data-theme="reading"] .socials .social-link:nth-child(2):hover,
[data-theme="reading"] .socials .social-link:nth-child(3):hover,
[data-theme="reading"] .socials .social-link:nth-child(4):hover,
[data-theme="reading"] .socials .social-link:nth-child(5):hover,
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(1):hover,
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(2):hover,
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(3):hover,
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(4):hover,
[data-theme="reading"] .mobile-nav-socials .social-link:nth-child(5):hover,
[data-theme="reading"] .social-link--resume:hover { color: #2d2a26 !important; }
[data-theme="reading"] .theme-toggle { color: #5c5650; border-color: #d4ccbe; }
[data-theme="reading"] .theme-toggle:hover { color: #2d2a26; border-color: #5c5650; }
[data-theme="reading"] .search-trigger { color: #5c5650; border-color: #d4ccbe; }
[data-theme="reading"] .search-trigger:hover { color: #2d2a26; border-color: #5c5650; }
[data-theme="reading"] .search-trigger-key { border-color: #d4ccbe; }

/* ---- search trigger ---- */
.search-trigger {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 8px 12px;
  min-height: 44px;
  color: var(--text-muted);
  line-height: 1;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin-left: 0;
}
.search-trigger:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.search-trigger-label { opacity: 0.8; }
.search-trigger-key {
  font-weight: 600;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
}

/* ---- command palette ---- */
.command-palette-open { overflow: hidden; }
.command-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px;
  animation: command-palette-fade 0.15s ease;
}
@keyframes command-palette-fade {
  from { opacity: 0; } to { opacity: 1; }
}
.command-palette {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.command-palette-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.command-palette-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.command-palette-input::placeholder { color: var(--text-muted); }
.command-palette-hint {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.command-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}
.command-palette-group {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 14px 4px;
}
.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.command-palette-item:hover,
.command-palette-item.selected {
  background: var(--bg-alt);
}
.command-palette-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.command-palette-icon svg { width: 18px; height: 18px; }
.command-palette-label { flex: 1; }
.command-palette-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .search-trigger { display: none !important; }
  .command-palette-overlay {
    padding: 8vh 12px 12px;
    align-items: flex-start;
  }
  .command-palette {
    max-width: none;
    border-radius: 16px;
  }
  .command-palette-header {
    padding: 16px 18px;
    gap: 14px;
  }
  .command-palette-input {
    font-size: 18px;
  }
  .command-palette-list {
    max-height: 60vh;
    padding: 12px 0;
  }
  .command-palette-item {
    padding: 14px 18px;
    gap: 14px;
    min-height: 52px;
  }
  .command-palette-group {
    padding: 10px 18px 6px;
    font-size: 12px;
  }
}

/* ---- page (generic) ---- */
.page {
  max-width: 560px;
}

.page:has(.photos-grid),
.page:has(.videos-grid),
.page:has(.books-grid),
.page:has(.movies-grid) {
  max-width: none;
}

.page-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-lead {
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---- home ---- */
.page-home .hero-title {
  margin: 0 0 12px;
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-home .hero-title--hoverable {
  position: relative;
  cursor: default;
  display: inline-block;
  overflow: hidden;
}

.page-home .hero-title--hoverable .hero-name-text {
  display: block;
  transition: opacity 0.2s ease;
}

.page-home .hero-title--hoverable .hero-quote-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-size: 0.22em;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  color: #ff69b4;
  -webkit-text-fill-color: #ff69b4;
  overflow: hidden;
}

.page-home .hero-title--hoverable.hovering .hero-name-text {
  opacity: 0;
}

.page-home .hero-title--hoverable.hovering .hero-quote-text {
  opacity: 1;
}

.page-home .hero-subtitle {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.55;
}

.page-home .hero-subtitle .hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: hero-word-in 0.4s ease forwards;
}

@keyframes hero-word-in {
  to { opacity: 1; transform: translateY(0); }
}

.hero-links {
  margin: 0;
  font-size: 14px;
}

.hero-links a {
  color: var(--text-muted);
}

.hero-links a:hover {
  color: var(--text);
}

.hero-links a + a {
  margin-left: 16px;
}

/* ---- about ---- */
.about-blocks {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.about-block {
  padding-left: 20px;
  border-left: 2px solid var(--border);
  transition: border-color 0.3s ease;
}

.about-block:hover {
  border-left-color: var(--text-muted);
}

.about-block h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.about-block p {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.65;
}

.about-block p + p {
  margin-top: 0.75em;
}

/* ---- blog list ---- */
.blog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-item {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.blog-item:last-child {
  border-bottom: none;
}

.blog-item-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 0;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
  outline-offset: 2px;
}

/* Override global `a:hover { text-decoration: underline }` for whole-row link */
.blog-item-link:hover,
.blog-item-link:focus-visible,
.blog-item-link:active {
  text-decoration: none;
}

.blog-item-link:hover .blog-item-title,
.blog-item-link:focus-visible .blog-item-title {
  color: var(--text-muted);
}

.blog-item .blog-meta {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.blog-item-title {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}

.blog-item.blog-loading {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px;
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 8px;
  border-bottom: none;
  max-width: 200px;
}

.blog-item .blog-excerpt {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 480px;
}

/* ---- post (single story) ---- */
.post .post-meta {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.post .post-title {
  margin: 0 0 24px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-audio-wrap {
  margin: 0 0 20px;
  max-width: 100%;
}

.post-audio-wrap[hidden] {
  display: none !important;
}

.post-audio-card {
  position: relative;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  max-width: 520px;
}

.post-audio-label {
  margin: 0 0 3px;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.post-audio-trim-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.post-audio-trim-hint[hidden] {
  display: none !important;
}

.post-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.post-audio-play {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.post-audio-play:hover {
  border-color: color-mix(in srgb, var(--text-muted) 55%, var(--border));
  background: var(--bg);
}

.post-audio-play:active {
  transform: scale(0.97);
}

.post-audio-play:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-alt), 0 0 0 4px color-mix(in srgb, var(--text) 35%, transparent);
}

.post-audio-play:not(.is-playing) .post-audio-ico-pause,
.post-audio-play.is-playing .post-audio-ico-play {
  display: none;
}

.post-audio-ico {
  display: block;
}

.post-audio-progress-outer {
  flex: 1 1 140px;
  min-width: 0;
}

.post-audio-progress {
  position: relative;
  height: 5px;
  border-radius: 999px;
  cursor: pointer;
  outline: none;
}

.post-audio-progress:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-alt), 0 0 0 4px color-mix(in srgb, var(--text) 30%, transparent);
  border-radius: 999px;
}

.post-audio-progress-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 92%, var(--text-muted));
}

.post-audio-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 78%, var(--text-muted));
  pointer-events: none;
  min-width: 0;
}

.post-audio-progress-fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg-alt);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.post-audio-time {
  flex-shrink: 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--text) 72%, var(--text-muted));
  letter-spacing: 0.02em;
  min-width: 6.75em;
}

.post-audio-vol-inline {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.post-audio-vol-icon {
  flex-shrink: 0;
  display: flex;
  color: color-mix(in srgb, var(--text-muted) 88%, var(--text));
  opacity: 0.9;
}

.post-audio-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 18px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  vertical-align: middle;
}

.post-audio-volume:focus {
  outline: none;
}

.post-audio-volume:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-alt), 0 0 0 4px color-mix(in srgb, var(--text) 28%, transparent);
  border-radius: 4px;
}

.post-audio-volume::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 88%, var(--text-muted));
}

.post-audio-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg-alt);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.post-audio-volume::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 88%, var(--text-muted));
}

.post-audio-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg-alt);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.post-audio-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Phones: system volume keys; in-player slider is redundant and awkward to use */
@media (max-width: 640px) {
  .post-audio-vol-inline {
    display: none !important;
  }
}

[data-theme="dark"] .post-audio-card {
  box-shadow: none;
  background: var(--bg-alt);
}

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

[data-theme="dark"] .post-audio-play:hover {
  background: color-mix(in srgb, var(--bg-alt) 55%, var(--bg));
}

.post-body {
  font-size: 15px;
  line-height: 1.65;
  padding-top: 4px;
}

.post-body p {
  margin: 0 0 1em;
}

.post-body p:last-child {
  margin-bottom: 0;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1em 0;
  display: block;
}

.post-body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body a:hover {
  color: var(--text-muted);
}

.post-back {
  margin: 32px 0 0;
  padding-top: 24px;
  font-size: 14px;
}

.post-back a {
  color: var(--text-muted);
}

.post-back a:hover {
  color: var(--text);
}

/* ---- photos ---- */
.photos-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.photos-filter {
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.photos-filter:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.photos-filter.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---- home projects (now / future / done / all) ---- */
.projects-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.projects-filter {
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.projects-filter:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.projects-filter.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.projects-section-heading {
  margin: 36px 0 12px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.projects-section-heading:first-of-type {
  margin-top: 0;
}

.project-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 20px 20px 24px;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.project-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.project-card p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card p:last-child {
  margin-bottom: 0;
}

.project-card-dates {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px !important;
}

.project-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

/* Quill blocks: <p>, <div>, or loose <em> — flex gap keeps spacing even with margin collapse */
.project-card-desc > * {
  margin: 0;
}

/* Direct <em> blocks (Quill sometimes leaves these outside <p>) */
.project-card-desc > em {
  display: block;
  font-style: italic;
}

.project-card-desc > ul,
.project-card-desc > ol {
  padding-left: 1.25em;
}

.project-card-desc li ul,
.project-card-desc li ol {
  margin: 0.35em 0 0;
}

.project-card-desc li > p {
  margin: 0 0 0.35em;
}

.project-card-desc li > p:last-child {
  margin-bottom: 0;
}

.project-card-desc a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.project-card--has-preview {
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card--has-preview:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.project-preview-hint {
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.5;
  margin-left: 8px;
}

.project-preview {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  transform-origin: bottom center;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 320px;
  max-width: 80vw;
}

/* Portaled to <body>; centered in viewport so it never covers the next card in the grid */
.project-preview.project-preview--portal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2147483000;
  bottom: auto;
  margin: 0;
  max-height: min(78vh, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.project-preview.project-preview--portal .project-preview-img,
.project-preview.project-preview--portal .project-preview-video {
  max-height: min(72vh, 480px);
  width: auto;
  max-width: min(92vw, 360px);
  object-fit: contain;
}

.project-preview.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Transform for legacy (non-portal) only — portaled previews set transform inline */
.project-preview.visible:not(.project-preview--portal) {
  transform: translateX(-50%) scale(1);
}

.project-preview.project-preview--portal.visible {
  pointer-events: auto;
}

.project-preview-img,
.project-preview-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.project-preview--below {
  bottom: auto;
  top: calc(100% + 12px);
  transform-origin: top center;
}

.project-preview--below.project-preview {
  transform: translateX(-50%) scale(0.85);
}

.project-preview--below.visible:not(.project-preview--portal) {
  transform: translateX(-50%) scale(1);
}

@media (max-width: 600px) {
  /* Non-portal fallback (unused when preview is portaled in portfolio.js) */
  .project-preview:not(.project-preview--portal) {
    position: fixed;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.85);
    width: 90vw;
    max-width: 360px;
  }
  .project-preview:not(.project-preview--portal).visible {
    transform: translate(-50%, -50%) scale(1);
  }
}

.projects-empty {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.projects-empty code {
  font-size: 12px;
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
}

.photos-sort {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.photos-sort:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.photos-sort.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

@media (max-width: 768px) {
  .photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .photos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ---- videos (media) ---- */
.videos-page-subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.videos-page-subtitle a {
  color: var(--text-muted);
}

.videos-page-subtitle a:hover {
  color: var(--text);
}

.videos-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 20px;
}

.videos-audio-details {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.videos-audio-details summary {
  cursor: pointer;
  color: var(--text-muted);
  list-style-position: outside;
  padding: 6px 0;
  user-select: none;
}

.videos-audio-details summary:hover {
  color: var(--text);
}

.videos-audio-details[open] summary {
  margin-bottom: 8px;
  color: var(--text);
}

.videos-audio-details-body {
  margin: 0;
  padding: 0 0 4px 12px;
  border-left: 1px solid var(--border);
}

.videos-sort {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.videos-sort:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.videos-sort.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 32px;
}

.videos-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.videos-empty a {
  color: var(--text-muted);
}

.videos-empty a:hover {
  color: var(--text);
}

.media-video-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
  background: var(--bg-alt);
}

.media-video-frame {
  background: var(--bg-alt);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}

.media-video-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  pointer-events: auto;
}

.media-video-sound-row {
  margin: 0 0 6px;
}

.media-video-unmute-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.media-video-unmute-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.media-video-no-audio {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, #ca8a04 14%, transparent);
  border: 1px solid color-mix(in srgb, #ca8a04 40%, var(--border));
  border-radius: 8px;
}

.media-video-err {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(220, 38, 38, 0.12);
  background: color-mix(in srgb, #dc2626 12%, transparent);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border: 1px solid color-mix(in srgb, #dc2626 35%, var(--border));
  border-radius: 8px;
}

.media-video-body {
  padding: 14px 16px 18px;
  border-radius: 0 0 10px 10px;
}

.media-video-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.media-video-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.media-video-desc > * {
  margin: 0 0 1em;
}

.media-video-desc > *:last-child {
  margin-bottom: 0;
}

.media-video-desc > ul,
.media-video-desc > ol {
  padding-left: 1.25em;
}

.media-video-desc li ul,
.media-video-desc li ol {
  margin: 0.35em 0 0;
}

.media-video-desc li > p {
  margin: 0 0 0.35em;
}

.media-video-desc li > p:last-child {
  margin-bottom: 0;
}

.media-video-desc a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.polaroid {
  display: block;
  position: relative;
  overflow: visible;
  transition: transform 0.25s ease;
}
.polaroid-clickable {
  cursor: pointer;
}

.polaroid:hover {
  transform: translateY(-3px);
}

.polaroid-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.4s ease;
}

.polaroid:hover img {
  filter: grayscale(0%);
}

.polaroid-footer {
  padding-top: 10px;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.polaroid:hover .polaroid-footer {
  opacity: 1;
  transform: translateY(0);
}

.polaroid-title {
  display: block;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
}

.polaroid-meta {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.polaroid-caption {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.photos-empty {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--text-muted);
  padding: 32px 0;
}

/* ---- books filters ---- */
.books-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.books-filter {
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.books-filter:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.books-filter.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---- books grid ---- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.book-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
}

.book-card:hover {
  transform: translateY(-3px);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-alt);
}

.book-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(40%) brightness(0.7);
  transition: filter 0.35s ease;
}

.book-card:hover .book-cover-wrap img {
  filter: grayscale(0%) brightness(1);
}

.book-info {
  padding: 10px 0 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.book-card:not(.book-card--done) .book-info {
  opacity: 0.4;
}

.book-card:not(.book-card--done):hover .book-info {
  opacity: 1;
}

.book-card--done .book-info {
  opacity: 0;
  transform: translateY(-4px);
  text-align: center;
}

.book-card--done:hover .book-info {
  opacity: 1;
  transform: translateY(0);
}

.book-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
}

.book-rating {
  display: block;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.books-empty {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px 0;
}

/* ---- movies grid (same layout as books) ---- */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .movies-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.movie-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
}

.movie-card:hover {
  transform: translateY(-3px);
}

.movie-card .book-cover-wrap img {
  filter: grayscale(40%) brightness(0.7);
  transition: filter 0.35s ease;
}

.movie-card:hover .book-cover-wrap img {
  filter: grayscale(0%) brightness(1);
}

.movie-card-footer {
  padding-top: 10px;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.movie-card:hover .movie-card-footer {
  opacity: 1;
  transform: translateY(0);
}

.movie-card-title {
  display: block;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
}

.movie-card-rating {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.movies-empty {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px 0;
}

.movies-loading {
  font-size: 13px;
  color: var(--text-muted);
  margin: 24px 0;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 8px;
  max-width: 180px;
}

.books-section--empty .books-section-title {
  opacity: 0.5;
}

.books-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.books-loading {
  font-size: 13px;
  color: var(--text-muted);
  margin: 24px 0;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 8px;
  max-width: 180px;
}

/* ---- photo lightbox ---- */
.photo-lightbox-open { overflow: hidden; }
.photo-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}
.photo-lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.photo-lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.photo-lightbox-caption {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  max-width: 560px;
  line-height: 1.5;
}
.photo-lightbox-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.photo-lightbox-close svg {
  flex-shrink: 0;
}
.photo-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.photos-empty code {
  font-size: 12px;
  padding: 2px 6px;
  background: var(--bg-alt);
  border-radius: 4px;
}

/* ---- training dashboard ---- */
.site-shell--dashboard,
.site-shell:has(.page--dashboard) {
  max-width: min(1920px, 100%);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

@media (max-width: 640px) {
  .site-shell--dashboard .main,
  .site-shell:has(.page--dashboard) .main {
    padding-top: 8px;
    padding-bottom: 72px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .site-shell--dashboard .header-actions,
  .site-shell:has(.page--dashboard) .header-actions {
    margin-bottom: 8px;
  }
}

@media (max-width: 480px) {
  .site-shell--dashboard .main,
  .site-shell:has(.page--dashboard) .main {
    padding-top: 6px;
    padding-bottom: 72px;
  }

  .site-shell--dashboard .header-actions,
  .site-shell:has(.page--dashboard) .header-actions {
    margin-bottom: 6px;
  }
}

.main--dashboard {
  max-width: none;
}

.page--dashboard {
  max-width: none;
}

.training-header {
  margin-bottom: 20px;
}

.training-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.training-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.training-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.training-filters-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.training-filters-buttons {
  display: flex;
  gap: 4px;
}

.training-filter {
  padding: 8px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 4px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

@media (max-width: 640px) {
  .training-filter {
    padding: 10px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.training-filter:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.training-filter.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 24px;
  max-width: 100%;
}

.dashboard-card:nth-child(1) { grid-column: 1; grid-row: 1; }
.dashboard-card:nth-child(2) { grid-column: 2; grid-row: 1; }
.dashboard-card:nth-child(3) { grid-column: 2; grid-row: 2; }
.dashboard-card:nth-child(4) { grid-column: 1; grid-row: 2; }
.dashboard-card:nth-child(5) { grid-column: 2; grid-row: 3; }
.dashboard-card:nth-child(6) { grid-column: 1 / -1; grid-row: 4; }

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .dashboard-card:nth-child(n) {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (min-width: 1200px) {
  .dashboard-grid {
    gap: 28px;
  }
}

.dashboard-card {
  background: var(--bg-alt);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
  border-color: var(--text-muted);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

@media (max-width: 640px) {
  .page--dashboard {
    overflow-x: hidden;
  }

  .dashboard-card {
    padding: 6px;
  }

  .dashboard-chart-wrap {
    height: 80px;
  }

  .dashboard-chart-wrap--tall {
    height: 110px;
  }

  .dashboard-chart-wrap--donut {
    height: 90px;
  }

  .dashboard-card-head {
    margin-bottom: 4px;
  }

  .dashboard-card-title {
    font-size: 11px;
  }

  .dashboard-card-summary {
    font-size: 10px;
    color: var(--text-muted);
  }

  .training-title {
    font-size: 16px;
  }

  .training-subtitle {
    font-size: 11px;
    color: var(--text-muted);
  }

  .training-header {
    margin-bottom: 8px;
  }

  .training-filters {
    margin-bottom: 10px;
    gap: 4px;
  }

  .dashboard-grid {
    gap: 8px;
  }

  .stat-row {
    padding: 2px 0;
  }

  .stat-label {
    font-size: 10px;
    color: var(--text-muted);
  }

  .stat-value {
    font-size: 10px;
    color: var(--text);
  }

  .dashboard-stats {
    gap: 2px;
  }
}

@media (max-width: 480px) {
  .dashboard-card {
    padding: 8px;
  }

  .dashboard-chart-wrap {
    height: 55px;
  }

  .dashboard-chart-wrap--tall {
    height: 70px;
  }

  .dashboard-chart-wrap--donut {
    height: 60px;
  }

  .dashboard-card-head {
    margin-bottom: 4px;
  }

  .dashboard-card-title {
    font-size: 11px;
  }

  .dashboard-card-summary {
    font-size: 9px;
  }

  .training-title {
    font-size: 18px;
  }

  .training-subtitle {
    font-size: 12px;
  }

  .training-header {
    margin-bottom: 10px;
  }

  .training-filters {
    margin-bottom: 12px;
  }

  .training-filters-label {
    font-size: 10px;
  }

  .training-filter {
    padding: 8px 12px;
    font-size: 11px;
    min-height: 44px;
  }

  .dashboard-grid {
    gap: 2px;
  }

  .consistency-cell {
    width: 5px;
    height: 5px;
    min-width: 5px;
    min-height: 5px;
  }

  .consistency-grid {
    grid-template-columns: repeat(53, 5px);
    grid-auto-rows: 5px;
    gap: 1px;
  }

  .stat-label,
  .stat-value {
    font-size: 11px;
  }

  .dashboard-stats {
    gap: 0;
  }
}

@media (max-width: 360px) {
  .dashboard-chart-wrap {
    height: 50px;
  }

  .dashboard-chart-wrap--tall {
    height: 60px;
  }

  .dashboard-chart-wrap--donut {
    height: 55px;
  }

  .consistency-cell {
    width: 4px;
    height: 4px;
    min-width: 4px;
    min-height: 4px;
  }

  .consistency-grid {
    grid-template-columns: repeat(53, 4px);
    grid-auto-rows: 4px;
    gap: 1px;
  }
}

.dashboard-card--full {
  grid-column: 1 / -1;
}

.dashboard-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-card-head--row {
  align-items: center;
}

.dashboard-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-card-summary {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .dashboard-card-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-card-summary {
    white-space: normal;
    flex: 1 1 100%;
    order: 2;
  }
}

.dashboard-chart-wrap {
  height: 220px;
  position: relative;
}

.dashboard-chart-wrap--tall {
  height: 320px;
}

.dashboard-chart-wrap--donut {
  height: 260px;
}

.dashboard-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.consistency-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .consistency-wrap {
    padding-bottom: 2px;
  }
}

.consistency-grid {
  display: grid;
  grid-template-columns: repeat(53, 12px);
  grid-auto-rows: 12px;
  gap: 3px;
  min-width: min-content;
}

.consistency-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  min-width: 12px;
  min-height: 12px;
}

@media (max-width: 640px) {
  .consistency-grid {
    grid-template-columns: repeat(53, 6px);
    grid-auto-rows: 6px;
    gap: 2px;
  }

  .consistency-cell {
    width: 6px;
    height: 6px;
    min-width: 6px;
    min-height: 6px;
    border-radius: 1px;
  }
}

.consistency-cell--level-0 {
  background: var(--border);
}

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

.consistency-cell--level-1 {
  background: rgba(100, 149, 100, 0.35);
}

.consistency-cell--level-2 {
  background: rgba(100, 149, 100, 0.55);
}

.consistency-cell--level-3 {
  background: rgba(100, 149, 100, 0.75);
}

.consistency-cell--level-4 {
  background: rgba(100, 149, 100, 0.95);
}
