:root {
  --cream: #F1E4D2;
  --card: #FFF8ED;
  --card-alt: #FFFDF9;
  --espresso: #2E2117;
  --espresso-dim: #8A7360;
  --caramel: #9C6B2F;
  --terracotta: #B24A2E;
  --line: rgba(59, 42, 26, 0.16);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

/* Several elements below set their own `display` at the same specificity as
   the browser's default [hidden] rule, which would otherwise win the
   cascade tie and show the element anyway. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream) url("../images/CoolIdeaTry_copy.png") repeat;
  background-size: 400px 400px;
  color: var(--espresso);
  font-family: var(--font-body);
}

body {
  /* Without this, .site-header's top margin collapses through body and
     escapes above it, offsetting body's tiled background from html's
     identical one - two copies of the same pattern out of phase by the
     margin amount, which looked like a doubled/cut-off row of icons. */
  display: flow-root;
}

@media (prefers-reduced-motion: no-preference) {
  .entry { animation: rise 0.5s ease both; }
  .entry:nth-child(odd) { animation-delay: 0.03s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--espresso-dim);
  margin: -0.5rem 0 1.1rem;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 50vh;
  overflow-y: auto;
}

.admin-user-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.admin-user-name {
  font-size: 0.92rem;
  flex: 1;
  min-width: 100px;
}

.admin-user-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--caramel);
  margin-left: 0.5rem;
}
.admin-user-badge.pending {
  color: var(--terracotta);
}

.admin-role-select {
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}
.admin-role-select:focus-visible {
  outline: 2px solid var(--caramel);
  outline-offset: 1px;
}

.drive-import-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  margin: 0.25rem 0 1rem;
  background: var(--cream);
}

.drive-folder-row {
  display: flex;
  gap: 0.5rem;
}
.drive-folder-row input {
  flex: 1;
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.7rem;
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.drive-file-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.drive-file-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  padding: 0.35rem 0.1rem;
  cursor: pointer;
}

.drive-select-all-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--espresso-dim);
  margin-top: 0.6rem;
  cursor: pointer;
}

.drive-import-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.media-manage-item.drive-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.4rem;
  gap: 0.25rem;
}

.drive-pending-label {
  font-size: 0.72rem;
  color: var(--espresso-dim);
  word-break: break-word;
  line-height: 1.2;
}

.drive-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--caramel);
}

.media-manage-item .storage-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(38, 26, 16, 0.75);
  color: var(--caramel);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  background: none;
  border: none;
  color: var(--espresso-dim);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.1rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.admin-tab.active {
  color: var(--espresso);
  border-bottom-color: var(--caramel);
}

.category-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.category-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-row-name {
  flex: 1;
  font-size: 0.9rem;
}

.category-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.category-form input[type="text"] {
  flex: 1;
  min-width: 120px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.5rem 0.6rem;
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 0.88rem;
}
.category-form input[type="color"],
.category-row input[type="color"] {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--cream);
  cursor: pointer;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--espresso-dim);
  margin: 0 0 0.4rem;
}
.category-badge .category-swatch {
  width: 8px;
  height: 8px;
}

/* ---------- account bar ---------- */

.account-bar {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}

.account-signed-in {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-username {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--espresso-dim);
}

.account-username::before {
  content: "signed in as ";
  color: var(--espresso-dim);
  opacity: 0.7;
}

.card-byline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--espresso-dim);
  opacity: 0.75;
  margin: 0.5rem 0 0;
}

.modal-author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--espresso-dim);
  margin: -0.5rem 0 1.1rem;
}

.card-media {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.4rem;
}

.card-media.single {
  grid-template-columns: 1fr;
}

.card-media-item {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--cream);
}

.card-media.single .card-media-item {
  aspect-ratio: 16 / 10;
}

.card-media-item img,
.card-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media-more {
  position: absolute;
  inset: 0;
  background: rgba(38, 26, 16, 0.55);
  color: var(--espresso);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.media-manage-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 0;
}

.media-manage-item {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border: 1px solid var(--line);
}

.media-manage-item img,
.media-manage-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(38, 26, 16, 0.75);
  color: var(--espresso);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-remove-btn:hover { background: var(--terracotta); }

/* ---------- header ---------- */

.site-header {
  max-width: 900px;
  margin: 2.5rem auto 2rem;
  padding: 2.25rem 1.75rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--caramel);
  margin: 0 0 0.75rem;
}

.site-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 1rem;
  color: var(--espresso-dim);
  margin: 0.75rem auto 0;
  max-width: 100%;
}

/* ---------- category filter bar ---------- */

.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0 auto 2.5rem;
  max-width: 900px;
  padding: 0 1.25rem;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--espresso);
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.category-chip:hover { border-color: rgba(156, 107, 47, 0.5); }
.category-chip.inactive {
  opacity: 0.4;
}
.category-chip .category-swatch {
  width: 8px;
  height: 8px;
}

/* ---------- page tabs ---------- */

.page-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto 2rem;
  max-width: 900px;
  padding: 0 1.25rem;
}

.page-tab {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--espresso-dim);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.page-tab:hover { color: var(--espresso); }
.page-tab.active {
  color: var(--cream);
  background: var(--caramel);
  border-color: var(--caramel);
}

