/* ================================================
   Live (最近 / 朋友圈)
   Aesthetic: personal notebook / logbook.
   Warm paper, light-weight dates, hairline rules,
   single accent (orange ink). One signature:
   the bookmark ribbon on the active day row.
   ================================================ */

[data-theme="light"] {
  --paper: #faf6ee;
  --paper-tint: rgba(0, 0, 0, 0.018);
  --ink: #1c1917;
  --ink-soft: #57534e;
  --muted: #a8a29e;
  --thread: rgba(0, 0, 0, 0.08);
  --thread-strong: rgba(0, 0, 0, 0.14);
  --soft: rgba(234, 88, 12, 0.06);
  --accent: #ea580c;
  --accent-soft: rgba(234, 88, 12, 0.08);
  --accent-glow: rgba(234, 88, 12, 0.2);
  --header-bg: rgba(250, 246, 238, 0.82);
}

[data-theme="dark"] {
  --paper: #0e0c0a;
  --paper-tint: rgba(255, 255, 255, 0.018);
  --ink: #efe9dd;
  --ink-soft: #a8a29e;
  --muted: #78716c;
  --thread: rgba(255, 255, 255, 0.06);
  --thread-strong: rgba(255, 255, 255, 0.12);
  --soft: rgba(249, 115, 22, 0.08);
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.1);
  --accent-glow: rgba(249, 115, 22, 0.28);
  --header-bg: rgba(14, 12, 10, 0.82);
}

/* ================================================
   Base
   ================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s ease, color 0.35s ease;
}

button {
  font: inherit;
  color: inherit;
}

/* ================================================
   Header
   ================================================ */
.live-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.1rem clamp(1.25rem, 5vw, 1.75rem);
  padding-top: max(1.1rem, env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--thread);
}

.live-header .back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.35rem 0;
  transition: color 0.2s ease;
}

.live-header .back-link:hover,
.live-header .back-link:focus-visible {
  color: var(--ink);
  outline: none;
}

.live-header .back-link .arrow {
  transition: transform 0.2s ease;
}

.live-header .back-link:hover .arrow {
  transform: translateX(-2px);
}

.page-title {
  justify-self: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.page-title .mark {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.65rem;
  vertical-align: middle;
  box-shadow: 0 0 8px var(--accent-glow);
}

.theme-toggle {
  justify-self: end;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

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

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

/* ================================================
   Layout: sidebar + content
   ================================================ */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

/* ================================================
   Sidebar — table of contents
   ================================================ */
.sidebar {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  height: calc(100dvh - 53px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--thread);
}

.sidebar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.month-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 32px 28px 18px;
  border-bottom: 1px solid var(--thread);
}

.month-tab {
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

.month-tab:hover {
  color: var(--ink-soft);
}

.month-tab.is-active {
  color: var(--ink);
}

.month-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -19px; /* sits on the border line */
  height: 1px;
  background: var(--accent);
}

.day-list {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 32px;
  scrollbar-width: thin;
}

.day-list::-webkit-scrollbar {
  width: 4px;
}
.day-list::-webkit-scrollbar-thumb {
  background: var(--thread-strong);
  border-radius: 2px;
}

.day-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 9px 28px 9px 28px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  color: var(--muted);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.day-item:hover {
  color: var(--ink-soft);
}

.day-item .day-num {
  font-size: 1.1rem;
  font-weight: 400;
  color: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.day-item .day-info {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
  min-width: 0;
}

.day-item .day-tag {
  display: none;
}

.day-item .day-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.day-item.is-today .day-info {
  color: var(--accent);
  opacity: 1;
}

.day-item.is-today .day-num {
  color: var(--ink);
}

.day-item.is-active {
  color: var(--ink);
}

.day-item.is-active .day-num {
  color: var(--ink);
}

.day-item.is-active .day-info {
  color: var(--ink-soft);
  opacity: 1;
}

.day-item.is-active::before {
  /* The bookmark ribbon */
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 34px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
  box-shadow: 0 1px 4px var(--accent-glow);
  animation: ribbonIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================================================
   Sidebar — Home button
   ================================================ */
.home-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--thread);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease;
}

.home-btn:hover {
  color: var(--ink-soft);
}

.home-btn-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.home-btn.is-active {
  color: var(--ink);
}

.home-btn.is-active .home-btn-mark {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.home-btn.is-active::before {
  /* Bookmark ribbon, same shape as day-item */
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 34px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
  box-shadow: 0 1px 4px var(--accent-glow);
  animation: ribbonIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ribbonIn {
  from { transform: translate(-6px, -50%); opacity: 0; }
  to   { transform: translate(0, -50%); opacity: 1; }
}

/* ================================================
   Main content area
   ================================================ */
.content {
  min-width: 0;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 5vw, 3rem);
  padding-left: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-right, 0px));
  max-width: 680px;
  width: 100%;
  margin-left: clamp(24px, 4vw, 56px);
}

