:root {
  color-scheme: dark;
  --ink: #0a0908;
  --surface: #11100e;
  --surface-2: #181612;
  --line: rgba(255, 250, 240, 0.14);
  --muted: #aaa399;
  --paper: #f6f0e6;
  --warm: #d9a16a;
  --warm-soft: #f0c99f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 75% -10%, rgba(217, 161, 106, 0.09), transparent 35rem),
    var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.viewer-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

a,
button,
input {
  font: inherit;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 8, 0.88);
  backdrop-filter: blur(20px);
}

.header-inner {
  display: flex;
  width: min(100% - 2rem, 1200px);
  min-height: 68px;
  margin: auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--warm);
  border-radius: 50%;
  color: var(--warm-soft);
  font-size: 1rem;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quiet-button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.quiet-button {
  padding: 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 650;
}

.quiet-button:hover,
.icon-button:hover {
  border-color: rgba(240, 201, 159, 0.55);
  background: rgba(240, 201, 159, 0.1);
}

.quiet-button:active,
.icon-button:active {
  transform: scale(0.96);
}

.album-shell {
  width: min(100% - 1rem, 1200px);
  margin: auto;
  padding: clamp(2.2rem, 6vw, 5rem) 0 5rem;
}

.album-heading {
  width: min(100%, 780px);
  margin: 0 auto clamp(2rem, 5vw, 4rem);
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--warm);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.album-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 8vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

.album-meta {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.zalo-notice {
  width: min(100% - 1rem, 700px);
  margin: -1.5rem auto 2rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(217, 161, 106, 0.28);
  border-radius: 14px;
  color: #d5cec4;
  background: rgba(217, 161, 106, 0.08);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.card {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 3px;
  color: var(--paper);
  background: var(--surface);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.media-card {
  aspect-ratio: 4 / 5;
}

.media-card img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface);
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
}

.media-card:hover img {
  transform: scale(1.025);
}

.media-card img.failed {
  opacity: 0;
}

.media-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(246, 240, 230, 0.26);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.7rem, 2vw, 1rem);
  letter-spacing: 0.14em;
}

.media-badge {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 3;
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: white;
  background: rgba(0, 0, 0, 0.68);
  font-size: 0.68rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.play-dot {
  color: var(--warm-soft);
  font-size: 0.58rem;
}

.card-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  overflow: hidden;
  padding: 2.5rem 0.7rem 0.65rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.68));
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 160ms ease;
}

.media-card:hover .card-name,
.media-card:focus-visible .card-name {
  opacity: 1;
}

.media-card:has(.media-badge) .card-name {
  padding-right: 5.4rem;
}

.folder-card {
  display: flex;
  min-height: 112px;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem;
  border-color: rgba(217, 161, 106, 0.18);
  background:
    linear-gradient(135deg, rgba(217, 161, 106, 0.08), transparent 60%),
    var(--surface-2);
}

.folder-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--warm-soft);
  background: rgba(217, 161, 106, 0.12);
}

.folder-icon svg {
  width: 23px;
  height: 23px;
}

.folder-label {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
}

