/* ============================================================
   Fantasea Charter — design tokens
   Palette: deep night-sea navy, warm brass fittings, sea-glass
   teal, foam white. Display type is an old-world serif (Fraunces)
   used sparingly; body is a clean humanist sans (Public Sans);
   ship's-log details use a monospace (Space Mono).
   Signature element: the porthole — a circular, brass-ringed
   frame used for crew photos and gallery images throughout.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,500&family=Public+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --ink: #0b1f33;
  --ink-deep: #071523;
  --panel: #122a45;
  --panel-edge: #1c3a5c;
  --foam: #f6f2e8;
  --foam-dim: #d8d2c2;
  --brass: #c9954f;
  --brass-bright: #e3b06e;
  --tide: #5fa8a0;
  --tide-dim: #3d6f6a;
  --ok: #6fae7a;
  --warn: #d6a53c;
  --danger: #c96a4f;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-log: 'Space Mono', 'Courier New', monospace;

  --radius: 6px;
  --wrap: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--foam);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--brass-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 0.5em;
  color: var(--foam);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-style: italic; font-weight: 500; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.eyebrow {
  font-family: var(--font-log);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--tide);
}

/* ---------------- Nav ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 21, 35, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--panel-edge);
}
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  max-width: var(--wrap);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--foam);
}
.brand .mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  display: grid; place-items: center;
  color: var(--brass-bright);
  font-family: var(--font-log);
  font-size: 0.9rem;
}
.brand img.logo { height: 32px; width: auto; border-radius: 50%; }
.nav-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
  margin: 0; padding: 0;
  font-size: 0.95rem;
}
.nav-links a {
  color: var(--foam-dim);
  position: relative;
  padding-bottom: 3px;
}
.nav-links a::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -3px;
  height: 1px; background: var(--brass-bright);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a.active::after, .nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active, .nav-links a:hover { color: var(--brass-bright); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: var(--foam); font-size: 1.4rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brass); color: var(--ink-deep);
  padding: 0.6rem 1.1rem; border-radius: 0 0 var(--radius) 0;
  z-index: 200; font-weight: 600; font-size: 0.9rem;
}
.skip-link:focus { left: 0; }

@media (max-width: 760px) {
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--ink-deep);
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--panel-edge);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ---------------- Buttons & forms ---------------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--brass);
  background: transparent;
  color: var(--brass-bright);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--brass); color: var(--ink-deep); text-decoration: none; }
.btn-solid { background: var(--brass); color: var(--ink-deep); }
.btn-solid:hover { background: var(--brass-bright); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--foam-dim); }
input, select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--foam);
  margin-bottom: 1rem;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus { border-color: var(--tide); }
.field-note { font-size: 0.8rem; color: var(--foam-dim); margin-top: -0.7rem; margin-bottom: 1rem; }
.form-msg { padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.92rem; }
.form-msg.ok { background: rgba(111, 174, 122, 0.15); border: 1px solid var(--ok); color: var(--ok); }
.form-msg.err { background: rgba(201, 106, 79, 0.15); border: 1px solid var(--danger); color: var(--danger); }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  min-height: 82vh;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,21,35,0.25) 0%, rgba(7,21,35,0.55) 55%, rgba(7,21,35,0.96) 100%);
}
.hero-content { position: relative; padding: 4rem 0 3.5rem; max-width: 760px; }
.hero-content p.lede { font-size: 1.1rem; color: var(--foam-dim); max-width: 560px; }

/* ---------------- Sections ---------------- */
section { padding: 5rem 0; }
.section-alt { background: var(--panel); border-top: 1px solid var(--panel-edge); border-bottom: 1px solid var(--panel-edge); }
.two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.two-col img { border-radius: var(--radius); }

/* ---------------- Portholes (signature element) ---------------- */
.porthole {
  --size: 190px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid var(--panel-edge);
  outline: 3px solid var(--brass);
  outline-offset: -10px;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.55), 0 8px 18px rgba(0,0,0,0.35);
  margin: 0 auto 1.2rem;
}
.porthole img { width: 100%; height: 100%; object-fit: cover; }

.crew-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  text-align: center;
}
@media (max-width: 820px) { .crew-grid { grid-template-columns: 1fr; max-width: 340px; margin: 0 auto; } }
.crew-grid .role { font-family: var(--font-log); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tide); margin-bottom: 0.4rem; }
.crew-grid p { color: var(--foam-dim); font-size: 0.95rem; }

/* ---------------- Ship's log testimonials ---------------- */
.log-entries { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
@media (max-width: 760px) { .log-entries { grid-template-columns: 1fr; } }
.log-entry {
  border-left: 3px solid var(--brass);
  background: var(--panel);
  padding: 1.4rem 1.6rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.log-entry p.quote { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; margin: 0 0 0.8rem; }
.log-entry .byline { font-family: var(--font-log); font-size: 0.78rem; color: var(--tide); }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--ink-deep); padding: 3.5rem 0 2rem; border-top: 1px solid var(--panel-edge); }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-links { display: flex; gap: 1.2rem; margin-top: 0.8rem; }
.mailing-form { display: flex; gap: 0.6rem; }
.mailing-form input { margin-bottom: 0; }
@media (max-width: 500px) { .mailing-form { flex-direction: column; } }
.footer-bottom { font-size: 0.8rem; color: var(--foam-dim); text-align: center; padding-top: 1.5rem; border-top: 1px solid var(--panel-edge); }