/* ================================================
   Day header (chapter title)
   ================================================ */
.day-header {
  margin-bottom: 3.5rem;
}

.day-header .chapter {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 1rem;
}

.day-header .year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.day-header .date {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.day-header .date .sep {
  color: var(--muted);
  margin: 0 0.15em;
  font-weight: 300;
}

.day-header .tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.day-header-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--thread);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.day-header-meta .sep {
  opacity: 0.4;
}

.day-header-meta .count strong {
  color: var(--ink);
  font-weight: 500;
}

/* ================================================
   Home — workout card (default landing)
   ================================================ */
.home {
  max-width: 640px;
  animation: homeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes homeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.home-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.home-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.home-location {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.home-rule {
  border: none;
  border-top: 1px solid var(--thread);
  margin: 1.75rem 0;
}

.home-context {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}

.home-context .sep {
  opacity: 0.4;
}

.home-hero {
  text-align: center;
  margin: 1rem 0 0.5rem;
  padding: 1.5rem 0 1rem;
}

.hero-value {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 7.5rem);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.045em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.hero-unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 10px;
  vertical-align: super;
  position: relative;
  top: -0.6em;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 1.25rem;
  margin: 0;
  padding: 0;
}

.home-stats .stat dt {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.home-stats .stat dt .muted {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  margin-left: 3px;
}

.home-stats .stat dd {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}

.home-hint {
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  opacity: 0.7;
  font-style: italic;
}

/* ================================================
   Home — sections (overview / activity / distance)
   ================================================ */
.home-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--thread);
}

.home-section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.home-section-sub {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  opacity: 0.6;
  text-transform: none;
  font-style: italic;
}

.home-state {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 1rem 0;
}

/* --- Overview grid --- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 1.5rem;
}

.overview-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-left: 14px;
  border-left: 1px solid var(--thread);
}

.overview-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.overview-value .unit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 4px;
  vertical-align: super;
  position: relative;
  top: -0.3em;
  font-weight: 400;
}

.overview-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Activity timeline removed --- */

/* --- Distance chart --- */
.distance-chart {
  width: 100%;
  overflow: visible;
}

.distance-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.distance-chart .axis-line {
  stroke: var(--thread);
  stroke-width: 1;
}

.distance-chart .grid-line {
  stroke: var(--thread);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.6;
}

.distance-chart .axis-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--muted);
  letter-spacing: 0.04em;
}

.distance-chart .axis-tick {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--muted);
}

.distance-chart .data-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.distance-chart .data-area {
  fill: var(--accent);
  opacity: 0.08;
}

.distance-chart .data-point {
  fill: var(--accent);
  stroke: var(--paper);
  stroke-width: 2;
  transition: r 0.2s ease;
  cursor: pointer;
}

.distance-chart .data-point:hover {
  r: 6;
}

.distance-chart-empty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

.distance-chart-single {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 1rem 0;
  text-align: center;
}

.distance-meta {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.distance-meta strong {
  color: var(--ink);
  font-weight: 500;
  margin-right: 4px;
}

.distance-meta .sep {
  opacity: 0.4;
}

/* ================================================
   Entry
   ================================================ */
.entries {
  display: flex;
  flex-direction: column;
}

.entry {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--thread);
  animation: entryIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.entry:first-child {
  border-top: none;
  padding-top: 1rem;
}

.entry:nth-of-type(1) { animation-delay: 0.04s; }
.entry:nth-of-type(2) { animation-delay: 0.10s; }
.entry:nth-of-type(3) { animation-delay: 0.16s; }
.entry:nth-of-type(n+4) { animation-delay: 0.22s; }

@keyframes entryIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.entry-time {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}

.entry-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-location svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.entry-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 56ch;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 56ch;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
}

