:root {
  color-scheme: light;
  --paper: #f4efe6;
  --paper-soft: #faf7f0;
  --surface: #ffffff;
  --surface-soft: #f7f2e8;
  --ink: #191c21;
  --muted: #66707b;
  --line: #d9d2c4;
  --night: #101419;
  --night-soft: #1b212a;
  --accent: #c69a4e;
  --accent-dark: #a97c33;
  --sage: #4b776f;
  --clay: #d06b57;
  --shadow: 0 20px 48px rgba(16, 20, 25, 0.14);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

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

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 20, 25, 0.88);
  color: #f7f2e8;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #17191d;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong,
h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 3px;
  color: rgba(247, 242, 232, 0.7);
  font-size: 12px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(247, 242, 232, 0.16);
  border-radius: 999px;
  color: #f7f2e8;
  font-size: 14px;
  font-weight: 800;
}

.topnav a:hover {
  border-color: rgba(247, 242, 232, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.topnav .nav-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #17191d;
}

.topnav .nav-primary:hover {
  border-color: var(--accent);
  background: #d5ab60;
}

main {
  min-width: 0;
}

.home-hero {
  position: relative;
  display: grid;
  min-height: 860px;
  height: 88vh;
  overflow: hidden;
  background: var(--night);
}

.home-hero > img,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.home-hero > img {
  object-fit: cover;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(16, 20, 25, 0.88) 0%, rgba(16, 20, 25, 0.56) 48%, rgba(16, 20, 25, 0.08) 100%),
    linear-gradient(0deg, rgba(16, 20, 25, 0.64) 0%, rgba(16, 20, 25, 0.08) 45%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(740px, calc(100% - 80px));
  margin-left: 40px;
  color: #fff;
}

.hero-copy .kicker {
  color: rgba(247, 242, 232, 0.76);
}

.hero-copy h1 {
  margin: 0;
  font-size: 68px;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy p:not(.kicker) {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(247, 242, 232, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7f2e8;
  font-size: 13px;
  font-weight: 800;
}

.hero-note {
  max-width: 640px;
  margin: 14px 0 0;
  color: rgba(247, 242, 232, 0.72);
  font-size: 13px;
  line-height: 1.6;
}

.content-band,
.capture-layout,
.admin-login-layout,
.admin-layout {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 42px 40px 56px;
}

.sample-section {
  padding-top: 42px;
  border-top: 1px solid rgba(217, 210, 196, 0.7);
  background:
    linear-gradient(180deg, rgba(244, 239, 230, 0.96) 0%, rgba(244, 239, 230, 1) 100%);
}

.live-section {
  padding-top: 20px;
  padding-bottom: 70px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.compact-heading {
  margin-bottom: 12px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.light-kicker {
  color: rgba(247, 242, 232, 0.76);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: 56px;
}

h2 {
  font-size: 34px;
}

.section-lead {
  max-width: 58ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(198, 154, 78, 0.12);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 126px;
  gap: 14px;
  grid-auto-flow: dense;
}

.sample-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(217, 210, 196, 0.72);
  border-radius: 8px;
  background: #dadfd9;
  box-shadow: 0 12px 28px rgba(16, 20, 25, 0.08);
}

.sample-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.sample-card:hover img {
  transform: scale(1.03);
}

.sample-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(10, 14, 18, 0.66) 0%, rgba(10, 14, 18, 0.04) 58%),
    linear-gradient(90deg, rgba(10, 14, 18, 0.08), rgba(10, 14, 18, 0));
}

.sample-card div {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  z-index: 1;
  color: #fff;
}

.sample-card span {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
}

.sample-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.28;
}

.sample-card a {
  display: inline-flex;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 800;
}

.sample-card a:hover {
  color: #fff;
}

.sample-card:nth-child(1) {
  grid-column: span 5;
  grid-row: span 2;
}

.sample-card:nth-child(2) {
  grid-column: span 3;
}

.sample-card:nth-child(3) {
  grid-column: span 4;
}

.sample-card:nth-child(4) {
  grid-column: span 7;
}

.sample-card:nth-child(5) {
  grid-column: span 5;
}

.tall-card {
  grid-column: span 5;
  grid-row: span 2;
}

.wide-card {
  grid-column: span 7;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: 28px;
  align-items: start;
}

.admin-login-layout {
  min-height: calc(100vh - 74px);
  display: grid;
  place-items: center;
}

.admin-login-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid rgba(217, 210, 196, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(250, 247, 240, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
}

.admin-login-card h1 {
  font-size: 38px;
}

.admin-login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.capture-workspace,
.submit-workspace,
.query-panel,
.admin-results {
  min-width: 0;
}

.capture-workspace {
  padding-top: 2px;
}

.submit-workspace {
  position: sticky;
  top: 86px;
  padding: 18px;
  border: 1px solid rgba(217, 210, 196, 0.84);
  border-radius: 8px;
  background: rgba(251, 247, 240, 0.92);
  box-shadow: var(--shadow);
}

.query-panel,
.admin-results {
  padding: 20px;
  border: 1px solid rgba(217, 210, 196, 0.84);
  border-radius: 8px;
  background: rgba(251, 247, 240, 0.92);
  box-shadow: var(--shadow);
}

.camera-stage {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  min-height: 390px;
  overflow: hidden;
  border: 1px solid rgba(25, 28, 33, 0.18);
  border-radius: 8px;
  background: #11151a;
  box-shadow: var(--shadow);
}

.camera-stage video,
.camera-empty {
  grid-area: 1 / 1;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  font-size: 15px;
}

.camera-empty.hidden {
  display: none;
}

.empty-icon {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.64);
  border-radius: 50%;
  font-size: 34px;
}

.toolbar,
.form-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar {
  margin-top: 16px;
}

.icon-button,
.icon-only {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
}

.icon-only {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  font-size: 20px;
}

.icon-button:hover,
.icon-only:hover {
  transform: translateY(-1px);
  border-color: rgba(198, 154, 78, 0.75);
}

.icon-button:disabled,
.icon-only:disabled,
.icon-button.is-busy,
.topnav a.is-busy {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  pointer-events: none;
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #17191d;
}

.primary-action:hover {
  border-color: var(--accent);
  background: #d5ab60;
}

.glass-action {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.shutter-action {
  border-color: rgba(208, 107, 87, 0.5);
  color: var(--clay);
}

.danger-action {
  border-color: rgba(208, 107, 87, 0.42);
  color: var(--clay);
}

.quiet-icon {
  background: transparent;
  color: var(--muted);
}

.preview-frame {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  min-height: 220px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(25, 28, 33, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f5efe5 0%, #ece3d1 100%);
  color: var(--muted);
}

.preview-frame img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-frame.has-image img {
  display: block;
}

.preview-frame.has-image span {
  display: none;
}

.submit-panel {
  display: grid;
  gap: 16px;
  align-items: start;
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 94px;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(198, 154, 78, 0.14);
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  justify-content: space-between;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.home-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.compact-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.photo-card {
  overflow: hidden;
  border: 1px solid rgba(217, 210, 196, 0.9);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 22px rgba(16, 20, 25, 0.06);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e5e9e1;
}

.photo-card-body {
  padding: 13px;
}

.photo-card h3 {
  margin-bottom: 5px;
  font-size: 17px;
  line-height: 1.25;
}

.photo-meta,
.photo-story {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.45;
}

.photo-story {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--ink);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.empty-state {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.query-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(170px, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.records-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.records-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

.records-table th,
.records-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.records-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--surface-soft);
}

.records-table tr:last-child td {
  border-bottom: 0;
}

.record-row {
  cursor: pointer;
  outline: none;
}

.record-row:hover,
.record-row:focus {
  background: rgba(75, 119, 111, 0.06);
}

.record-thumb {
  display: block;
  width: 76px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: #e5e9e1;
}

.record-title,
.record-camera,
.record-story {
  display: block;
}

.record-title,
.record-camera {
  margin-bottom: 5px;
}

.record-camera {
  color: var(--ink);
  font-weight: 900;
}

.record-story {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.detail-dialog {
  width: min(1000px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(16, 20, 25, 0.62);
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
}

.dialog-layout img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #11151a;
}

.dialog-copy {
  position: relative;
  padding: 26px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  color: var(--muted);
}

.dialog-copy h2 {
  margin: 0 42px 18px 0;
  font-size: 30px;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0 0 20px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  line-height: 1.45;
}

.admin-actions-menu {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.admin-actions-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.admin-actions-menu summary::-webkit-details-marker {
  display: none;
}

.admin-actions-menu[open] summary {
  margin-bottom: 12px;
}

.admin-actions-menu .dialog-actions {
  margin-top: 0;
}

@media (max-width: 1080px) {
  .home-hero {
    min-height: 720px;
  }

  .hero-copy {
    width: calc(100% - 32px);
    margin-left: 16px;
  }

  .hero-copy h1 {
    font-size: 48px;
  }

  .hero-copy p:not(.kicker) {
    font-size: 17px;
  }

  .capture-layout {
    grid-template-columns: 1fr;
  }

  .submit-workspace {
    position: static;
  }

  .sample-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 220px;
  }

  .sample-card,
  .sample-card:nth-child(n),
  .tall-card,
  .wide-card {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .brand strong {
    font-size: 15px;
  }

  .topnav {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topnav a {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .content-band,
  .capture-layout,
  .admin-login-layout,
  .admin-layout {
    padding: 28px 14px 44px;
  }

  .home-hero {
    min-height: 620px;
    height: 620px;
  }

  .hero-overlay {
    background:
      linear-gradient(90deg, rgba(16, 20, 25, 0.88) 0%, rgba(16, 20, 25, 0.56) 100%),
      linear-gradient(0deg, rgba(16, 20, 25, 0.7) 0%, rgba(16, 20, 25, 0.1) 40%);
  }

  .hero-copy {
    align-self: end;
    width: calc(100% - 28px);
    margin: 0 14px 86px;
  }

  .hero-copy h1 {
    font-size: 38px;
  }

  .hero-copy p:not(.kicker) {
    font-size: 16px;
    line-height: 1.56;
  }

  h1 {
    font-size: 38px;
  }

  h2 {
    font-size: 26px;
  }

  .section-lead {
    font-size: 14px;
  }

  .hero-tags,
  .hero-actions,
  .toolbar,
  .form-actions,
  .dialog-actions {
    align-items: stretch;
  }

  .sample-grid,
  .field-grid,
  .query-form,
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .camera-stage {
    min-height: 260px;
  }

  .query-form {
    align-items: stretch;
  }

  .dialog-layout img {
    max-height: 46vh;
  }

  .dialog-copy h2 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .icon-button {
    width: 100%;
  }

  .icon-only {
    flex: 0 0 auto;
  }

  .sample-grid,
  .photo-grid,
  .home-photo-grid,
  .compact-photo-grid {
    grid-template-columns: 1fr;
  }

  .sample-grid {
    grid-auto-rows: 250px;
  }
}
