/* ============================================================
   The Gray Family Hub — coastal "digital living room"
   Palette drawn from the Gemini mockup: sandy beach, weathered
   wood, warm cream glass cards, deep navy text, brass accents.
   ============================================================ */

@font-face {
  font-family: 'Pragmatica';
  src: url('../fonts/Pragmatica.woff2') format('woff2'),
       url('../fonts/Pragmatica-clean.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sand: #e9ddc7;
  --sand-deep: #d8c6a8;
  --wood: #c9b491;
  --card: rgba(250, 246, 238, 0.82);
  --card-solid: #faf6ee;
  --card-border: rgba(120, 100, 70, 0.25);
  --ink: #2b3a4a;
  --ink-soft: #5a6b7c;
  --navy: #34506b;
  --brass: #b98a3c;
  --coral: #e0876a;
  --seafoam: #9dbfb4;
  --danger: #c0564a;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(80, 60, 30, 0.16);
  --shadow-lift: 0 10px 28px rgba(80, 60, 30, 0.28);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Pragmatica', 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

/* make the hidden attribute always win over display rules */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    linear-gradient(rgba(233, 221, 199, 0.55), rgba(233, 221, 199, 0.75)),
    repeating-linear-gradient(90deg, var(--wood) 0 3px, var(--sand-deep) 3px 90px);
  min-height: 100vh;
}

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

button { font-family: inherit; cursor: pointer; }

/* ---------- Mode toggle ---------- */
.mode-bar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  gap: 10px;
}

.mode-toggle, .reset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  transition: transform 0.15s ease, background 0.2s ease;
}

.mode-toggle:hover, .reset-btn:hover { transform: translateY(-2px); }

body.editing .mode-toggle { background: var(--brass); }

.reset-btn { background: var(--ink-soft); }
.reset-btn.hidden-in-view { display: none; }
body.editing .reset-btn.hidden-in-view { display: flex; }

.edit-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--brass), var(--coral));
  box-shadow: var(--shadow);
}

/* ---------- Masthead ---------- */
.masthead {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 8px;
  text-align: center;
}

.polaroid-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 18px 0 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
.polaroid-strip::-webkit-scrollbar { display: none; }

.polaroid {
  flex: 0 0 auto;
  background: #fdfbf5;
  padding: 8px 8px 26px;
  box-shadow: 0 4px 12px rgba(60, 45, 25, 0.35);
  border-radius: 3px;
  margin: 0 -14px;
  transition: transform 0.25s ease, z-index 0s;
  cursor: pointer;
}
.polaroid img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border-radius: 2px;
}
.polaroid:nth-child(odd)  { transform: rotate(-5deg) translateY(6px); }
.polaroid:nth-child(even) { transform: rotate(4deg); }
.polaroid:nth-child(3n)   { transform: rotate(-2deg) translateY(-5px); }
.polaroid:hover {
  transform: rotate(0deg) scale(1.22) translateY(-8px);
  z-index: 5;
  position: relative;
}

.masthead-text h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 4.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.masthead-text p {
  margin: 6px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------- Tab nav ---------- */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 22px auto 6px;
}

.tab, .footer-nav a {
  padding: 12px 26px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.2s ease;
}

.tab:hover, .footer-nav a:hover { transform: translateY(-2px); background: var(--card-solid); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Board grid ---------- */
.board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 18px auto 40px;
  padding: 0 16px;
  grid-auto-flow: dense;
}

@media (min-width: 768px) {
  .board { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .board { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Cards (components) ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.card h2 {
  margin: 0 0 14px;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2 i { color: var(--brass); }

/* column spans (desktop/tablet; mobile is always 1 col) */
@media (min-width: 768px) {
  .card[data-cols="2"] { grid-column: span 2; }
}
@media (min-width: 1024px) {
  .card[data-cols="3"] { grid-column: span 3; }
}

/* ---------- Edit mode chrome ---------- */
body.editing .card {
  cursor: grab;
  outline: 2px dashed transparent;
  outline-offset: 3px;
}
body.editing .card:hover { outline-color: var(--seafoam); }
body.editing .card.selected {
  outline: 2.5px solid var(--brass);
  outline-offset: 3px;
  box-shadow: var(--shadow-lift);
}
body.editing .card.dragging { opacity: 0.45; transform: scale(0.98); cursor: grabbing; }
.card.drop-target { outline: 2.5px dashed var(--coral) !important; outline-offset: 3px; }

.card-toolbar {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 4px;
  z-index: 10;
}
body.editing .card-toolbar { display: flex; }

.card-toolbar button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: rgba(52, 80, 107, 0.9);
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.card-toolbar button:hover { background: var(--brass); }
.card-toolbar button.tb-delete:hover { background: var(--danger); }

/* resize handle */
.resize-handle {
  display: none;
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 6px;
  color: var(--brass);
  cursor: nwse-resize;
  z-index: 10;
  font-size: 1.1rem;
}
@media (min-width: 768px) {
  body.editing .resize-handle { display: flex; }
}

/* inline editing */
[data-editable] { border-radius: 6px; transition: background 0.15s; }
body.editing [data-editable]:hover { background: rgba(185, 138, 60, 0.15); cursor: text; }
[data-editable][contenteditable="true"] {
  background: #fff !important;
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  cursor: text;
}

/* ---------- Hero component ---------- */
.card-hero {
  text-align: center;
  padding: 42px 26px;
  background:
    linear-gradient(rgba(250, 246, 238, 0.78), rgba(250, 246, 238, 0.88)),
    linear-gradient(120deg, var(--seafoam), var(--sand-deep));
}
.card-hero .hero-compass {
  font-size: 2.2rem;
  color: var(--brass);
  margin-bottom: 12px;
}
.card-hero h2 {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.card-hero p { color: var(--ink-soft); font-size: 1.05rem; margin: 0; }

/* ---------- Carousel ---------- */
.carousel {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--sand-deep);
  aspect-ratio: 16 / 10;
}
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}
.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
}
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(250, 246, 238, 0.85);
  color: var(--navy);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 5;
  transition: background 0.15s, transform 0.15s;
}
.carousel-btn:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-counter {
  position: absolute;
  bottom: 10px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(43, 58, 74, 0.72);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 5;
}
.carousel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ink-soft);
  gap: 10px;
  font-weight: 600;
}
.carousel-empty i { font-size: 2.4rem; color: var(--sand-deep); }

