:root {
  color-scheme: light;
  --bg: #fff6ee;
  --ink: #2c211c;
  --muted: #6a5c53;
  --faint: #8a7b72;
  --love: #e24b3c;
  --love-deep: #9f2d24;
  --love-hover: #cf3e30;
  --fluxer: #4641d9;
  --paper: #fffdfb;
  --card: #fffdfb;
  --line: rgba(44, 33, 28, 0.12);
  --shadow: 0 1px 2px rgba(44, 33, 28, 0.06);
  --on-love: #fff;
  --fill: #fff;
  --chip: rgba(255, 255, 255, 0.72);
  --ghost: rgba(255, 255, 255, 0.7);
  --hover: rgba(226, 75, 60, 0.1);
  --media: #fff;
  --stage: #fff1e6;
  --scroll: #e7b8a4;
  --empty: rgba(255, 255, 255, 0.55);
  --track: rgba(44, 33, 28, 0.08);
  --edge: rgba(226, 75, 60, 0.45);
  --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --header-h: 4.6rem;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1412;
  --ink: #f4ece6;
  --muted: #d2c0b6;
  --faint: #b3a099;
  --love: #e24b3c;
  --love-deep: #ffb4a8;
  --love-hover: #ff7d70;
  --fluxer: #a8a6ff;
  --paper: #2a211e;
  --card: #2a211e;
  --line: rgba(244, 236, 230, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  --on-love: #fff;
  --fill: #241c19;
  --chip: rgba(255, 255, 255, 0.05);
  --ghost: rgba(255, 255, 255, 0.04);
  --hover: rgba(226, 75, 60, 0.18);
  --media: #120e0c;
  --stage: #241c19;
  --scroll: #7a5348;
  --empty: rgba(255, 255, 255, 0.04);
  --track: rgba(244, 236, 230, 0.12);
  --edge: rgba(226, 75, 60, 0.55);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1412;
    --ink: #f4ece6;
    --muted: #d2c0b6;
    --faint: #b3a099;
    --love: #e24b3c;
    --love-deep: #ffb4a8;
    --love-hover: #ff7d70;
    --fluxer: #a8a6ff;
    --paper: #2a211e;
    --card: #2a211e;
    --line: rgba(244, 236, 230, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    --on-love: #fff;
    --fill: #241c19;
    --chip: rgba(255, 255, 255, 0.05);
    --ghost: rgba(255, 255, 255, 0.04);
    --hover: rgba(226, 75, 60, 0.18);
    --media: #120e0c;
    --stage: #241c19;
    --scroll: #7a5348;
    --empty: rgba(255, 255, 255, 0.04);
    --track: rgba(244, 236, 230, 0.12);
    --edge: rgba(226, 75, 60, 0.55);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--love-deep);
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

code,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.05em 0.4em;
  background: var(--fill);
}

:focus-visible {
  outline: 2px solid var(--fluxer);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 40;
  background: var(--love);
  color: var(--on-love);
  font-weight: 800;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
}

.skip-link:focus {
  top: 0.8rem;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.7rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-name {
  font-size: 1.08rem;
}

.modes {
  display: flex;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
}

.modes a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
}

.modes a[aria-selected="true"] {
  color: var(--on-love);
  background: var(--love);
}

.top-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.theme-switch {
  display: flex;
  flex: 0 0 auto;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
}

.theme-switch button {
  color: var(--muted);
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
}

.theme-switch [data-theme-choice="light"] {
  color: var(--on-love);
  background: var(--love);
}

html[data-theme="dark"] .theme-switch [data-theme-choice="light"] {
  color: var(--muted);
  background: transparent;
}

html[data-theme="dark"] .theme-switch [data-theme-choice="dark"] {
  color: var(--on-love);
  background: var(--love);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-switch [data-theme-choice="light"] {
    color: var(--muted);
    background: transparent;
  }

  html:not([data-theme="light"]) .theme-switch [data-theme-choice="dark"] {
    color: var(--on-love);
    background: var(--love);
  }
}

.player {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 28rem;
  padding: 0.28rem 0.5rem 0.28rem 0.28rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.player-meta {
  min-width: 0;
  flex: 1;
}

.player-title {
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--love-deep);
}

.seek,
.vol input,
.slide-speed input {
  width: 100%;
  accent-color: var(--love);
}

.vol {
  width: 4.2rem;
  display: none;
}

.icon-btn {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
}

.icon-btn:hover {
  background: var(--hover);
}

.icon-btn.play {
  background: var(--love);
  color: var(--on-love);
}

.player:not(.is-playing) .i-pause,
.player.is-playing .i-play,
.view-slideshow:not(.is-playing) .i-pause,
.view-slideshow.is-playing .i-play {
  display: none;
}

.hero {
  width: min(920px, calc(100% - 2.2rem));
  margin: 2.4rem auto 0.6rem;
  text-align: center;
}

.kicker {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0.45rem 0 0.7rem;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 6vw, 3.5rem);
  font-weight: 560;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 38rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid transparent;
}

