:root {
  --reels-ink: #163d34;
  --reels-ink-dark: #0b2922;
  --reels-brand: #d89a4b;
  --reels-paper: #fffdf8;
  --reels-cream: #f6f2e9;
  --reels-muted: #66746f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #1d2d29;
  background: var(--reels-paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.reels-header,
.admin-header {
  color: #fff;
  background: var(--reels-ink-dark);
}

.reels-header-inner,
.admin-header-inner {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.reels-brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: #fff;
  text-decoration: none;
}

.reels-brand img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
}

.reels-brand span,
.reels-brand strong,
.reels-brand small {
  display: block;
}

.reels-brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.reels-brand small {
  margin-top: .15rem;
  color: rgba(255, 255, 255, .65);
  font-size: .75rem;
}

.reels-header .btn-home-outline {
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
}

.reels-hero {
  padding: 88px 0 80px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(216, 154, 75, .24), transparent 28%),
    linear-gradient(135deg, var(--reels-ink), var(--reels-ink-dark));
}

.reels-hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 7vw, 5.2rem);
  line-height: 1;
}

.reels-hero p {
  max-width: 720px;
  margin: 1.25rem 0 0;
  color: rgba(255, 255, 255, .72);
  font-size: 1.1rem;
}

.reels-gallery {
  min-height: 50vh;
  padding: 80px 0 110px;
  background: var(--reels-cream);
}

.reels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 290px));
  justify-content: center;
  gap: 1.25rem;
}

.reel-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(22, 61, 52, .12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(13, 42, 35, .09);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.reel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(13, 42, 35, .14);
}

.reel-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  flex: 0 0 auto;
  overflow: hidden;
  background: #050807;
}

.reel-cover-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.reel-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 14, 11, .08), rgba(3, 14, 11, .5));
  transition: background .2s ease;
}

.reel-preview:hover .reel-cover-shade,
.reel-preview:focus-within .reel-cover-shade {
  background: linear-gradient(180deg, rgba(3, 14, 11, 0), rgba(3, 14, 11, .32));
}

.reel-preview:focus-within {
  outline: 3px solid var(--reels-brand);
  outline-offset: -3px;
}

.reel-preview-action {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  width: 100%;
  padding: 0;
  place-content: center;
  gap: .55rem;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.reel-preview-action:focus-visible {
  outline: 0;
}

.reel-preview-icon,
.reel-preview-label {
  position: relative;
  z-index: 1;
}

.reel-preview-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  background: rgba(216, 154, 75, .9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  font-size: 1.8rem;
  transition: transform .2s ease;
}

.reel-preview:hover .reel-preview-icon,
.reel-preview:focus-within .reel-preview-icon {
  transform: scale(1.08);
}

.reel-preview-label {
  padding: .28rem .55rem;
  border-radius: 999px;
  background: rgba(3, 14, 11, .72);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
}

.reel-card-body {
  display: flex;
  padding: .9rem 1rem 1rem;
  flex: 1;
  flex-direction: column;
}

.reel-card-body h3 {
  margin: 0 0 .35rem;
  color: var(--reels-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
}

.reel-card-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--reels-muted);
  font-size: .78rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.reel-card-body p.is-expanded {
  display: block;
  overflow: visible;
}

.reel-description {
  margin-bottom: .65rem;
}

.reel-description-more {
  display: inline;
  padding: 0;
  border: 0;
  color: #9c6019;
  background: transparent;
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
}

.reel-description-more[hidden] {
  display: none;
}

.reel-facebook-link {
  margin-top: auto;
  color: #9c6019;
  font-weight: 800;
  font-size: .76rem;
  text-decoration: none;
}

body.reel-viewer-open {
  overflow: hidden;
}

.reel-viewer[hidden] {
  display: none;
}

.reel-viewer {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  align-items: start;
  justify-items: center;
  overflow: hidden;
}

.reel-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 14, 11, .92);
  backdrop-filter: blur(5px);
}

