
:root {
  color-scheme: light;
  --bg: #f5f1eb;
  --paper: rgba(255, 255, 255, 0.92);
  --paper-strong: #fffaf5;
  --paper-hover: rgba(255, 255, 255, 0.98);
  --paper-fade: rgba(255, 255, 255, 0.92);
  --popover-bg: rgba(255, 255, 255, 0.98);
  --line: rgba(28, 25, 23, 0.08);
  --line-strong: rgba(28, 25, 23, 0.14);
  --ink: #1c1917;
  --ink-secondary: #57534e;
  --muted: #78716c;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --surface-soft: rgba(28, 25, 23, 0.04);
  --surface-soft-strong: rgba(28, 25, 23, 0.08);
  --heatmap-1: #d1fae5;
  --heatmap-2: #6ee7b7;
  --heatmap-3: #10b981;
  --heatmap-4: #065f46;
  --top-scrim-start: rgba(245, 241, 235, 0.8);
  --top-scrim-mid: rgba(245, 241, 235, 0.56);
  --top-scrim-end: rgba(245, 241, 235, 0);
  --menu-trigger-bg: rgba(255, 255, 255, 0.95);
  --menu-trigger-border: rgba(28, 25, 23, 0.08);
  --menu-popover-bg: rgba(255, 255, 255, 0.98);
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.08), 0 1px 3px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 18px 44px rgba(28, 25, 23, 0.18);
  --menu-shadow: 0 22px 48px rgba(28, 25, 23, 0.22);
  --radius: 18px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-xl: 16px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1917;
  --paper: rgba(41, 37, 36, 0.92);
  --paper-strong: #292524;
  --paper-hover: rgba(48, 43, 41, 0.96);
  --paper-fade: rgba(41, 37, 36, 0.92);
  --popover-bg: rgba(41, 37, 36, 0.98);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #fafaf9;
  --ink-secondary: #a8a29e;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-soft-strong: rgba(255, 255, 255, 0.08);
  --top-scrim-start: rgba(28, 25, 23, 0.84);
  --top-scrim-mid: rgba(28, 25, 23, 0.6);
  --top-scrim-end: rgba(28, 25, 23, 0);
  --menu-trigger-bg: rgba(41, 37, 36, 0.96);
  --menu-trigger-border: rgba(255, 255, 255, 0.08);
  --menu-popover-bg: rgba(41, 37, 36, 0.98);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.42);
  --menu-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --heatmap-1: rgba(52, 211, 153, 0.2);
  --heatmap-2: rgba(52, 211, 153, 0.5);
  --heatmap-3: rgba(52, 211, 153, 0.75);
  --heatmap-4: rgba(52, 211, 153, 0.95);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at top, rgba(129, 140, 248, 0.06), transparent 24%),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.03), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.icon-svg {
  display: block;
  height: 18px;
  pointer-events: none;
  width: 18px;
}

.icon-svg--small {
  height: 20px;
  width: 20px;
}

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

button,
input {
  font: inherit;
}

.public-shell a,
.public-shell button,
.public-shell input,
.public-shell img,
.public-shell [role="button"],
.public-shell [role="menuitem"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.public-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 auto;
  max-width: 1200px;
  padding: 12px 36px 128px;
}

/*
 * Outer shell matches management page-shell (1200). Inner column matches the legacy
 * public timeline: border-box 860px shell minus 36px horizontal padding => 788px.
 * Using 900px here widened cards vs that baseline and visibly shrank side margins.
 */
.public-shell > * {
  margin-inline: auto;
  max-width: 788px;
  min-width: 0;
  width: min(100%, 788px);
}

.public-topbar {
  align-items: center;
  display: grid;
  gap: 12px;
}

.public-top-scrim {
  background:
    linear-gradient(
      to bottom,
      var(--top-scrim-start),
      var(--top-scrim-mid) 58%,
      var(--top-scrim-end)
    );
  height: 92px;
  inset: 0 0 auto 0;
  max-width: 100%;
  pointer-events: none;
  position: fixed;
  width: 100%;
  z-index: 20;
}

.public-masthead {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 0;
  min-height: 0;
  padding: 0;
  position: sticky;
  top: 16px;
  z-index: 30;
}

.public-masthead__top {
  --public-header-side-width: 108px;
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns:
    var(--public-header-side-width)
    minmax(0, 1fr)
    var(--public-header-side-width);
  min-height: 56px;
}

.public-masthead__top::after {
  content: "";
  display: block;
}

.public-masthead__brand,
.public-topbar__brand {
  display: grid;
  gap: 2px;
}

.public-masthead__brand {
  align-self: center;
  justify-self: start;
}

.public-brand {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
  text-transform: uppercase;
}