.btn-love {
  background: var(--love);
  color: var(--on-love);
}

.btn-love:hover {
  background: var(--love-hover);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: var(--ghost);
}

.tally {
  margin-top: 1rem;
  color: var(--faint);
  font-size: 0.95rem;
  font-weight: 700;
}

.film-wrap,
.wall-wrap {
  position: relative;
  margin-top: 1.6rem;
}

.film-head {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 0 auto 0.4rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.film-head:has(.film-tools) {
  align-items: flex-start;
}

.film-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.film-head h2,
.story-card h2,
.help h2 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 560;
}

.film-head p {
  color: var(--faint);
  font-weight: 700;
}

.film-controls {
  display: flex;
  gap: 0.4rem;
}

.film-controls .icon-btn {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
}

.film-controls .icon-btn:hover {
  background: var(--hover);
}

.filmstrip {
  display: flex;
  justify-content: safe center;
  gap: 1.2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 1.3rem max(1.1rem, 6vw) 2.2rem;
  scrollbar-color: var(--scroll) transparent;
}

.polaroid {
  flex: 0 0 auto;
  width: min(78vw, 340px);
  scroll-snap-align: center;
  background: var(--paper);
  color: var(--ink);
  padding: 0.7rem 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: left;
}

.polaroid:hover,
.polaroid:focus-visible {
  border-color: var(--edge);
}

.polaroid img,
.polaroid video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--media);
  border-radius: 12px;
}

.polaroid-cap {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.95rem;
  font-weight: 800;
}

.story {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 0.4rem auto 1.5rem;
  display: grid;
  gap: 1rem;
}

.story-card,
.story-aside {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.35rem;
}

.story-card h2 {
  margin: 0 0 0.8rem;
}

.story-card p + p {
  margin-top: 0.85rem;
}

.story-card p,
.aside-note {
  color: var(--muted);
  font-size: 1.05rem;
}

blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 560;
  line-height: 1.3;
  color: var(--ink);
}

blockquote cite {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 700;
  color: var(--faint);
}

.aside-note {
  margin-top: 1.1rem;
}

.wall {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 0.6rem auto 2.4rem;
  columns: 280px 2;
  column-gap: 1rem;
}

.tile {
  break-inside: avoid;
  margin: 0 0 1rem;
  width: 100%;
  padding: 0.55rem 0.55rem 0.7rem;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: inherit;
  text-align: left;
}

.tile img,
.tile video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 12px;
  background: var(--media);
}

.tile-cap {
  display: block;
  margin-top: 0.55rem;
  font-weight: 800;
}

.empty {
  width: min(720px, calc(100% - 2.2rem));
  margin: 1rem auto 2rem;
  padding: 1.2rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  color: var(--muted);
  text-align: center;
  background: var(--empty);
}

.view-browse {
  width: min(1100px, calc(100% - 2.2rem));
  margin: 1.4rem auto 3rem;
}

.browse-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-weight: 800;
}

.crumbs a {
  color: var(--love-deep);
  text-decoration: none;
}

.browse-tools {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.browse-tools label {
  font-weight: 800;
  color: var(--muted);
}

.browse-tools select {
  margin-left: 0.35rem;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
}

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

.folder-card,
.file-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem;
  border-radius: 1.1rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  box-shadow: var(--shadow);
}

.folder-card {
  min-height: 8rem;
  justify-content: flex-end;
  background: var(--paper);
}

