:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --paper: #fffdf8;
  --paper-soft: #fbf7ef;
  --ink: #2b2924;
  --muted: #756f66;
  --line: rgba(118, 102, 82, 0.22);
  --accent: #2a7563;
  --accent-strong: #155446;
  --rust: #ad5f3b;
  --glass: rgba(255, 253, 248, 0.66);
  --glass-strong: rgba(255, 253, 248, 0.82);
  --glass-border: rgba(72, 58, 42, 0.13);
  --shadow: 0 24px 70px rgba(66, 50, 31, 0.13);
  --soft-shadow: 0 16px 45px rgba(66, 50, 31, 0.09);
  --radius: 8px;
  --page-progress: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.58), transparent 28%, rgba(42, 117, 99, 0.06) 62%, transparent 100%),
    linear-gradient(90deg, rgba(44, 41, 36, 0.04) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, #faf5ec 0%, var(--bg) 52%, #eee5d8 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.55) 0 12%, transparent 34%),
    linear-gradient(20deg, transparent 0 46%, rgba(173, 95, 59, 0.055) 64%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(43, 41, 36, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 41, 36, 0.03) 1px, transparent 1px);
  background-size: 1px 4px, 4px 1px;
  mix-blend-mode: multiply;
}

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

button,
input {
  font: inherit;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  transform: scaleX(var(--page-progress));
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(42, 117, 99, 0.15), var(--accent), #d79b5a);
  box-shadow: 0 0 18px rgba(42, 117, 99, 0.22);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(44, 41, 36, 0.07);
  background: rgba(247, 241, 232, 0.58);
  backdrop-filter: blur(22px) saturate(1.18);
  transition: background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.site-header.is-scrolled {
  border-color: rgba(44, 41, 36, 0.11);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 10px 36px rgba(58, 46, 34, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1060px, calc(100% - 36px));
  height: 70px;
  margin: 0 auto;
  transition: height 180ms ease;
}

.site-header.is-scrolled .header-inner {
  height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 780;
  letter-spacing: 0;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(43, 41, 36, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 62% 32%, #f4c66b 0 22%, transparent 23%), var(--accent);
  box-shadow: 4px 4px 0 rgba(44, 41, 36, 0.14), inset 0 1px 5px rgba(255, 255, 255, 0.34);
}

.brand-mark.has-image {
  border-color: rgba(43, 41, 36, 0.18);
  background: var(--brand-logo-url) center / cover no-repeat, var(--paper);
  box-shadow: 0 10px 24px rgba(43, 41, 36, 0.14);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 4px 7px auto 7px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.brand-mark.has-image::after {
  display: none;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
}

.top-nav a {
  position: relative;
}

.top-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--accent);
  transition: transform 160ms ease;
}

.top-nav a:hover {
  color: var(--ink);
}

.top-nav a:hover::after {
  transform: scaleX(1);
}

main {
  width: min(980px, calc(100% - 34px));
  margin: 0 auto;
  padding: 58px 0 88px;
}

.site-footer {
  width: min(980px, calc(100% - 34px));
  margin: 0 auto;
  padding: 10px 0 48px;
  color: rgba(117, 111, 102, 0.78);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 16px 18px;
  border-top: 1px solid rgba(72, 58, 42, 0.08);
  font-size: 13px;
  line-height: 1.6;
}

.record-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  transition: color 160ms ease;
}

.record-link:hover {
  color: var(--accent-strong);
}

.footer-divider {
  width: 1px;
  height: 14px;
  background: rgba(117, 111, 102, 0.24);
}

.police-record img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 36px;
  align-items: end;
  padding: 38px 0 48px;
}

.intro-copy {
  position: relative;
}

.intro-copy::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 0;
  width: min(220px, 42vw);
  height: 1px;
  background: linear-gradient(90deg, rgba(173, 95, 59, 0.75), transparent);
}

.intro-date {
  margin: 0 0 16px;
  color: var(--rust);
  font-size: 14px;
  font-weight: 780;
}

h1 {
  max-width: 710px;
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.intro-text {
  max-width: 590px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.82;
}

.intro-panel {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 154px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 248, 0.56));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.12);
}

.intro-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 42%);
}

.panel-kicker,
.intro-panel strong,
.intro-panel span:last-child {
  position: relative;
}

.panel-kicker {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.intro-panel strong {
  font-size: 56px;
  line-height: 1;
}

.intro-panel span:last-child {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 38px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.58);
  box-shadow: 0 12px 30px rgba(66, 50, 31, 0.055);
  backdrop-filter: blur(16px);
}

.search-wrap:focus-within {
  border-color: rgba(42, 117, 99, 0.38);
  box-shadow: 0 14px 34px rgba(42, 117, 99, 0.12);
}

.search-wrap svg,
.to-top svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.tag-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 3px 0 7px;
  scrollbar-width: thin;
}

.tag-button {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.58);
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  box-shadow: 0 8px 20px rgba(66, 50, 31, 0.045);
  backdrop-filter: blur(12px);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tag-button:hover {
  transform: translateY(-1px);
}

.tag-button:hover,
.tag-button.active {
  border-color: rgba(42, 117, 99, 0.52);
  background: rgba(42, 117, 99, 0.92);
  color: #fffdf8;
}

.timeline-shell {
  position: relative;
}