/* ---------- Chat placeholder ---------- */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
}
.chat-bubble {
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.chat-bubble strong { color: var(--navy); }
.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.chat-input-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.chat-input-row button {
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--sand-deep);
  color: var(--ink-soft);
  cursor: not-allowed;
}
.coming-soon-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--seafoam);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Poll ---------- */
.poll-question { font-weight: 700; margin: 0 0 14px; font-size: 1rem; }
.poll-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  min-height: 44px;
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.poll-option:hover { border-color: var(--brass); background: #fff; }
.poll-option.picked { border-color: var(--brass); background: rgba(185, 138, 60, 0.12); }
.poll-option .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  flex: 0 0 16px;
}
.poll-option.picked .dot { border-color: var(--brass); background: var(--brass); box-shadow: inset 0 0 0 3px #fff; }
.poll-vote {
  margin-top: 8px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.poll-vote:hover { background: var(--brass); }
.poll-thanks {
  text-align: center;
  padding: 14px;
  font-weight: 700;
  color: var(--brass);
  animation: pop 0.4s ease;
}
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Text block ---------- */
.textblock-body { font-size: 0.98rem; line-height: 1.6; }
.textblock-body p { margin: 0 0 10px; }
.text-format-bar {
  display: none;
  gap: 4px;
  margin-bottom: 10px;
}
body.editing .text-format-bar { display: flex; }
.text-format-bar button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-solid);
  color: var(--ink);
}
.text-format-bar button:hover { background: var(--sand); }

/* ---------- App container ---------- */
.app-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 180px;
  border: 2px dashed var(--card-border);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 20px;
}
.app-slot i { font-size: 2.4rem; color: var(--seafoam); }
.app-slot p { margin: 0; font-weight: 600; }
.app-slot small { color: var(--ink-soft); }

/* ---------- Roster ---------- */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 16px;
}
.roster-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.roster-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
}
.roster-member span { font-size: 0.85rem; font-weight: 600; }
.roster-member small { color: var(--ink-soft); font-size: 0.72rem; }

/* ---------- Upcoming Events ---------- */
.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  transition: transform 0.15s ease, background 0.15s ease;
}
.event-item:hover { transform: translateX(3px); background: #fff; }
.event-date {
  flex: 0 0 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  line-height: 1;
  box-shadow: var(--shadow);
}
.event-mon {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sand);
}
.event-day {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  margin-top: 2px;
}
.event-body { display: flex; flex-direction: column; gap: 2px; }
.event-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.event-body small { color: var(--ink-soft); font-size: 0.8rem; }

/* avatar palette */
.hue-0 { background: var(--navy); }
.hue-1 { background: var(--coral); }
.hue-2 { background: var(--seafoam); }
.hue-3 { background: var(--brass); }
.hue-4 { background: #7d6b9e; }
.hue-5 { background: #5f8a6e; }

/* ---------- Context menu ---------- */
.context-menu {
  position: fixed;
  z-index: 400;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  min-width: 170px;
}
.context-menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.context-menu li:hover { background: var(--sand); }
.context-menu li.danger { color: var(--danger); }
.context-menu li i { width: 16px; }

/* ---------- Restore tray ---------- */
.restore-tray {
  position: sticky;
  bottom: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(43, 58, 74, 0.92);
  color: #fff;
  font-size: 0.88rem;
}
.tray-label { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.restore-chip {
  padding: 8px 14px;
  min-height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--brass);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}
.restore-chip:hover { background: var(--coral); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(20, 26, 32, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}
.lightbox button {
  position: absolute;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(250, 246, 238, 0.15);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox button:hover { background: rgba(250, 246, 238, 0.35); }
.lightbox-close { top: 18px; right: 18px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px 90px;
  text-align: center;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.footer-nav a { font-size: 0.82rem; padding: 10px 18px; }
.footer-note {
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
  .polaroid img { width: 78px; height: 78px; }
  .polaroid { padding: 6px 6px 18px; margin: 0 -10px; }
  .card { padding: 16px; }
  .mode-label { display: none; }
  .mode-toggle, .reset-btn { padding: 12px 16px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
