:root {
  --sea: #1f5f6b;
  --sea-deep: #143f48;
  --foam: #e8f2f0;
  --sand: #f3ebe0;
  --olive: #3d6f9a;
  --ink: #1c2a2e;
  --muted: #5a6b70;
  --line: rgba(28, 42, 46, 0.12);
  --danger: #9b3b2e;
  --ok: #2f6a8a;
  --shadow: 0 18px 50px rgba(20, 63, 72, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

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

/* Author display rules must not override the hidden attribute */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 111, 154, 0.2), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(31, 95, 107, 0.18), transparent 50%),
    linear-gradient(180deg, #d8e6ef 0%, var(--sand) 42%, #efe6d8 100%);
  line-height: 1.5;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 35%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 28px,
      rgba(255, 255, 255, 0.035) 28px,
      rgba(255, 255, 255, 0.035) 29px
    );
  z-index: -1;
  animation: drift 28s linear infinite;
}

@keyframes drift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 0 0, 180px 40px;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  backdrop-filter: blur(14px);
  background: rgba(232, 242, 240, 0.78);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  justify-self: start;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--sea);
  color: var(--foam);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.8rem;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  color: var(--sea-deep);
  background: rgba(31, 95, 107, 0.08);
}

.nav-link.is-active {
  color: var(--foam);
  background: var(--sea);
}

.auth-bar {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-chip {
  font-size: 0.9rem;
  color: var(--sea-deep);
}

.user-chip-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

.user-chip-btn:hover {
  background: rgba(31, 95, 107, 0.1);
}

.user-chip.pending {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.8rem;
}

main {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.tab-panel[hidden] {
  display: none;
}

.tab-panel.is-active {
  animation: rise 0.45s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  min-height: min(68vh, 560px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3rem 0 2.5rem;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 -1rem auto;
  height: 100%;
  border-radius: 0 0 40% 40% / 0 0 12% 12%;
  background:
    linear-gradient(160deg, rgba(20, 63, 72, 0.55), rgba(61, 111, 154, 0.28)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%231f5f6b'/%3E%3Cstop offset='1' stop-color='%233d6f9a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1200' height='800' fill='url(%23g)'/%3E%3Cpath fill='rgba(243,235,224,0.12)' d='M0 520c120-40 240-80 360-60s240 80 360 70 240-70 360-50v320H0z'/%3E%3Cpath fill='rgba(232,242,240,0.18)' d='M0 610c140-30 280-90 420-70s260 90 390 80 250-60 390-40v220H0z'/%3E%3C/svg%3E")
      center/cover no-repeat;
  z-index: -1;
  animation: softPulse 8s ease-in-out infinite alternate;
}

@keyframes softPulse {
  from {
    filter: saturate(1);
  }
  to {
    filter: saturate(1.08) brightness(1.03);
  }
}

.hero-kicker {
  margin: 0 0 0.5rem;
  color: var(--foam);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 600;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  font-weight: 700;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.hero-lead {
  margin: 1rem 0 0;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.1rem;
}

.section-block {
  margin-top: 1.5rem;
  padding: 1.5rem 0 0;
}

.section-block.narrow {
  max-width: 560px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--sea-deep);
}

.section-head p {
  margin: 0.4rem 0 1.25rem;
  color: var(--muted);
}

.compose-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.compose-form h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--sea-deep);
}

.compose-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sea-deep);
}

.compose-form input,
.compose-form textarea,
.compose-form select {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 999px;
  padding: 0;
}

.password-toggle:hover {
  color: var(--sea-deep);
  background: rgba(31, 95, 107, 0.08);
}

.password-toggle svg {
  display: block;
}

.compose-form textarea {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  justify-self: start;
  background: var(--sea);
  color: var(--foam);
}

.btn-primary:hover {
  background: var(--sea-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--sea-deep);
}

.btn-ghost:hover {
  background: rgba(31, 95, 107, 0.1);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.form-status {
  min-height: 1.25rem;
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-ok {
  color: var(--ok);
}

.hint,
.empty-state {
  color: var(--muted);
}

.hint.pending-family {
  color: var(--danger);
  font-weight: 600;
}

.guestbook-feed {
  display: grid;
  gap: 1.25rem;
}

.guest-entry {
  display: grid;
  gap: 0.6rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.4s ease;
}

.guest-entry header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.guest-entry .author {
  font-weight: 600;
  color: var(--sea-deep);
}

.guest-entry time {
  color: var(--muted);
  font-size: 0.85rem;
}

.guest-entry .message {
  margin: 0;
  white-space: pre-wrap;
}

.guest-entry img {
  width: min(100%, 640px);
  height: auto;
  border-radius: 14px;
  display: block;
}

.guest-entry .album-link {
  margin: 0.35rem 0 0;
}

.guest-entry .album-link a {
  color: var(--sea);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.guest-entry .album-link a:hover {
  color: var(--sea-deep);
}

.guest-entry .btn-danger {
  justify-self: start;
  margin-top: 0.25rem;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.calendar-toolbar h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--sea-deep);
  text-transform: capitalize;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-bottom: 1.75rem;
}

.cal-dow {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0;
}

.cal-day {
  min-height: 4.4rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid transparent;
  font-size: 0.82rem;
}

.cal-day.muted {
  opacity: 0.4;
}

.cal-day.booked {
  background: rgba(31, 95, 107, 0.14);
  border-color: rgba(31, 95, 107, 0.22);
}

.cal-day .day-num {
  font-weight: 600;
  color: var(--sea-deep);
}

.cal-day .who {
  display: block;
  margin-top: 0.2rem;
  color: var(--olive);
  font-size: 0.72rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-day .guests {
  display: block;
  margin-top: 0.1rem;
  color: var(--sea-deep);
  font-size: 0.7rem;
  line-height: 1.2;
  font-weight: 600;
}

.booking-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
}

.booking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.booking-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.booking-item strong {
  color: var(--sea-deep);
}

.booking-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-totals {
  margin: 0.85rem 0 0;
  display: grid;
  gap: 0.35rem;
  text-align: right;
  font-weight: 600;
  color: var(--sea-deep);
}

.table-totals .year-total {
  margin: 0;
}

.site-footer {
  padding: 2rem 1.25rem 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-dialog {
  width: min(420px, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.25rem;
  background: rgba(248, 244, 236, 0.96);
  box-shadow: var(--shadow);
}

.account-dialog {
  width: min(480px, calc(100% - 2rem));
  max-height: min(90vh, 760px);
  overflow-y: auto;
}

.account-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--sea-deep);
}

.account-email {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.account-danger {
  border-color: rgba(155, 59, 46, 0.25);
}

.btn-danger-solid {
  justify-self: start;
  background: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover {
  filter: brightness(0.95);
}

.auth-dialog::backdrop {
  background: rgba(20, 63, 72, 0.45);
}

.dialog-close-row {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}

.auth-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.auth-tab {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.auth-tab.is-active {
  background: rgba(31, 95, 107, 0.12);
  color: var(--sea-deep);
}

.config-banner {
  margin: 1rem auto 0;
  width: min(1100px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(155, 59, 46, 0.1);
  color: var(--danger);
  border: 1px solid rgba(155, 59, 46, 0.2);
}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand auth"
      "nav nav";
  }

  .brand {
    grid-area: brand;
  }

  .auth-bar {
    grid-area: auth;
  }

  .main-nav {
    grid-area: nav;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .booking-layout,
  .form-row {
    grid-template-columns: 1fr;
  }

  .cal-day {
    min-height: 3.4rem;
  }
}