.folder-label strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-label {
  color: var(--warm);
  font-size: 0.59rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.gallery.reader {
  width: min(100%, 860px);
  margin: auto;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}

.gallery.reader .media-card {
  aspect-ratio: auto;
  border: 0;
  background: transparent;
}

.gallery.reader .media-card img {
  position: relative;
  height: auto;
  max-height: 92vh;
  object-fit: contain;
}

.gallery.reader .media-fallback {
  min-height: 240px;
}

.gallery.reader .folder-card {
  min-height: 92px;
}

.empty-state {
  display: grid;
  min-height: 320px;
  place-content: center;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin: 0.7rem 0 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.empty-state p {
  margin: 0.6rem 1rem 0;
  font-size: 0.84rem;
}

.empty-icon {
  color: var(--warm);
  font-size: 2rem;
}

.site-footer {
  display: flex;
  width: min(100% - 2rem, 1200px);
  min-height: 100px;
  margin: auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
}

.site-footer span:first-child {
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: white;
  background: #050504;
}

.viewer-head,
.viewer-foot {
  z-index: 3;
  display: flex;
  align-items: center;
  border-color: var(--line);
  background: rgba(10, 9, 8, 0.94);
  backdrop-filter: blur(18px);
}

.viewer-head {
  min-height: 62px;
  padding: calc(0.55rem + env(safe-area-inset-top)) 0.7rem 0.55rem;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.viewer-foot {
  min-height: 62px;
  padding: 0.6rem 0.8rem calc(0.6rem + env(safe-area-inset-bottom));
  justify-content: center;
  gap: 0.6rem;
  border-top: 1px solid var(--line);
}

.viewer-foot a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.viewer-foot .download-link {
  border-color: var(--warm);
  color: #17100a;
  background: var(--warm-soft);
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 50%;
  font-size: 1.7rem;
  line-height: 1;
}

.viewer-title {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
  text-align: center;
}

.viewer-title > span {
  overflow: hidden;
  max-width: min(58vw, 600px);
  font-size: 0.76rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-title small {
  color: var(--muted);
  font-size: 0.65rem;
}

.viewer-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
}

.viewer-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.viewer-media img,
.viewer-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-media img {
  cursor: zoom-in;
  transform: scale(1);
  transition: transform 200ms ease;
}

.viewer-media img.zoomed {
  cursor: zoom-out;
  transform: scale(2);
}

.viewer-status {
  z-index: 2;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(10, 9, 8, 0.82);
  font-size: 0.75rem;
}

.viewer-arrow {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: grid;
  width: 46px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: white;
  background: rgba(10, 9, 8, 0.5);
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
  backdrop-filter: blur(12px);
}

.viewer-arrow:disabled {
  cursor: default;
  opacity: 0.18;
}

.viewer-prev {
  left: 0.8rem;
}

.viewer-next {
  right: 0.8rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 200;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1rem;
  border: 1px solid rgba(217, 161, 106, 0.35);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(24, 22, 18, 0.96);
  box-shadow: var(--shadow);
  font-size: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.error-page,
.home-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.error-card,
.home-card {
  width: min(100%, 680px);
  padding: clamp(1.5rem, 6vw, 4rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(217, 161, 106, 0.08), transparent 45%),
    var(--surface);
  box-shadow: var(--shadow);
}

.error-card h1,
.home-card h1 {
  margin: 1.2rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.error-card > p:not(.eyebrow),
.home-intro {
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.error-card .eyebrow,
.home-card .eyebrow {
  margin-top: 2.5rem;
}

.primary-link {
  display: inline-flex;
  min-height: 44px;
  margin-top: 1.5rem;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border-radius: 999px;
  color: #17100a;
  background: var(--warm-soft);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
}

.link-form {
  display: grid;
  margin-top: 2rem;
  gap: 0.7rem;
}

.link-form label {
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
}

.input-row {
  display: flex;
  gap: 0.55rem;
}

.input-row input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
}

.input-row input:focus {
  border-color: var(--warm);
  box-shadow: 0 0 0 3px rgba(217, 161, 106, 0.12);
}

.input-row button {
  min-height: 48px;
  padding: 0 1rem;
  border: 0;
  border-radius: 12px;
  color: #17100a;
  background: var(--warm-soft);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.link-result {
  display: grid;
  margin-top: 1rem;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid rgba(217, 161, 106, 0.25);
  border-radius: 14px;
  background: rgba(217, 161, 106, 0.07);
}

.link-result a {
  overflow-wrap: anywhere;
  color: var(--warm-soft);
  font-size: 0.82rem;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.result-actions button,
.result-actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: #f0a39b;
  font-size: 0.74rem;
}

.home-note {
  margin: 1.4rem 0 0;
  color: #817b73;
  font-size: 0.7rem;
  line-height: 1.5;
}

@media (min-width: 680px) {
  .album-shell {
    width: min(100% - 2rem, 1200px);
  }

  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 980px) {
  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
  }
}

@media (min-width: 1240px) {
  .gallery {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .header-inner {
    width: min(100% - 1.2rem, 1200px);
  }

  .brand > span:last-child {
    display: none;
  }

  .quiet-button span {
    display: none;
  }

  .site-footer {
    min-height: 120px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .viewer-arrow {
    top: auto;
    bottom: 0.8rem;
    width: 42px;
    height: 42px;
  }

  .viewer-prev {
    left: 0.8rem;
  }

  .viewer-next {
    right: 0.8rem;
  }

  .input-row {
    display: grid;
  }
}

@media (hover: none) {
  .card-name {
    display: none;
  }
}

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