/* ---------- trip supercuts ---------- */

.supercut-form-wrap {
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
}

.supercut-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.supercut-form input[type="text"],
.supercut-form input[type="url"] {
  flex: 1;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.6rem 0.8rem;
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.supercut-list {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 8rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.supercut-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
}

.supercut-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.supercut-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0;
  line-height: 1.25;
}

.supercut-byline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--espresso-dim);
  opacity: 0.75;
  margin: 0.5rem 0 0;
}

.supercut-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  background: var(--cream);
}
.supercut-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- empty state ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--espresso-dim);
}
.empty-state p { margin: 0.25rem 0; }
.empty-state-sub { font-size: 0.9rem; }

/* ---------- timeline ---------- */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 8rem;
}

main.post-page-main {
  max-width: 1100px;
}

.timeline {
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 28px;
  margin-left: -14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='140' viewBox='0 0 28 140'%3E%3Cpath d='M14 0 C 2 18, 2 32, 14 50 C 26 68, 26 82, 14 100 C 2 118, 2 122, 14 140' stroke='%239C6B2F' stroke-opacity='0.55' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-y;
  background-size: 28px 140px;
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: start;
  margin-bottom: 2.75rem;
}

.entry .dot-col {
  grid-column: 2;
  display: flex;
  justify-content: center;
  padding-top: 0.6rem;
}

.entry:nth-child(odd) .card-col { grid-column: 1; }
.entry:nth-child(even) .card-col { grid-column: 3; }

.dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #B9824A, #6B4420 75%);
  box-shadow: 0 0 0 5px var(--cream), 0 0 0 6px var(--line);
}

/* the little crease down the middle of a coffee bean */
.dot::after {
  content: "";
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  transform: rotate(20deg);
}

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  border-color: rgba(156, 107, 47, 0.5);
  transform: translateY(-2px);
}

.card-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--terracotta);
  margin: 0 0 0.4rem;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}

/* mobile: rail moves to the left, single column */
@media (max-width: 680px) {
  .timeline::before { left: 22px; margin-left: -14px; }
  .entry { grid-template-columns: 44px 1fr; }
  .entry .dot-col { grid-column: 1; padding-top: 0.5rem; }
  .entry:nth-child(odd) .card-col,
  .entry:nth-child(even) .card-col { grid-column: 2; }
  .card-media { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}

/* ---------- a post's own page ---------- */

.post-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--espresso-dim);
  text-decoration: none;
}
.back-link:hover { color: var(--espresso); }

.post-detail {
  max-width: 1100px;
  margin: 1.5rem auto 8rem;
  padding: 2rem 1.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--terracotta);
  margin: 0 0 0.5rem;
}

.post-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0.25rem 0 1rem;
  line-height: 1.2;
}

.post-desc {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--espresso-dim);
  white-space: pre-wrap;
  margin: 0 0 1.25rem;
}

.post-byline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--espresso-dim);
  opacity: 0.75;
  margin: 1.5rem 0 0;
}

.post-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.card-media-item.clickable { cursor: zoom-in; }

/* ---------- media lightbox ---------- */

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 13, 7, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.lightbox-content {
  max-width: min(90vw, 1100px);
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: min(90vw, 1100px);
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.18); }

.lightbox-close {
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  line-height: 1;
}
.lightbox-prev { left: 1.25rem; }
.lightbox-next { right: 1.25rem; }

.lightbox-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--card);
  opacity: 0.75;
}

@media (max-width: 680px) {
  .lightbox-nav { width: 42px; height: 42px; font-size: 1.6rem; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox-close { top: 0.75rem; right: 0.75rem; }
}

/* ---------- floating add button ---------- */

.fab {
  position: fixed;
  right: 1.75rem;
  bottom: 1.75rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--caramel);
  color: var(--cream);
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.fab:hover { transform: scale(1.06); }
.fab:focus-visible { outline: 3px solid var(--espresso); outline-offset: 2px; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 26, 16, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 10;
}

.modal {
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--espresso-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}
.icon-btn:hover { color: var(--espresso); }

.field {
  display: block;
  margin-bottom: 1rem;
}
.field span {
  display: block;
  font-size: 0.78rem;
  color: var(--espresso-dim);
  margin-bottom: 0.35rem;
}
.field input[type="text"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.6rem 0.7rem;
  color: var(--espresso);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.field textarea { resize: vertical; }
.field input[type="file"] {
  width: 100%;
  color: var(--espresso-dim);
  font-size: 0.85rem;
}
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--caramel);
  outline-offset: 1px;
}

.form-error {
  color: var(--terracotta);
  font-size: 0.85rem;
  margin: -0.25rem 0 1rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
}
.modal-actions-right { display: flex; gap: 0.6rem; }

.btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--caramel); color: var(--cream); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost {
  background: none;
  border-color: var(--line);
  color: var(--espresso-dim);
}
.btn-ghost:hover { color: var(--espresso); }
.btn-ghost.danger { color: var(--terracotta); border-color: rgba(178, 74, 46, 0.4); }
.btn-ghost.danger:hover { background: rgba(178, 74, 46, 0.12); }