.entry-list li {
  padding: 0.15rem 0;
}

.entry-list li + li {
  border-top: 1px dashed var(--thread);
  margin-top: 0.15rem;
  padding-top: 0.35rem;
}

/* ================================================
   Image grid
   ================================================ */
.entry-images {
  display: grid;
  gap: 4px;
  --img-radius: 4px;
  max-width: 560px;
}

.entry-images img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--img-radius);
  background: var(--paper-tint);
  cursor: zoom-in;
  transition: opacity 0.25s ease;
}

.entry-images img:hover,
.entry-images img:focus-visible {
  opacity: 0.9;
  outline: none;
}

.entry-images.images-1 {
  grid-template-columns: 1fr;
  max-width: 480px;
}
.entry-images.images-1 img {
  aspect-ratio: 4 / 3;
  max-height: 360px;
}

.entry-images.images-2 {
  grid-template-columns: repeat(2, 1fr);
}
.entry-images.images-2 img {
  aspect-ratio: 1 / 1;
}

.entry-images.images-3 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto auto;
}
.entry-images.images-3 img:nth-child(1) {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}
.entry-images.images-3 img:nth-child(n+2) {
  aspect-ratio: 1 / 1;
}

.entry-images.images-4 {
  grid-template-columns: repeat(2, 1fr);
}
.entry-images.images-4 img {
  aspect-ratio: 1 / 1;
}

.entry-images.images-5,
.entry-images.images-6,
.entry-images.images-7,
.entry-images.images-8,
.entry-images.images-9 {
  grid-template-columns: repeat(3, 1fr);
}
.entry-images.images-5 img,
.entry-images.images-6 img,
.entry-images.images-7 img,
.entry-images.images-8 img,
.entry-images.images-9 img {
  aspect-ratio: 1 / 1;
}

/* ================================================
   Empty / loading / error states
   ================================================ */
.entries-empty {
  padding: 4rem 0;
  text-align: left;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.entries-empty .hint {
  margin-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.75;
  max-width: 52ch;
  line-height: 1.7;
}

.entries-empty code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--paper-tint);
  color: var(--ink-soft);
  border: 1px solid var(--thread);
}

.state {
  padding: 3rem 0;
  text-align: left;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.state .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--thread-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================
   Footer
   ================================================ */
.live-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--thread);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ================================================
   Lightbox
   ================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
  cursor: zoom-out;
  animation: lightboxIn 0.2s ease;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
}

@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ================================================
   Mobile: drawer + capsule
   ================================================ */
.capsule {
  display: none;
}

.backdrop {
  display: none;
}

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--paper);
    border-right: 1px solid var(--thread-strong);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s ease;
  }

  .backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .capsule {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--thread-strong);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .capsule:hover {
    transform: translateX(-50%) translateY(-2px);
  }

  .capsule svg {
    color: var(--accent);
  }

  .content {
    padding-bottom: 110px;
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 0.85rem;
    letter-spacing: 0.28em;
  }
  .entry-time {
    font-size: 1.35rem;
  }
  .entry-text {
    font-size: 0.97rem;
    line-height: 1.8;
  }
  .day-header .date {
    font-size: 2.1rem;
  }
  .home-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1rem;
  }
  .hero-value {
    font-size: 4.5rem;
  }
  .home-title {
    font-size: 1.9rem;
  }
  .home-context {
    font-size: 0.72rem;
  }
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1rem;
  }
  .overview-value {
    font-size: 1.4rem;
  }
}

@media (max-width: 360px) {
  .live-header {
    padding: 0.95rem 1rem;
  }
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ================================================
   Reduced motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  .entry {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .day-item.is-active::before {
    animation: none;
  }
  .entry-images img,
  .sidebar,
  .backdrop,
  .lightbox {
    transition: none;
  }
  body {
    transition: none;
  }
}

/* ================================================
   Focus visible
   ================================================ */
:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}