.reel-viewer-dialog {
  position: relative;
  display: flex;
  width: min(94vw, 620px);
  height: calc(100dvh - max(24px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  max-height: calc(100dvh - 24px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px;
  background: #07100e;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.reel-viewer-header {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 52px;
  padding: .55rem .65rem .55rem 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #fff;
  background: var(--reels-ink-dark);
}

.reel-viewer-header h2 {
  overflow: hidden;
  margin: 0;
  font-size: .95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-viewer-close {
  display: inline-flex;
  padding: .45rem .7rem;
  align-items: center;
  gap: .4rem;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-size: .78rem;
  font-weight: 800;
}

.reel-viewer-frame-wrap {
  display: flex;
  min-height: 0;
  flex: 1;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

.reel-viewer-frame {
  display: block;
  width: min(100%, calc((100dvh - 76px) * 9 / 16));
  height: min(calc(100dvh - 76px), calc(94vw * 16 / 9));
  flex: 0 0 auto;
  align-self: flex-start;
  border: 0;
  background: #000;
}

.reels-empty,
.admin-empty {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  border: 1px solid rgba(22, 61, 52, .12);
  border-radius: 22px;
  background: #fff;
  text-align: center;
}

.reels-empty > i,
.admin-empty > i {
  display: block;
  margin-bottom: .8rem;
  color: var(--reels-brand);
  font-size: 2.4rem;
}

.reels-footer {
  padding: 1.4rem 0;
  color: rgba(255, 255, 255, .7);
  background: #071d18;
}

.reels-footer .home-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.reels-footer a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.admin-page {
  min-height: 100vh;
  background: #f3f5f3;
}

.admin-header-inner {
  min-height: 68px;
}

.admin-header form,
.admin-actions form {
  margin: 0;
}

.admin-brand {
  color: var(--reels-brand);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-brand span {
  margin-left: .45rem;
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .95rem;
}

.admin-main {
  padding-top: 54px;
  padding-bottom: 70px;
}

.admin-title-row {
  display: flex;
  margin-bottom: 2rem;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
}

.admin-title-row h1,
.admin-form-card h1 {
  margin: .25rem 0 .4rem;
  color: var(--reels-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.admin-title-row p,
.admin-form-card > p {
  margin: 0;
  color: var(--reels-muted);
}

.admin-kicker {
  color: #9c6019;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.btn-admin-primary {
  border-color: var(--reels-ink);
  color: #fff;
  background: var(--reels-ink);
  font-weight: 800;
}

.btn-admin-primary:hover,
.btn-admin-primary:focus {
  border-color: var(--reels-ink-dark);
  color: #fff;
  background: var(--reels-ink-dark);
}

.admin-table-card,
.admin-form-card {
  overflow: hidden;
  border: 1px solid rgba(22, 61, 52, .1);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(13, 42, 35, .07);
}

.admin-table-card thead th {
  padding: 1rem;
  color: var(--reels-muted);
  background: #f8faf8;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.admin-table-card tbody td {
  padding: 1rem;
}

.admin-reel-url {
  display: block;
  max-width: 620px;
  overflow: hidden;
  color: var(--reels-muted);
  font-size: .8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 800;
}

.status-badge.published {
  color: #126036;
  background: #dff4e7;
}

.status-badge.hidden {
  color: #6b5a24;
  background: #f6edcf;
}

.admin-actions {
  white-space: nowrap;
}

.admin-actions form {
  display: inline-block;
}

.admin-form-container {
  max-width: 850px;
}

.admin-back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--reels-ink);
  font-weight: 700;
  text-decoration: none;
}

.admin-form-card {
  padding: clamp(1.4rem, 4vw, 2.5rem);
}

.admin-form-card > p {
  margin-bottom: 2rem;
}

.admin-publish-switch {
  padding: .8rem 1rem .8rem 3.2rem;
  border: 1px solid #d9dfdb;
  border-radius: 10px;
}

.admin-form-actions {
  display: flex;
  margin-top: 2rem;
  gap: .75rem;
}

@media (max-width: 767.98px) {
  .reels-header-inner {
    min-height: 74px;
  }

  .reels-brand img {
    width: 48px;
    height: 48px;
  }

  .reels-brand small {
    display: none;
  }

  .reels-header .btn {
    padding: .45rem .65rem;
    font-size: .78rem;
  }

  .reels-hero {
    padding: 62px 0 58px;
  }

  .reels-gallery {
    padding: 54px 0 78px;
  }

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

  .reel-card-body {
    padding: .7rem .75rem .8rem;
  }

  .reel-card-body h3 {
    font-size: .94rem;
  }

  .reel-card-body p {
    font-size: .7rem;
    -webkit-line-clamp: 3;
  }

  .reel-card-body p.is-expanded {
    display: block;
  }

  .reels-footer .home-shell {
    flex-direction: column;
    text-align: center;
  }

  .admin-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-title-row .btn {
    align-self: flex-start;
  }

  .admin-table-card,
  .admin-table-card tbody,
  .admin-table-card tr,
  .admin-table-card td {
    display: block;
    width: 100%;
  }

  .admin-table-card thead {
    display: none;
  }

  .admin-table-card tr {
    padding: .75rem 0;
    border-bottom: 1px solid #e6ebe7;
  }

  .admin-table-card tr:last-child {
    border-bottom: 0;
  }

  .admin-table-card tbody td {
    padding: .45rem 1rem;
    border: 0;
    text-align: left !important;
  }

  .admin-table-card td::before {
    display: block;
    margin-bottom: .15rem;
    color: var(--reels-muted);
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  .admin-actions {
    padding-top: .8rem !important;
  }
}

@media (max-width: 479.98px) {
  .reel-viewer {
    padding: 0;
  }

  .reel-viewer-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .reel-viewer-frame {
    width: min(100vw, calc((100dvh - 52px) * 9 / 16));
    height: min(calc(100dvh - 52px), calc(100vw * 16 / 9));
  }

  .admin-header-inner {
    flex-wrap: wrap;
    padding-top: .7rem;
    padding-bottom: .7rem;
  }

  .admin-header .btn-outline-light {
    display: none;
  }

  .admin-main {
    padding-top: 36px;
  }

  .admin-form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