/* Timeline masthead title: align with private sc-title */
.public-masthead .public-brand {
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 600;
}

.public-brand span {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* Same row model as private .active-filters-compact */
.public-active-filters.active-filters-compact {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  min-height: 20px;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  width: 100%;
}

.public-active-filters.active-filters-compact::-webkit-scrollbar {
  display: none;
}

.public-active-filters .active-filters-compact__sep {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.7rem;
}

.public-active-filters .active-filter-inline {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 0.72rem;
  gap: 4px;
  min-height: 0;
  padding: 0;
}

.public-active-filters .active-filter-inline:hover {
  color: var(--ink-secondary);
}

.public-active-filters .active-filter-inline--clear {
  color: var(--accent);
  margin-left: auto;
}

.public-active-filters[hidden] {
  display: none;
}

.public-main,
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.public-panel,
.timeline-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.public-panel {
  padding: 20px;
}

.public-panel--timeline {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.sc-compact-dock-wrap {
  align-self: center;
  display: flex;
  grid-column: 2;
  justify-content: center;
  min-width: 0;
  padding: 0;
}

.sc-compact-dock {
  align-items: center;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  gap: 0;
  min-height: 48px;
  max-width: min(520px, calc(100vw - 220px));
  padding: 6px 8px;
  position: relative;
  width: 100%;
}

/* Hidden by default; shown on mobile via media query */
#compact-search-open,
#compact-search-close {
  display: none;
}

.sc-compact-dock__main {
  align-items: center;
  display: inline-flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.sc-compact-dock__search,
.sc-compact-dock__icon-button,
.icon-button {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.sc-compact-dock__icon-button .icon-svg--small,
.icon-button .icon-svg--small {
  height: 22px;
  width: 22px;
}

.sc-compact-dock__search:hover,
.sc-compact-dock__icon-button:hover,
.sc-compact-dock__icon-button.is-active,
.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.sc-compact-dock__input {
  background: transparent;
  border: none;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  outline: none;
  padding: 0;
}

.sc-compact-dock__input::placeholder {
  color: var(--muted);
}

.sc-compact-dock__divider {
  align-self: stretch;
  background: var(--line);
  flex-shrink: 0;
  margin: 2px 6px;
  width: 1px;
}

.sc-compact-dock__popover-anchor,
.search-settings-menu {
  position: relative;
}

.search-settings-menu__popover {
  background: var(--popover-bg);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 10px;
  max-height: min(420px, calc(100vh - 84px));
  overflow: auto;
  padding: 12px;
  position: absolute;
  top: calc(100% + 10px);
  z-index: 20;
}

.search-settings-menu__popover[hidden] {
  display: none;
}

.sc-compact-dock .search-settings-menu__popover {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(260px, calc(100vw - 32px));
}

.sc-compact-dock .sc-compact-popover--sort,
.sc-compact-dock .sc-compact-popover--tags {
  width: min(260px, calc(100vw - 32px));
}

/* Tag popover: flex column so the list can shrink (min-height: 0) and scroll without a visible scrollbar. */
.sc-compact-dock .sc-compact-popover--tags.search-settings-menu__popover {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(420px, calc(100vh - 84px));
  overflow: hidden;
}

/* Higher specificity than the rule above so [hidden] still wins over display:flex */
.sc-compact-dock .sc-compact-popover--tags.search-settings-menu__popover[hidden] {
  display: none !important;
}

.sc-compact-dock .sc-compact-popover--tags .sc-compact-popover__header {
  flex-shrink: 0;
}

.sc-compact-popover__list {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.sc-compact-popover__list::-webkit-scrollbar {
  display: none;
}

.sc-compact-dock .sc-compact-popover--tags .tag-tree.sc-compact-popover__list {
  flex: 1 1 auto;
  max-height: min(240px, calc(100vh - 200px));
}

.sc-compact-dock .sc-compact-popover--calendar {
  left: auto;
  right: 0;
  transform: none;
  width: min(336px, calc(100vw - 24px));
}

.search-settings-menu__section {
  display: grid;
  gap: 8px;
}

.search-settings-menu__label,
.panel-kicker,
.section-head p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.search-seg {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-seg__btn {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-secondary);
  cursor: pointer;
  min-height: 38px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.search-seg__btn:hover,
.search-seg__btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(129, 140, 248, 0.28);
  color: var(--ink);
}

.section-head {
  display: grid;
  gap: 4px;
}

.section-head h2 {
  color: var(--ink);
  font-size: 0.98rem;
  margin: 0;
}

.section-head-spread {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.section-head-spread > div:first-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.calendar-label-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  min-width: 0;
  padding: 0;
}

.calendar-label-button .icon-svg--small {
  color: var(--ink-secondary);
  flex-shrink: 0;
  height: 28px;
  width: 28px;
}

.calendar-label-button span {
  white-space: nowrap;
}

.calendar-actions {
  display: inline-flex;
  gap: 8px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-grid {
  column-gap: 4px;
  row-gap: 4px;
  grid-auto-rows: auto;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 0.65rem;
  padding: 4px 0;
  text-align: center;
}

.calendar-day {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--ink-secondary);
  cursor: pointer;
  display: flex;
  font-size: 0.8rem;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  width: 100%;
}

.calendar-day span {
  display: block;
  text-align: center;
  width: 100%;
}

.calendar-day:hover {
  background: var(--surface-soft-strong);
}

.calendar-day[data-level="1"] {
  background: var(--heatmap-1);
}

.calendar-day[data-level="2"] {
  background: var(--heatmap-2);
  color: var(--ink);
}

.calendar-day[data-level="3"] {
  background: var(--heatmap-3);
  color: #fff;
}

.calendar-day[data-level="4"] {
  background: var(--heatmap-4);
  color: #fff;
}

.calendar-day.is-active {
  box-shadow: inset 0 0 0 2px var(--accent);
  font-weight: 600;
}

.calendar-blank {
  display: block;
}

.ghost-button {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.8rem;
  gap: 4px;
  min-height: 28px;
  padding: 4px 8px;
  transition: background 0.15s ease;
}

.ghost-button:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .ghost-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.calendar-clear {
  justify-self: start;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.tag-pill {
  align-items: center;
  background: var(--accent-soft);
  border: none;
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 0.78rem;
  justify-content: center;
  line-height: 1.2;
  min-height: 0;
  padding: 2px 10px;
}

.tag-pill--button,
.tag-pill--link {
  cursor: pointer;
}

.tag-pill--button:hover,
.tag-pill--link:hover {
  background: rgba(129, 140, 248, 0.18);
}

.tag-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: none;
}

.tag-tree::-webkit-scrollbar {
  display: none;
}

.tag-tree-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink-secondary);
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  width: 100%;
}

.tag-tree-item__copy {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.tag-tree-item:hover,
.tag-tree-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(129, 140, 248, 0.2);
  color: var(--ink);
}

.timeline-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  position: relative;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.public-timeline-footer {
  height: 1px;
}

.public-timeline-footer[hidden] {
  display: none;
}

.timeline-card:hover {
  background: var(--paper-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-0.5px);
}

.timeline-card__hit {
  border-radius: inherit;
  inset: 0;
  position: absolute;
  z-index: 0;
}

.timeline-card__surface {
  display: grid;
  gap: 10px;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.timeline-card__surface .media-thumb-trigger {
  pointer-events: auto;
}

.timeline-card__surface .public-resource-audio {
  pointer-events: auto;
}

.timeline-card__copy-wrapper {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.fumi-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.fumi-card-copy--collapsed {
  max-height: 9rem;
  overflow: hidden;
  position: relative;
}

.fumi-card-copy--collapsed::after {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    color-mix(in srgb, var(--paper-fade) 14%, transparent) 42%,
    var(--paper-fade) 100%
  );
  bottom: 0;
  content: "";
  height: 4.5rem;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.timeline-card__more {
  color: var(--accent-hover);
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
  padding-top: 6px;
  text-align: left;
}

.card-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  gap: 8px;
}

.card-body {
  color: var(--ink-secondary);
  font-size: 1rem;
  line-height: 1.85;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.fumi-card-resources {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.public-resource-file {
  align-self: start;
  background: color-mix(in srgb, var(--paper) 92%, var(--line) 8%);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-secondary);
  display: block;
  font-size: 0.82rem;
  grid-column: 1 / -1;
  max-width: 100%;
  overflow: hidden;
  padding: 8px 14px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-resource-file:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fumi-card-resources .media-thumb-trigger {
  align-self: start;
  min-width: 0;
  width: 100%;
}

/* 3 images: left large (cover) + right stacked pair */
.fumi-card-resources:has(.media-thumb-trigger:nth-child(3):last-child) {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.fumi-card-resources:has(.media-thumb-trigger:nth-child(3):last-child) .media-thumb-trigger {
  height: 100%;
}

.fumi-card-resources:has(.media-thumb-trigger:nth-child(3):last-child) .media-thumb-trigger:nth-child(1) {
  grid-row: 1 / 3;
}

.fumi-card-resources:has(.media-thumb-trigger:nth-child(3):last-child) .fumi-card-resource-img {
  aspect-ratio: auto;
  height: 100%;
}

.public-resource-audio {
  align-self: start;
  aspect-ratio: 1 / 1;
  background: color-mix(in srgb, var(--paper) 92%, var(--line) 8%);
  border: 1px solid var(--line);
  border-radius: 16px;
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
}

.fumi-card-resource-img {
  aspect-ratio: 1 / 1;
  background: color-mix(in srgb, var(--paper) 92%, var(--line) 8%);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: block;
  max-height: none;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
}

.public-md {
  color: var(--ink-secondary);
  font-size: 1rem;
  line-height: 1.85;
}

.public-md p {
  margin: 0 0 1.15em;
}

.public-md h1,
.public-md h2,
.public-md h3,
.public-md h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
}

.public-md h2 {
  font-size: 1.35rem;
  margin: 1.1em 0 0.4em;
}

.public-md h3 {
  font-size: 1.15rem;
  margin: 1em 0 0.35em;
}

.public-md h4 {
  margin: 0.9em 0 0.45em;
}

.public-md h1:first-child,
.public-md h2:first-child,
.public-md h3:first-child {
  margin-top: 0;
}

.public-md pre {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.88em;
  overflow: auto;
  padding: 12px;
}

.public-md code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.public-md pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.public-md a {
  color: var(--accent-hover);
  text-decoration: underline;
}

.public-md ul,
.public-md ol {
  margin: 0 0 0.75em;
  padding-left: 1.35em;
}

.public-md blockquote {
  background: var(--surface-soft);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  margin: 0.75em 0;
  padding: 14px 18px;
}

.md-twitter-embed-host {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.md-twitter-embed-host > blockquote.twitter-tweet {
  border-left: 0;
  color: inherit;
  margin: 0;
  padding-left: 0;
}

.md-twitter-embed-host iframe {
  max-width: 100% !important;
}

.md-youtube-embed {
  display: block;
  max-width: 100%;
  min-width: 0;
}

.md-youtube-embed__frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
}

.md-youtube-embed iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.md-twitter-card-copy {
  overflow: visible;
}

.md-youtube-card-copy {
  overflow: visible;
}

.md-rich-embed-card-copy {
  overflow: visible;
}

.public-article {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.public-article h1 {
  color: var(--ink);
  font-size: 1.36rem;
  line-height: 1.42;
  margin: 0;
}

.public-article__body {
  margin: 0;
}

.detail-assets {
  display: grid;
  gap: 14px;
}

.detail-assets h2 {
  color: var(--ink);
  font-size: 1rem;
  margin: 0;
}

.detail-assets__media-grid,
.detail-assets__image-grid,
.detail-assets__video-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-assets__media-grid--two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-assets__tile {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: block;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.detail-assets__tile--video::after {
  align-items: center;
  backdrop-filter: blur(10px);
  background: rgba(28, 25, 23, 0.48);
  border-radius: 999px;
  bottom: 12px;
  color: #fff;
  content: "Play";
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  position: absolute;
  right: 12px;
  text-transform: uppercase;
  z-index: 2;
}

.detail-assets__media {
  display: block;
  height: 100%;
  inset: 0;
  object-fit: cover;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.detail-assets__image,
.detail-assets__video {
  border: none;
  border-radius: 0;
  max-width: none;
}

.detail-assets__file-list {
  margin: 0;
  padding-left: 20px;
}

.detail-assets__audio-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.detail-assets__audio {
  border-radius: 16px;
  max-width: 100%;
  width: 100%;
}

.calendar-overlay {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 30;
}

.calendar-overlay[hidden] {
  display: none;
}

.calendar-overlay__backdrop {
  background: rgba(0, 0, 0, 0.25);
  border: 0;
  cursor: default;
  inset: 0;
  position: absolute;
}

.calendar-overlay__dialog {
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: min(80vh, 680px);
  max-width: min(720px, calc(100vw - 32px));
  overflow: auto;
  padding: 20px;
  position: relative;
  width: 100%;
}

.calendar-overlay__header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-overlay__year-nav {
  align-items: center;
  display: flex;
  gap: 8px;
}

.calendar-overlay__year-nav h3 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  min-width: 60px;
  text-align: center;
}

.calendar-overlay__header-actions {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.year-calendar-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.year-calendar-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: left;
  transition: border-color 0.15s ease;
}

.year-calendar-card:hover {
  border-color: var(--accent);
}

.year-calendar-card__label {
  color: var(--ink-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.year-calendar-card__weekdays,
.year-calendar-card__grid {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.year-calendar-card__weekdays span {
  color: var(--muted);
  font-size: 0.55rem;
  text-align: center;
}

.year-calendar-card__day {
  align-items: center;
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  color: var(--muted);
  display: flex;
  font-size: 0.6rem;
  justify-content: center;
}

.year-calendar-card__day[data-level="1"] {
  background: var(--heatmap-1);
}

.year-calendar-card__day[data-level="2"] {
  background: var(--heatmap-2);
}

.year-calendar-card__day[data-level="3"] {
  background: var(--heatmap-3);
  color: #fff;
}

.year-calendar-card__day[data-level="4"] {
  background: var(--heatmap-4);
  color: #fff;
}

.year-calendar-card__day.is-active {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.public-fab {
  bottom: 20px;
  display: grid;
  gap: 10px;
  justify-items: center;
  left: 50%;
  pointer-events: auto;
  position: fixed;
  transform: translateX(-50%);
  /* Above masthead/calendar overlays; below .media-viewer when lightbox is open */
  z-index: 100;
}

.public-fab__popover {
  background: var(--menu-popover-bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--menu-shadow);
  padding: 10px;
  width: min(190px, calc(100vw - 24px));
}

.public-fab__popover[hidden] {
  display: none;
}

.public-fab__menu {
  display: grid;
  gap: 6px;
}

.public-fab__item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 0 12px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.public-fab__item:hover {
  background: var(--accent-soft);
  border-color: rgba(129, 140, 248, 0.22);
  color: var(--ink);
}

.public-fab__item--static {
  cursor: default;
}

.public-fab__item--static:hover {
  background: transparent;
  border-color: transparent;
  transform: none;
}

.public-fab__avatar {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  width: 32px;
}

.public-fab__avatar-img {
  display: block;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
}

.public-fab__avatar-fallback {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.public-fab__avatar-fallback[hidden] {
  display: none;
}

.public-fab__item-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.public-fab__item-title {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.public-fab__item-icon {
  align-items: center;
  color: var(--ink-secondary);
  display: inline-flex;
  justify-content: center;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.public-fab__item-icon .icon-svg {
  height: 17px;
  width: 17px;
}

.public-fab__item-icon--chevron {
  transition: transform 0.15s ease;
}

.public-fab__item--profile[aria-expanded="true"] .public-fab__item-icon--chevron {
  transform: rotate(180deg);
}

.public-fab__bio {
  border-top: 1px solid var(--line);
  color: var(--ink-secondary);
  margin-top: 2px;
  padding: 12px 12px 10px;
}

.public-fab__bio[hidden] {
  display: none;
}

.public-fab__bio p {
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.public-fab__bio .public-fab__item {
  border-top: 1px solid var(--line);
  margin: 10px -12px 0;
  padding-left: 12px;
  padding-right: 12px;
}

.public-fab__trigger {
  align-items: center;
  background: var(--menu-trigger-bg);
  border: 1px solid var(--menu-trigger-border);
  border-radius: 50%;
  box-shadow: var(--menu-shadow);
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  height: 56px;
  justify-content: center;
  padding: 0;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  width: 56px;
}

.public-fab__trigger:hover {
  background: var(--bg);
  transform: scale(1.05);
}

.public-fab__trigger-icon {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.public-fab__trigger-icon .icon-svg {
  height: 32px;
  width: 32px;
}

.media-viewer {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 110;
}

.media-viewer[hidden] {
  display: none;
  pointer-events: none;
}

.media-viewer__backdrop {
  background: rgba(0, 0, 0, 0.85);
  border: 0;
  cursor: default;
  inset: 0;
  position: absolute;
}

button.media-viewer__backdrop:hover,
button.media-viewer__backdrop:focus,
button.media-viewer__backdrop:focus-visible,
[data-theme="dark"] button.media-viewer__backdrop:hover,
[data-theme="dark"] button.media-viewer__backdrop:focus,
[data-theme="dark"] button.media-viewer__backdrop:focus-visible {
  background: rgba(0, 0, 0, 0.85);
  border-color: transparent;
}

.media-viewer__inner {
  align-items: center;
  display: flex;
  justify-content: center;
  max-height: 100vh;
  max-width: 100vw;
  padding: 48px 16px 16px;
  position: relative;
  width: 100%;
}

.media-viewer__close,
.media-viewer__nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: absolute;
  top: 12px;
  width: 36px;
}

.media-viewer__close {
  right: 16px;
}

.media-viewer__nav--prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.media-viewer__nav--next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.media-viewer__close:hover,
.media-viewer__nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.media-viewer__content img,
.media-viewer__content video {
  border-radius: 20px;
  display: block;
  max-height: calc(100vh - 80px);
  max-width: min(100%, 1200px);
  object-fit: contain;
}

.media-viewer__index {
  bottom: 16px;
  color: #fff;
  left: 50%;
  margin: 0;
  position: absolute;
  transform: translateX(-50%);
}

.media-thumb-trigger {
  background: transparent;
  border: 0;
  cursor: zoom-in;
  display: block;
  min-height: 0;
  padding: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.media-thumb-trigger:hover {
  background: transparent;
  border-color: transparent;
}

@media (max-width: 900px) {
  .public-shell {
    padding: 12px 36px 120px;
  }

  .public-top-scrim {
    height: 84px;
  }

  .public-fab {
    bottom: 18px;
  }
}

@media (max-width: 700px) {
  .public-masthead__top,
  .public-topbar {
    grid-template-columns: 1fr;
  }

  .public-masthead__top::after {
    display: none;
  }

  .sc-compact-dock-wrap {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .public-shell {
    padding: 12px 12px 120px;
  }

  .year-calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .public-shell {
    padding: 16px 12px 116px;
  }

  .public-top-scrim {
    height: 76px;
  }

  /* Mobile bar: first row flex (brand + dock); filters row below — all inside sticky masthead */
  .public-masthead {
    gap: 6px;
    padding: 6px 0;
    top: 0;
  }

  .public-masthead__top {
    display: flex;
    gap: 8px;
    min-height: 0;
  }

  .public-masthead__brand {
    flex-shrink: 0;
  }

  .public-masthead .sc-compact-dock-wrap {
    flex: 1;
    min-width: 0;
  }

  .sc-compact-dock {
    max-width: 100%;
  }

  /* Search collapse: show icon button, hide full form */
  #compact-search-open {
    display: flex;
  }

  .sc-compact-dock:not(.is-search-open) #compact-search-form {
    display: none;
  }

  /* When search is open: show form with close button, hide icon and other controls */
  .sc-compact-dock.is-search-open #compact-search-open,
  .sc-compact-dock.is-search-open .sc-compact-dock__divider,
  .sc-compact-dock.is-search-open .sc-compact-dock__popover-anchor {
    display: none;
  }

  #compact-search-close {
    display: flex;
  }

  .sc-compact-dock .sc-compact-popover--tags.search-settings-menu__popover {
    left: auto;
    right: 0;
    transform: none;
    width: min(260px, calc(100vw - 24px));
  }

  .public-article {
    padding: 20px;
  }

  .public-fab__popover {
    width: min(190px, calc(100vw - 16px));
  }

  .public-fab__trigger {
    height: 54px;
    width: 54px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   quiet paper (public) — warm paper + green, 780px column, serif body,
   day-grouped rows separated by hairlines.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f2ee;
  --paper: #fffdfa;
  --paper-strong: #fffdfa;
  --paper-hover: #fffdfa;
  --paper-fade: #f4f2ee;
  --popover-bg: #fffdfa;
  --line: rgba(27, 25, 23, 0.09);
  --line-strong: rgba(27, 25, 23, 0.14);
  --ink: #1b1917;
  --ink-secondary: #55504a;
  --muted: #98918a;
  --accent: #3f6f5b;
  --accent-hover: #35604f;
  --accent-soft: rgba(63, 111, 91, 0.07);
  --surface-soft: rgba(27, 25, 23, 0.04);
  --surface-soft-strong: rgba(27, 25, 23, 0.08);
  --menu-trigger-bg: #fffdfa;
  --menu-trigger-border: rgba(27, 25, 23, 0.09);
  --menu-popover-bg: #fffdfa;
  --shadow: 0 10px 30px rgba(27, 25, 23, 0.06), 0 1px 3px rgba(27, 25, 23, 0.05);
  --shadow-lg: 0 18px 44px rgba(27, 25, 23, 0.14);
  --menu-shadow: 0 22px 48px rgba(27, 25, 23, 0.18);
  --serif: "Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK JP", monospace;
  --qp-col: 780px;
  --qp-pad: 28px;
  --qp-gutter: 46px;
  --qp-gap: 14px;
  --qp-head: 60px;
}

[data-theme="dark"] {
  --bg: #151310;
  --paper: #221e19;
  --paper-strong: #221e19;
  --paper-hover: #221e19;
  --paper-fade: #151310;
  --popover-bg: #221e19;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f3efe9;
  --ink-secondary: #c6bfb4;
  --muted: #8f887e;
  --accent: #8fc4a8;
  --accent-hover: #a5d3bb;
  --accent-soft: rgba(143, 196, 168, 0.1);
  --surface-soft: rgba(255, 255, 255, 0.05);
  --surface-soft-strong: rgba(255, 255, 255, 0.09);
  --menu-trigger-bg: #221e19;
  --menu-trigger-border: rgba(255, 255, 255, 0.1);
  --menu-popover-bg: #221e19;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.42);
  --menu-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

body {
  background: var(--bg);
}

.public-top-scrim {
  display: none;
}

.public-shell {
  gap: 0;
  max-width: var(--qp-col);
  padding: 0 var(--qp-pad) 140px;
}

.public-shell > * {
  max-width: 100%;
  width: 100%;
}

/* ── header ─────────────────────────────────────────────────────────── */

.public-masthead {
  background: var(--bg);
  gap: 0;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}

.public-masthead__top {
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: var(--qp-head);
}

.public-masthead__top::after {
  display: none;
}

.public-masthead__brand {
  align-items: center;
  display: flex;
}

.public-masthead .public-brand,
.public-topbar .public-brand {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sc-compact-dock-wrap {
  grid-column: 2;
}

.sc-compact-dock {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  gap: 2px;
  max-width: none;
  min-height: 0;
  padding: 0;
}

.sc-compact-dock__main {
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
}

.sc-compact-dock__divider {
  align-self: center;
  background: var(--line);
  height: 14px;
  margin: 0 6px;
  opacity: 0.65;
  width: 1px;
}

.sc-compact-dock__input {
  font-size: 0.9rem;
}

.sc-compact-dock__search,
.sc-compact-dock__icon-button,
.icon-button {
  border-radius: 8px;
  min-height: 32px;
  min-width: 32px;
  padding: 0 6px;
}

.sc-compact-dock__icon-button,
.icon-button {
  color: var(--ink-secondary);
}

.sc-compact-dock__icon-button .icon-svg--small,
.icon-button .icon-svg--small {
  height: 18px;
  width: 18px;
}

/* intro (replaces the duplicated brand under the header) */

.qp-intro {
  display: grid;
  gap: 10px;
  padding: 34px 0 0;
}

.qp-intro__meta:empty {
  display: none;
}

.qp-intro__bio:empty {
  display: none;
}

.qp-intro__bio {
  color: var(--ink-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
  margin: 0;
  white-space: pre-line;
}

.qp-intro__meta {
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 0.64rem;
  gap: 16px;
  letter-spacing: 0.06em;
  margin: 0;
}

.public-active-filters {
  background: var(--bg);
  margin-top: 18px;
  min-height: 0;
  position: sticky;
  top: var(--qp-head);
  z-index: 20;
}

/* Popovers anchored to the right-hand dock icons must grow leftwards */
.sc-compact-dock .sc-compact-popover--tags,
.sc-compact-dock .sc-compact-popover--calendar {
  left: auto;
  right: 0;
  transform: none;
}

/* ── day group ──────────────────────────────────────────────────────── */

.qp-day {
  margin-top: 40px;
}

.qp-day__head {
  align-items: center;
  background: var(--bg);
  display: flex;
  gap: 10px;
  padding: 8px 0 10px;
  position: sticky;
  top: calc(var(--qp-head) + var(--qp-filter-h, 0px));
  z-index: 12;
}

.qp-day__date {
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.qp-day__wd {
  color: var(--ink-secondary);
  font-size: 0.74rem;
  white-space: nowrap;
}

.qp-day__year {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.qp-day__rule {
  background: var(--line);
  flex: 1 1 auto;
  height: 1px;
}

.qp-day__count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
}

/* ── timeline rows ──────────────────────────────────────────────────── */

.timeline-list {
  gap: 0;
}

.public-panel--timeline {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.timeline-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  gap: 0;
  padding: 16px 0 18px 0;
  padding-left: calc(var(--qp-gutter) + var(--qp-gap));
  position: relative;
}

.qp-day .timeline-card:last-child {
  border-bottom: 0;
  padding-bottom: 8px;
}

.timeline-card:hover {
  background: transparent;
  border-color: var(--line);
  transform: none;
}

.timeline-card__surface {
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.timeline-card .card-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  left: calc(-1 * (var(--qp-gutter) + var(--qp-gap)));
  position: absolute;
  top: 20px;
  width: var(--qp-gutter);
}

.public-article .card-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.card-body {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  line-height: 1.95;
  margin: 0;
}

.timeline-card__copy-wrapper {
  gap: 2px;
}

.fumi-card-copy--collapsed {
  max-height: calc(4 * 1.95em);
}

.fumi-card-copy--collapsed::after {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, var(--bg) 100%);
}

.timeline-card__more {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  padding-top: 4px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  position: relative;
  z-index: 2;
}

.tag-pill {
  background: transparent;
  border-radius: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0;
}

.tag-pill--button:hover,
.tag-pill--link:hover {
  background: transparent;
  color: var(--accent);
}

.fumi-card-resources {
  gap: 8px;
  margin-top: 12px;
}

.fumi-card-resources img,
.fumi-card-resources .media-thumb-trigger img {
  aspect-ratio: 16 / 10;
  border-radius: 3px;
  object-fit: cover;
  width: 100%;
}

/* ── detail page ────────────────────────────────────────────────────── */

.public-topbar {
  align-items: center;
  display: flex;
  min-height: var(--qp-head);
}

.public-main--detail {
  padding-top: 34px;
}

.public-panel.public-article {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 calc(var(--qp-gutter) + var(--qp-gap));
}


.public-article__body,
.public-md {
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  line-height: 1.95;
  margin-top: 0;
}

.public-md h1,
.public-md h2,
.public-md h3,
.public-md h4 {
  font-family: var(--serif);
}

.public-md code,
.public-md pre code {
  font-family: var(--mono);
}

/* ── mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  :root {
    --qp-pad: 18px;
    --qp-head: 52px;
    --qp-gutter: 40px;
    --qp-gap: 10px;
  }

  .public-shell {
    padding: 0 var(--qp-pad) 120px;
  }

  .public-brand {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .sc-compact-dock__main {
    height: 34px;
    padding: 0 10px;
  }

  .sc-compact-dock__input {
    font-size: 0.84rem;
  }

  .sc-compact-dock__icon-button,
  .icon-button {
    min-height: 28px;
    min-width: 28px;
  }

  /* keep the search field visible on mobile (no collapsed state) */
  #compact-search-open,
  #compact-search-close {
    display: none;
  }

  .sc-compact-dock:not(.is-search-open) #compact-search-form {
    display: inline-flex;
  }

  .sc-compact-dock {
    max-width: none;
  }

  .sc-compact-dock__main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .qp-intro {
    padding-top: 26px;
  }

  .qp-day {
    margin-top: 32px;
  }

  .card-body {
    font-size: 1rem;
    line-height: 1.9;
  }

  .fumi-card-copy--collapsed {
    max-height: calc(6 * 1.9em);
  }

  .timeline-card .card-meta {
    top: 18px;
  }

  .public-article__body,
  .public-md {
    font-size: 1rem;
    line-height: 1.9;
  }

  .public-fab {
    bottom: 20px;
    gap: 10px;
  }

  .public-fab__trigger {
    height: 66px;
    width: 66px;
  }

  .public-xishi {
    width: 44px;
  }
}


/* ── FAB: 西施壺 ─────────────────────────────── */
.public-fab {
  bottom: 24px;
  gap: 12px;
}

.public-fab__trigger {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 72px;
  position: relative;
  transition: transform 0.15s ease;
  width: 72px;
}

.public-fab__trigger:hover,
.public-fab__trigger:focus {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: translateY(-1px);
}

.public-fab__trigger::before {
  display: none;
}

.public-xishi {
  color: var(--ink-secondary);
  filter:
    drop-shadow(0 0 4px var(--paper))
    drop-shadow(0 0 9px var(--paper));
  height: auto;
  transition: color 0.2s ease;
  width: 56px;
}

.public-fab__trigger[aria-expanded="true"] .public-xishi {
  color: var(--ink);
}

.public-xishi__lid {
  transform-box: view-box;
  transform-origin: 60px 34px;
  transition: transform 0.38s cubic-bezier(0.3, 0.9, 0.2, 1);
}

.public-fab__trigger[aria-expanded="true"] .public-xishi__lid {
  transform: translate(-5px, -14px) rotate(-14deg);
}

.public-xishi__steam path {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.3s ease;
}

.public-fab__trigger[aria-expanded="true"] .public-xishi__steam path {
  opacity: 0.55;
  transform: translateY(0);
  transition-delay: 0.12s;
}

@media (prefers-reduced-motion: reduce) {
  .public-xishi,
  .public-xishi__lid,
  .public-xishi__steam path {
    transition: none;
  }
}

/* no separator before the first tool icon */
#compact-search-form + .sc-compact-dock__divider {
  display: none;
}

/* ── intro: avatar + bio ─────────────────────── */
.qp-intro {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  padding: 30px 0 0;
}

.qp-intro__avatar {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  flex: none;
  height: 34px;
  overflow: hidden;
  position: relative;
  width: 34px;
}

.qp-intro__avatar-img {
  display: block;
  height: 100%;
  object-fit: cover;
  position: relative;
  width: 100%;
  z-index: 1;
}

.qp-intro__avatar-fallback {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 0.7rem;
  height: 100%;
  justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.qp-intro__bio {
  padding-top: 1px;
}

@media (max-width: 640px) {
  .qp-intro {
    gap: 10px;
    padding: 24px 0 0;
  }

  .qp-intro__avatar {
    height: 30px;
    width: 30px;
  }
}

.qp-intro__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.qp-intro__name {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  margin: 0;
}

/* ── mobile: wider reading column on the detail page ────────────────── */

@media (max-width: 640px) {
  .public-panel.public-article {
    padding: 0 40px;
  }
}