/* ---------------- Gallery ---------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.gallery-grid img { border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; width: 100%; }

/* ---------------- Booking calendar ---------------- */
.calendar-panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 1.8rem;
}
.calendar-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.2rem;
}
.calendar-head button {
  background: none; border: 1px solid var(--panel-edge); color: var(--foam);
  border-radius: var(--radius); width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
}
.calendar-head button:hover { border-color: var(--brass); color: var(--brass-bright); }
.calendar-head h3 { margin: 0; font-style: italic; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-dow {
  font-family: var(--font-log);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foam-dim);
  text-align: center;
  padding-bottom: 0.4rem;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  font-size: 0.9rem;
  color: var(--foam-dim);
}
.cal-day.empty { background: none; }
.cal-day.past { opacity: 0.35; }
.cal-day.available { background: rgba(111,174,122,0.14); color: var(--foam); cursor: pointer; border: 1px solid rgba(111,174,122,0.35); }
.cal-day.available:hover { background: rgba(111,174,122,0.28); }
.cal-day.pending { background: rgba(214,165,60,0.16); color: var(--foam); cursor: pointer; border: 1px solid rgba(214,165,60,0.4); }
.cal-day.pending:hover { background: rgba(214,165,60,0.3); }
.cal-day.unavailable { background: rgba(201,106,79,0.12); color: var(--foam-dim); border: 1px solid rgba(201,106,79,0.3); cursor: not-allowed; }
.cal-day.today { box-shadow: 0 0 0 2px var(--tide) inset; }

.calendar-legend { display: flex; gap: 1.4rem; margin-top: 1.2rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--foam-dim); }
.calendar-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot.available { background: var(--ok); }
.legend-dot.pending { background: var(--warn); }
.legend-dot.unavailable { background: var(--danger); }

/* Booking request modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7,21,35,0.75);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 1.5rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--ink); border: 1px solid var(--panel-edge); border-radius: var(--radius);
  max-width: 480px; width: 100%; padding: 2rem; max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.modal-close { background: none; border: 0; color: var(--foam-dim); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--brass-bright); }
.modal .selected-date { font-family: var(--font-log); color: var(--tide); font-size: 0.85rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row-2 { grid-template-columns: 1fr; } }

/* ---------------- Admin dashboard ---------------- */
.admin-shell { padding: 2.5rem 0 5rem; }
.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 2rem; border-bottom: 1px solid var(--panel-edge); flex-wrap: wrap; }
.admin-tab { background: none; border: 0; color: var(--foam-dim); padding: 0.7rem 1.1rem; cursor: pointer; font-family: var(--font-body); font-size: 0.95rem; border-bottom: 2px solid transparent; }
.admin-tab.active { color: var(--brass-bright); border-bottom-color: var(--brass); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--panel-edge); vertical-align: top; }
.data-table th { font-family: var(--font-log); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tide); }
.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-family: var(--font-log); text-transform: uppercase; }
.pill.pending { background: rgba(214,165,60,0.18); color: var(--warn); }
.pill.confirmed { background: rgba(111,174,122,0.18); color: var(--ok); }
.pill.declined { background: rgba(201,106,79,0.18); color: var(--danger); }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.row-actions button { font-size: 0.78rem; padding: 0.35rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--panel-edge); background: none; color: var(--foam); cursor: pointer; }
.row-actions button:hover { border-color: var(--brass); color: var(--brass-bright); }
.inline-form { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 2rem; }
.inline-form > div { margin-bottom: 0; }
.inline-form input { margin-bottom: 0; }
.empty-state { color: var(--foam-dim); font-size: 0.9rem; padding: 1.5rem 0; }

/* ---------------- Motion & polish ---------------- */
.porthole { transition: transform 0.25s ease; }
.porthole:hover { transform: scale(1.035); }

.log-entry { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.log-entry:hover { transform: translateY(-3px); box-shadow: 0 12px 22px rgba(0,0,0,0.28); }

.gallery-grid img { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.gallery-grid img:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0,0,0,0.35); }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .porthole, .log-entry, .gallery-grid img { transition: none; }
}

/* Tables can be wider than small screens; scroll rather than overflow */
#bookings-table-wrap, #blocked-table-wrap, #messages-table-wrap, #mailing-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------------- Responsive refinements ---------------- */
@media (max-width: 600px) {
  section { padding: 3.2rem 0; }
  .hero { min-height: 68vh; }
  .porthole { --size: 150px; }
  .calendar-grid { gap: 4px; }
  .cal-day { font-size: 0.78rem; }
  .modal { padding: 1.4rem; }
}

/* ---------------- Utility ---------------- */
.center { text-align: center; }
.muted { color: var(--foam-dim); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.max-w-form { max-width: 560px; }