.timeline {
  display: grid;
  gap: 34px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.timeline.is-refreshing {
  opacity: 0.52;
  transform: translateY(6px);
}

.day-group {
  --day-fill: 0;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 28px;
}

.day-stamp {
  position: sticky;
  top: 96px;
  align-self: start;
  overflow: hidden;
  width: fit-content;
  min-width: 132px;
  padding: 12px 12px 13px;
  border: 1px solid rgba(72, 58, 42, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.24);
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
  transition: color 220ms ease, transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.day-stamp::before,
.day-stamp::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-stamp::before {
  z-index: 0;
  transform: scaleY(var(--day-fill));
  transform-origin: bottom center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(42, 117, 99, 0.08), rgba(42, 117, 99, 0.17));
  transition: transform 120ms linear;
}

.day-stamp::after {
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 46%);
}

.day-stamp strong {
  position: relative;
  z-index: 2;
  display: block;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.05;
  transition: color 220ms ease;
}

.day-stamp span {
  position: relative;
  z-index: 2;
  display: block;
  margin-top: 7px;
  font-size: 13px;
}

.day-group.is-active .day-stamp {
  border-color: rgba(42, 117, 99, 0.2);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), 0 14px 30px rgba(42, 117, 99, 0.08);
  transform: translateX(2px);
}

.day-group.is-active .day-stamp strong {
  color: var(--accent-strong);
}

.memo-list {
  --line-progress: 0;
  position: relative;
  display: grid;
  gap: 22px;
  padding-left: 24px;
}

.memo-list::before,
.memo-list::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 3px;
  width: 1px;
  transform-origin: top center;
}

.memo-list::before {
  background: var(--line);
}

.memo-list::after {
  transform: scaleY(var(--line-progress));
  background: linear-gradient(180deg, rgba(42, 117, 99, 0.18), var(--accent), rgba(215, 155, 90, 0.62));
  box-shadow: 0 0 16px rgba(42, 117, 99, 0.2);
}

.memo-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 253, 248, 0.62));
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px) saturate(1.08);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms ease, transform 520ms ease, box-shadow 220ms ease, border-color 220ms ease;
  transition-delay: calc(var(--card-index, 0) * 38ms);
}

.memo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), transparent 36%);
}

.memo-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.memo-card.is-current {
  border-color: rgba(42, 117, 99, 0.18);
  box-shadow: 0 18px 48px rgba(66, 50, 31, 0.115);
}

.memo-card::before {
  content: "";
  position: absolute;
  top: 30px;
  left: -27px;
  z-index: 2;
  width: 10px;
  height: 10px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(42, 117, 99, 0.65), 0 0 18px rgba(42, 117, 99, 0.22);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.memo-card.is-current::before {
  transform: scale(1.08);
  box-shadow: 0 0 0 1px rgba(42, 117, 99, 0.72), 0 0 18px rgba(42, 117, 99, 0.24);
}

.memo-meta,
.memo-content,
.media-grid,
.memo-footer {
  position: relative;
  z-index: 1;
}

.memo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.memo-meta span:last-child {
  letter-spacing: 0.04em;
}

.memo-content {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.86;
  overflow-wrap: anywhere;
}

.memo-content p {
  margin: 0 0 13px;
}

.memo-content p:last-child {
  margin-bottom: 0;
}

.memo-content a {
  color: var(--accent-strong);
  border-bottom: 1px solid rgba(40, 107, 91, 0.25);
}

.memo-content code {
  padding: 0.14em 0.35em;
  border-radius: 5px;
  background: #efe5d7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.media-grid {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.media-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

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

.media-grid.many {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.media-link {
  display: block;
  overflow: hidden;
  border-radius: 7px;
  background: var(--paper-soft);
  aspect-ratio: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.media-grid.one .media-link {
  aspect-ratio: 4 / 3;
}

.media-link img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 220ms ease;
}

.media-link:hover img {
  transform: scale(1.035);
}

.memo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 19px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 780;
}

.state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 1px dashed rgba(44, 41, 36, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.58);
  text-align: center;
  backdrop-filter: blur(14px);
}

.state strong {
  font-size: 18px;
}

.state span {
  color: var(--muted);
  font-size: 14px;
}

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: rgba(43, 41, 36, 0.68);
  color: #fffdf8;
  box-shadow: 0 18px 42px rgba(43, 41, 36, 0.22);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  backdrop-filter: blur(18px) saturate(1.15);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.to-top:hover {
  background: rgba(42, 117, 99, 0.78);
}

.to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .header-inner {
    width: min(100% - 28px, 1060px);
    height: 64px;
  }

  .site-header.is-scrolled .header-inner {
    height: 58px;
  }

  .top-nav {
    gap: 14px;
    font-size: 13px;
  }

  main {
    width: min(100% - 26px, 980px);
    padding-top: 34px;
  }

  .site-footer {
    width: min(100% - 26px, 980px);
    padding-bottom: 40px;
  }

  .footer-inner {
    padding: 15px 8px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 22px;
  }

  .intro-panel {
    min-height: 122px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 30px;
  }

  .day-group {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .day-stamp {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    padding: 9px 10px 10px;
  }

  .day-stamp strong {
    font-size: 23px;
  }

  .day-stamp span {
    margin-top: 0;
  }

  .day-stamp::before {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 26%),
      linear-gradient(180deg, rgba(42, 117, 99, 0.055), rgba(42, 117, 99, 0.12));
  }

  .memo-list {
    padding-left: 18px;
  }

  .memo-card {
    padding: 19px;
  }

  .memo-card::before {
    left: -21px;
  }

  .memo-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 430px) {
  .brand span:last-child {
    max-width: 7em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-nav a:first-child {
    display: none;
  }

  h1 {
    font-size: 40px;
  }

  .memo-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .scroll-progress {
    display: none;
  }

  .timeline {
    opacity: 1;
    transform: none;
  }

  .day-stamp::before {
    display: none;
  }

  .memo-card {
    opacity: 1;
    transform: none;
  }
}
