/* The Clueless — shared styles across index / create / manage */

:root {
  /* Site color palette as CSS custom properties, reused throughout
     this file instead of repeating hex codes. */
  --wine: #3c0008;     /* dark red — headers, titles, primary accents */
  --navy: #012161;     /* dark blue — body text, borders */
  --cream: #e8d6b6;    /* page background, light text-on-dark */
  --cream-dim: #ddc9a3; /* muted cream — secondary text on dark backgrounds */
  --paper: #fffaf0;    /* near-white — card/panel/input backgrounds */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--navy);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

a { color: var(--navy); }

/* ---------- Header / wordmark ---------- */

header {
  background: var(--wine);
  padding: 24px 20px 18px;
  text-align: center;
}

.crumb {
  display: block;
  max-width: 1000px;
  margin: 0 auto 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-decoration: none;
}

.crumb:hover { color: var(--cream); }

.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.wordmark .the {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-left: 2px;
}

.wordmark .mark {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 42px;
  line-height: 1;
  white-space: nowrap;
}

.wordmark .mark .clue { color: var(--cream); }
.wordmark .mark .less { color: var(--cream-dim); }

.wordmark .underline {
  width: 200px;
  height: 10px;
  margin-top: 4px;
  margin-left: 3px;
}

.wordmark .underline path {
  stroke: var(--cream-dim);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.tagline {
  max-width: 1000px;
  margin: 10px auto 0;
  font-size: 13px;
  color: var(--cream-dim);
  letter-spacing: 0.01em;
}

nav.top-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}

nav.top-nav a {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--cream-dim);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

nav.top-nav a:hover { color: var(--cream); }

nav.top-nav a.active { color: var(--cream); border-bottom-color: var(--cream); }

/* ---------- Page shell ---------- */

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 8px;
}

.page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 26px;
  color: var(--wine);
  margin: 0 0 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--navy);
  margin: 0 0 22px;
}

/* ---------- Intro panel ---------- */
/* Short blurb above the filters, same pattern as Hiking/Recipe Box/
   Tabletop Games' own "<site>-intro" panels: a .panel card holding a
   main sentence (.intro-blurb) plus a smaller, dimmer clarifying line
   (.intro-note). The copy itself lives in index.php's $introBlurb/
   $introNote variables, not here — this only styles it. */

.journal-intro { padding: 20px 24px; }
.journal-intro p { margin: 0; }
.intro-blurb { font-size: 16px; line-height: 1.65; }
.intro-note { margin-top: 10px !important; font-size: 13px; opacity: 0.7; }

/* ---------- Filters panel ---------- */
/* .panel is the generic card look (background/border/radius/padding)
   shared by the filters box, feed entries, and the login modal;
   .filters/.filters-body below layer the <details>-specific bits
   (the expand/collapse arrow, inner spacing) on top of it. */

.panel {
  background: var(--paper);
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 24px;
}

.filters { padding: 0; } /* .filters-body below re-adds its own padding instead */

.filters summary {
  list-style: none; /* removes the default <details> disclosure triangle */
  cursor: pointer;
  padding: 16px 20px;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--wine);
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters summary::-webkit-details-marker { display: none; } /* Safari/Chrome's own version of removing the default marker */

.filters summary::after {
  /* Hand-drawn chevron arrow (two borders rotated into an "L" shape)
     replacing the native disclosure triangle removed above. */
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--wine);
  border-bottom: 2px solid var(--wine);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.filters[open] summary::after { transform: rotate(-135deg); } /* flips the chevron to point up when expanded */

.filters summary:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: -2px;
  border-radius: 12px;
}

.filters:not([open]) summary { padding-bottom: 16px; }

.filter-count {
  font-size: 12px;
  color: var(--navy);
  opacity: 0.7;
}

.filters-body { padding: 4px 20px 6px; }

.filters .field-group:last-child { margin-bottom: 12px; }

.filter-row {
  display: grid;
  grid-template-columns: 2fr 1fr; /* search box wider than the sort dropdown */
  gap: 16px;
}