.folder-card strong,
.file-card strong {
  font-size: 1rem;
}

.folder-card span,
.file-card span {
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card img,
.file-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 10px;
  background: var(--media);
}

.view-slideshow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.slide-stage {
  position: relative;
  flex: 1;
  min-height: 46dvh;
  margin: 0.8rem 1rem 0;
  overflow: hidden;
  border-radius: 1.4rem;
  background: var(--stage);
  border: 1px solid var(--line);
}

.slide-frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 480ms ease;
}

.slide-frame.is-on {
  opacity: 1;
}

.slide-frame img,
.slide-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slide-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.slide-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem 0.4rem;
}

.slide-caption {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-weight: 800;
}

.slide-speed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 800;
}

.slide-speed input {
  width: 6rem;
}

.progress {
  height: 4px;
  margin: 0 1rem 0.8rem;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--love);
}

.foot {
  width: min(900px, calc(100% - 2.2rem));
  margin: 0 auto 2rem;
  padding: 1.2rem 0 1.4rem;
  color: var(--faint);
  font-size: 0.95rem;
  border-top: 1px solid var(--line);
}

.foot p + p {
  margin-top: 0.65rem;
}

.foot strong {
  color: var(--muted);
}

.lightbox[open] {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: rgba(42, 24, 20, 0.94);
  color: #fff8f3;
}

.lightbox::backdrop {
  background: rgba(42, 24, 20, 0.88);
}

.lightbox img,
.lightbox video {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.lightbox-cap {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.7rem 4.5rem 1.1rem;
  color: #f3d7cc;
  font-weight: 700;
}

.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(20, 14, 12, 0.9);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.lb-close svg,
.lb-prev svg,
.lb-next svg {
  width: 1.35rem;
  height: 1.35rem;
}

.lightbox .lb-close:hover,
.lightbox .lb-prev:hover,
.lightbox .lb-next:hover,
.lightbox .lb-close:focus-visible,
.lightbox .lb-prev:focus-visible,
.lightbox .lb-next:focus-visible {
  background: #1c1412;
  color: #fff;
}

.lb-close {
  top: 1rem;
  right: 1rem;
}

.lb-prev,
.lb-next {
  top: 50%;
  transform: translateY(-50%);
}

.lb-prev {
  left: 1rem;
}

.lb-next {
  right: 1rem;
}

.help {
  width: min(28rem, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: var(--paper);
  color: var(--ink);
  padding: 1.25rem 1.3rem;
}

.help h2 {
  margin-bottom: 0.6rem;
}

.help ul {
  padding-left: 1.1rem;
  color: var(--muted);
}

.help li + li {
  margin-top: 0.35rem;
}

.help form {
  margin-top: 1rem;
}

.noscript {
  width: min(40rem, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--paper);
}

.page-404 {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.2rem 3rem;
  text-align: center;
}

.page-404 h1 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.page-404 .lead {
  margin-top: 1rem;
}

@media (min-width: 820px) {
  .story {
    grid-template-columns: 1.35fr 0.85fr;
    align-items: stretch;
  }

  .vol {
    display: block;
  }

  .player {
    min-width: 0;
  }
}

body.is-404 {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.is-404 .page-404 {
  flex: 1;
  min-height: 0;
}

@media (max-width: 819px) {
  .top {
    flex-wrap: wrap;
    padding-bottom: 0.55rem;
  }

  .top-tools {
    display: contents;
  }

  .theme-switch {
    order: 2;
    margin-left: auto;
  }

  .player {
    order: 3;
    flex: 1 1 100%;
  }

  .modes {
    order: 4;
    width: 100%;
  }

  .modes a {
    flex: 1;
    text-align: center;
  }

  .player {
    max-width: none;
  }

  .film-controls,
  .slide-speed {
    display: none;
  }

  .film-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .film-tools {
    align-items: flex-start;
  }

  :root {
    --header-h: 7.4rem;
  }
}

body[data-mode="slideshow"] {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body[data-mode="slideshow"] #main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body[data-mode="slideshow"] .view-slideshow {
  flex: 1;
}

body[data-mode="slideshow"] .foot {
  margin-bottom: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide-frame { transition: none; }
}
