/* B&M Joinery — Content Portal
   Brand: deep navy + cream + warm walnut. Premium minimalist. */

:root {
  --navy: #0E1B2C;
  --navy-soft: #1E2F47;
  --navy-line: #2A3A52;
  --cream: #F5F1E8;
  --cream-2: #EDE6D5;
  --paper: #FFFFFF;
  --walnut: #B0855C;
  --walnut-dark: #8B6740;
  --walnut-soft: #D9C3A8;
  --ink: #0E1B2C;
  --ink-2: #4A5567;
  --muted: #8A8275;
  --success: #2E7D5B;
  --warn: #C58A1A;
  --danger: #B53E3E;
  --shadow-sm: 0 1px 2px rgba(14, 27, 44, 0.06), 0 1px 3px rgba(14, 27, 44, 0.08);
  --shadow-md: 0 4px 12px rgba(14, 27, 44, 0.08), 0 2px 4px rgba(14, 27, 44, 0.06);
  --shadow-lg: 0 20px 50px rgba(14, 27, 44, 0.18), 0 8px 20px rgba(14, 27, 44, 0.10);
  --radius: 6px;
  --radius-lg: 10px;
  --serif: 'Fraunces', 'Cormorant', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ HEADER ============ */

.masthead {
  background: var(--navy);
  color: var(--cream);
  padding: 28px 0 36px;
  border-bottom: 4px solid var(--walnut);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--walnut-soft);
}

.brand-meta { line-height: 1.1; }

.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--walnut-soft);
  margin-top: 4px;
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--cream-2);
  margin: 0;
  max-width: 380px;
  text-align: right;
}

/* ============ TOOLBAR ============ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 0 20px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1px solid var(--navy-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover { background: var(--paper); color: var(--ink); }

.pill.active {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
}

.counter {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ============ BUTTONS ============ */

.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn.primary {
  background: var(--navy);
  color: var(--cream);
}
.btn.primary:hover { background: var(--walnut-dark); }

.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--navy-line);
}
.btn.ghost:hover { background: var(--paper); color: var(--ink); }

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(181, 62, 62, 0.3);
}
.btn.danger:hover { background: var(--danger); color: white; }

.btn .plus { font-size: 18px; font-weight: 400; line-height: 1; }

/* ============ GALLERY ============ */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 8px 0 60px;
}

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-media img,
.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media .placeholder {
  text-align: center;
  color: var(--walnut-soft);
  padding: 24px;
}

.card-media .placeholder .src-icon {
  font-size: 38px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.card-media .placeholder .src-name {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

.card-media .source-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(14, 27, 44, 0.7);
  color: var(--cream);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.card-media .status-tag {
  position: absolute;
  top: 12px;
  right: 12px;
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

.card-footage-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: var(--walnut-dark);
}

/* ============ STATUS TAGS ============ */

.status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.status.inspiration_only { background: var(--cream-2); color: var(--ink-2); }
.status.gathering { background: rgba(197, 138, 26, 0.18); color: var(--warn); }
.status.ready_to_edit { background: rgba(46, 125, 91, 0.18); color: var(--success); }
.status.delivered { background: var(--navy); color: var(--cream); }

/* On dark card-media background */
.card-media .status { background: rgba(245, 241, 232, 0.95); color: var(--ink); }
.card-media .status.gathering { background: rgba(197, 138, 26, 0.95); color: white; }
.card-media .status.ready_to_edit { background: rgba(46, 125, 91, 0.95); color: white; }
.card-media .status.delivered { background: var(--walnut); color: var(--navy); }

/* ============ EMPTY STATE ============ */

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-2);
}

.empty-icon { font-size: 48px; color: var(--walnut); margin-bottom: 16px; }
.empty h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0 0 8px; color: var(--ink); }
.empty p { margin: 0 0 24px; color: var(--muted); }

/* ============ MODAL ============ */

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  width: 90vw;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.wide { max-width: 880px; }

.modal::backdrop {
  background: rgba(14, 27, 44, 0.55);
  backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--cream-2);
}

.modal-header h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.close:hover { background: var(--cream); color: var(--ink); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-body label {
  display: block;
  margin-bottom: 18px;
}

.modal-body label > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.modal-body label > small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--cream-2);
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--walnut);
  background: var(--paper);
}

textarea { min-height: 80px; resize: vertical; font-family: var(--sans); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--cream-2);
  background: var(--cream);
}

/* ============ DETAIL VIEW ============ */

.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
}

.detail-inspiration h3,
.detail-footage h3 {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 12px;
}

.detail-inspiration .media-frame {
  aspect-ratio: 9 / 16;
  background: var(--navy);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-inspiration .media-frame video,
.detail-inspiration .media-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-inspiration .link-card {
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius);
  margin-top: 12px;
}

.detail-inspiration .link-card a {
  color: var(--navy);
  font-weight: 500;
  word-break: break-all;
  font-size: 13px;
}

.detail-inspiration .notes {
  margin-top: 12px;
  padding: 14px;
  background: var(--cream);
  border-radius: var(--radius);
  border-left: 3px solid var(--walnut);
  font-size: 14px;
  color: var(--ink-2);
  white-space: pre-wrap;
}

.detail-footage .drop-zone {
  border: 2px dashed var(--navy-line);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-2);
  cursor: pointer;
  background: var(--cream);
  transition: all 0.15s ease;
}

.detail-footage .drop-zone:hover,
.detail-footage .drop-zone.dragover {
  border-color: var(--walnut);
  background: var(--cream-2);
  color: var(--ink);
}

.detail-footage .drop-zone .big {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--walnut);
  display: block;
  margin-bottom: 4px;
}

.detail-footage .footage-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.footage-item {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 12px;
  position: relative;
}

.footage-item .thumb {
  aspect-ratio: 1 / 1;
  background: var(--navy);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--walnut-soft);
  font-size: 24px;
  margin-bottom: 6px;
  overflow: hidden;
}

.footage-item .name {
  font-weight: 500;
  word-break: break-all;
  line-height: 1.3;
  color: var(--ink);
}

.footage-item .size {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.footage-item .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(14, 27, 44, 0.85);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.footage-item:hover .remove { opacity: 1; }

.upload-progress {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: var(--radius);
  font-size: 13px;
}

.upload-progress .bar {
  height: 4px;
  background: var(--cream-2);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.upload-progress .fill {
  height: 100%;
  background: var(--walnut);
  transition: width 0.2s ease;
}

.detail-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--cream-2);
  flex-wrap: wrap;
}

.detail-actions .status-switcher {
  display: flex;
  gap: 4px;
  background: var(--cream);
  padding: 4px;
  border-radius: var(--radius);
}

.detail-actions .status-switcher button {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.detail-actions .status-switcher button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============ TOASTS ============ */

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
}

.toast {
  background: var(--navy);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  max-width: 340px;
  animation: toast-in 0.2s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============ FOOTER ============ */

.footer {
  background: var(--navy);
  color: var(--cream-2);
  padding: 20px 0;
  margin-top: 40px;
  font-size: 13px;
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer a { color: var(--walnut-soft); text-decoration: none; }
.footer a:hover { color: var(--cream); }
.muted { color: var(--muted); }

/* ============ RESPONSIVE ============ */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .masthead { padding: 20px 0 24px; }
  .tagline { display: none; }
  .toolbar { gap: 12px; }
  .filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .pill { white-space: nowrap; }
  .counter { display: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .brand-mark { font-size: 32px; }
  .brand-name { font-size: 18px; }
}