.filter-row.rating-row {
  grid-template-columns: 1fr auto; /* rating chips take remaining space, "Clear filters" button sized to its content */
  align-items: end;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-chip {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px; /* fully rounded "pill" shape regardless of content width */
  border: 1px solid var(--navy);
  background: transparent;
  color: var(--navy);
  cursor: pointer;
}

.filter-chip:hover { background: var(--cream-dim); }

.filter-chip.on {
  /* ".on" is toggled by app.js' renderChips() when a chip is selected */
  background: var(--wine);
  border-color: var(--wine);
  color: var(--cream);
}

.results-count { margin: 0 0 14px; }

/* ---------- Feed entries ---------- */

.entry {
  background: var(--paper);
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.entry-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  color: var(--wine);
  margin: 0 0 8px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.pill {
  /* Small rounded metadata badges (date/location/room/rating/link) —
     see app.js' renderEntryCard(). */
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--navy);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill.link { background: var(--wine); color: var(--cream); }
.pill.link a { color: var(--cream); text-decoration: none; }

.body-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--navy);
  margin: 0 0 14px;
  white-space: pre-wrap; /* preserves the line breaks the author typed in the entry textarea */
}

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); /* responsive photo grid: as many ~96px+ columns as fit the width */
  gap: 8px;
  margin-bottom: 14px;
}

.photos img {
  width: 100%;
  aspect-ratio: 1; /* forces each thumbnail into a square regardless of the source photo's own proportions */
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.sub-text {
  border-top: 1px solid var(--cream-dim);
  padding-top: 10px;
  font-size: 13px;
  font-style: italic;
  color: var(--navy);
  margin: 0;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--navy);
  font-size: 14px;
  border: 1px dashed var(--navy);
  border-radius: 12px;
}

/* ---------- Forms (create / edit) ---------- */

.field-group { margin-bottom: 18px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* two equal-width fields side by side (e.g. Date + Location) */
  gap: 14px;
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; } /* stack side-by-side field pairs on narrow/mobile screens */
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 6px;
}

label .optional-tag {
  font-weight: 400;
  color: var(--navy);
  opacity: 0.6;
  font-size: 12px;
  margin-left: 6px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; min-height: 90px; }

.star-rating {
  display: flex;
  gap: 4px;
}

.star-rating .star {
  background: none;
  border: none;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--cream-dim); /* unfilled star color */
  cursor: pointer;
}

.star-rating .star:hover { color: var(--navy); opacity: 0.6; }

.star-rating .star.filled { color: var(--wine); } /* toggled by create.php's renderStars() */

.pill.rating {
  letter-spacing: 1px;
}

input:focus, textarea:focus {
  outline: 2px solid var(--wine);
  outline-offset: 1px;
}

input[type="file"] {
  width: 100%;
  font-size: 13px;
  color: var(--navy);
}

.hint {
  font-size: 12px;
  color: var(--navy);
  opacity: 0.7;
  margin-top: 5px;
}

.section-label {
  /* The small "REQUIRED" / "OPTIONAL" uppercase dividers on the entry form */
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wine);
  margin: 26px 0 12px;
  border-bottom: 1px solid var(--cream-dim);
  padding-bottom: 6px;
}

.section-label:first-of-type { margin-top: 0; }

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* responsive thumbnail grid, same approach as .photos above */
  gap: 8px;
  margin-top: 10px;
}

.photo-preview .thumb {
  position: relative; /* positioning context for the "x" remove button below */
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--navy);
}

.photo-preview .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.photo-preview .thumb button {
  /* The circular "x" remove button overlaid on a photo thumbnail's
     top-right corner (see create.php's renderPhotoPreview()). */
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--wine);
  color: var(--cream);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

button, .btn {
  /* Base button look shared by every variant below
     (.btn-primary/.btn-secondary/.btn-danger). */
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--navy);
}

.btn-primary {
  background: var(--wine);
  color: var(--cream);
  border-color: var(--wine);
}

.btn-primary:hover { opacity: 0.92; }

.btn-secondary {
  background: transparent;
  color: var(--navy);
}

.btn-secondary:hover { background: var(--cream-dim); }

.btn-danger {
  background: transparent;
  color: var(--wine);
  border-color: var(--wine);
}

.btn-danger:hover { background: var(--wine); color: var(--cream); }

.field-error {
  font-size: 12px;
  color: var(--wine);
  margin-top: 5px;
  display: none; /* only shown via .field-group.invalid below */
}

.field-group.invalid input,
.field-group.invalid textarea {
  border-color: var(--wine);
}

.field-group.invalid .field-error { display: block; }
/* .invalid is toggled by create.php's setInvalid() on submit */

/* ---------- Manage list ---------- */

.manage-row {
  background: var(--paper);
  border: 1px solid var(--navy);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.manage-row .info { min-width: 0; } /* allows the title/subline text to truncate/wrap instead of forcing the row wider */

.manage-row .title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--wine);
  margin: 0 0 3px;
}

.manage-row .subline {
  font-size: 12px;
  color: var(--navy);
  opacity: 0.85;
}

.manage-row .row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0; /* keeps the Edit/Delete buttons from shrinking when the row is tight on space */
}

.manage-row .row-actions .btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* ---------- Footer ---------- */
/* Unified 2026-10-10 to match the shared footer pattern every other
   login-gated sub-site (Foodies, Recipe Box, Hiking, Tabletop Games,
   Admin) already uses: a left-aligned "the ClueLess · <Section>" label
   and a right-aligned Log in/out button via justify-content:space-between,
   instead of this page's old center-the-text/absolutely-position-the-
   button approach. The old approach rendered visibly differently from
   every other sub-site's footer (centered label vs. left-aligned label),
   which is exactly the kind of drift the 2026-10-05 consistency audit
   caught elsewhere on this site (see claude/site-structure.md section 10)
   — this closes the same gap for the footer.
   One deliberate difference from the other 5 sites' footer rule is kept
   here on purpose: `margin-top: 12px`. This page's own `main` element
   has much less bottom padding (8px) than the other sub-sites' `.wrap`
   (90px) — an existing, unrelated layout choice specific to this page's
   design — so dropping this margin would crowd the footer right up
   against the last entry card. Everything else below (padding, the
   .footer-row layout, button sizing) now matches byte-for-byte. */
footer {
  max-width: 1000px;
  margin: 12px auto 0;
  padding: 20px 24px 40px;
  border-top: 1px solid var(--navy);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--wine);
}

.footer-auth { margin: 0; }

/* ---------- Login modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0; /* shorthand for top/right/bottom/left: 0 — covers the whole viewport */
  background: rgba(36, 26, 18, 0.45); /* dark translucent backdrop behind the modal box */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; } /* toggled via the "hidden" attribute by partials/footer.php's inline script */

.modal {
  background: var(--paper);
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 320px;
}

.modal h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--wine);
  margin: 0 0 16px;
}

.modal .field-group { margin-bottom: 14px; }

.modal .actions { margin-top: 18px; }

/* ---------- Responsive ---------- */
/* Mobile-portrait overrides — this project targets 1080p desktop and
   mobile portrait specifically (see claude/site-structure.md), so this
   is the one breakpoint this stylesheet needs. */

@media (max-width: 480px) {
  .wordmark .mark { font-size: 32px; }
  header { padding: 20px 16px 16px; }
  main { padding: 20px 14px 8px; }
  .entry { padding: 16px 16px; }
  .entry-title { font-size: 19px; }
  .manage-row { flex-direction: column; align-items: flex-start; }
  .filter-row, .filter-row.rating-row { grid-template-columns: 1fr; }
  .filters summary { padding: 14px 16px; }
  .filters-body { padding: 4px 16px 16px; }
  .journal-intro { padding: 16px 18px; }
}

/* ---------- site-intro editor (manage.php, added 2026-10-05) ----------
   The "Edit site intro" box at the top of manage.php, where the blurb/
   note shown on the public index page can be edited without touching
   code. Same shared shape across every login-gated sub-site. */
.meta-panel textarea { width: 100%; }
.meta-saved-notice {
  background: var(--cream);
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--wine);
  display: none;
}
.meta-saved-notice.show { display: block; }
