/* === THEME AND PAGE FOUNDATION === */
:root {
  --wine: #87171d;
  --line: #ef9cab;
  --ink: #7b2737;
}

body {
  font-family: Georgia, "Times New Roman", serif;
}

/* === PAGE SHELL === */
.closet-shell,
.admin-shell {
  width: min(calc(100% - 32px), 760px);
  min-height: 100vh;
  margin: auto;
  padding: 28px 16px 34px;
  display: flex;
  flex-direction: column;
}

/* === PAGE HEADER === */
.closet-header {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding-left: 8px;
}

.header-rule {
  flex: 1;
  height: 9px;
  background: linear-gradient(
    to bottom,
    #b92f51 0 3px,
    transparent 3px 6px,
    #b92f51 6px 9px
  );
}

.closet-header h1 {
  margin: 0;
  color: #b92f51;
  font: italic 700 32px/1 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 1px rgba(135, 23, 29, 0.14);
}

.closet-header img {
  display: block;
  width: 60px;
  height: 72px;
  object-fit: contain;
  transform: translateY(-8px) rotate(5deg);
}

/* === CATALOG LAYOUT AND SIDEBAR === */
.closet-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  flex: 1;
}

.closet-sidebar {
  align-self: start;
  padding: 18px 22px 20px;
  border: 4px double #b92f51;
  text-align: center;
}

/* === CATEGORY NAVIGATION === */
.category-rose {
  display: block;
  width: min(100%, 130px);
  height: auto;
  margin: 0 auto 8px;
}

.category-nav { display: grid; gap: 5px; }

.category-nav a {
  padding: 1px 0;
  color: #87171d;
  font: italic 700 17px/1.15 Georgia, "Times New Roman", serif;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(135, 23, 29, 0.14);
  text-align: left;
}

.category-nav a:hover,
.category-nav a:focus-visible {
  color: #b92f51;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.category-nav a.active {
  color: #b92f51;
  text-decoration: none;
}

.category-nav a[hidden] { display: none; }

.category-toggle {
  display: block;
  margin-top: 5px;
  padding: 1px 0;
  border: 0;
  color: #87171d;
  background: transparent;
  font: italic 700 17px/1.15 Georgia, "Times New Roman", serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  text-align: left;
}

.category-toggle:hover,
.category-toggle:focus-visible {
  color: #b92f51;
}

/* === CATALOG FILTERS === */
.sort-filters {
  margin-top: 14px;
  border-top: 2px dotted #efc4cb;
  text-align: left;
}

.filter-group {
  border-bottom: 1px solid #efc4cb;
}

.filter-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  color: #87171d;
  font: 700 13px/1.2 Georgia, "Times New Roman", serif;
  list-style: none;
  cursor: pointer;
}

.filter-group summary::-webkit-details-marker { display: none; }

.filter-group summary::after {
  content: "+";
  font: 700 13px/1 Georgia, "Times New Roman", serif;
}

.filter-group[open] summary::after { content: "−"; }

.filter-options {
  display: grid;
  gap: 2px;
  padding: 0 0 8px;
}

.filter-options a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  color: #7d5960;
  font-size: 11px;
  text-decoration: none;
}

.filter-options a::before {
  display: grid;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  place-items: center;
  border: 1px solid #b8a3a7;
  color: #b92f51;
  background: #fff;
  content: "";
  font: 700 10px/1 Arial, Helvetica, sans-serif;
}

.filter-options a:hover,
.filter-options a:focus-visible,
.filter-options a.active {
  color: #87171d;
}

.filter-options a.active::before { content: "✓"; }

.filter-empty {
  padding: 3px 0 5px;
  color: #a98b91;
  font: italic 10px/1.3 Georgia, "Times New Roman", serif;
}

.clear-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: #87171d;
  font: 400 11px/1.2 Georgia, "Times New Roman", serif;
  text-decoration: none;
}

.clear-filters span {
  width: 11px;
  height: 11px;
  border: 1px solid #b92f51;
  background: #fff;
}

.return-home-divider {
  width: 100%;
  margin-top: 14px;
  border-top: 2px dotted #efc4cb;
}

.return-home {
  width: 120px;
  min-height: 48px;
  display: grid;
  place-items: center;
  margin: 12px auto 0;
  color: #fff;
  font: italic 700 15px/1 Georgia, "Times New Roman", serif;
  text-decoration: none;
}

.return-home:link,
.return-home:visited,
.return-home:hover,
.return-home:focus-visible {
  color: #fff;
}

/* === CATALOG SUMMARY AND OUTFIT CARDS === */
.catalog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 30px;
  margin-bottom: 22px;
  padding: 4px 14px;
  background: var(--rose-pale);
}

.catalog-bar h2,
.catalog-bar p { margin: 0; }
.catalog-bar h2 { font: 400 16px/1.2 "Times New Roman", Times, serif; }
.catalog-bar p { font-size: 12px; }

.outfit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 34px 10px;
}

.outfit-card { min-width: 0; text-align: center; }

.outfit-photo {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffafa;
}

.outfit-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.outfit-photo:hover img { transform: scale(1.025); }
.outfit-card h3 { margin: 8px 0 2px; font-size: 14px; font-weight: 400; line-height: 1.2; }
.outfit-card h3 a { text-decoration: none; }
.outfit-card p { margin: 1px 0; font-size: 12px; line-height: 1.2; }

.empty-closet { padding: 100px 20px; text-align: center; }
.empty-closet p { margin: 8px 0; }
.empty-closet a { font-size: 13px; }

/* === OUTFIT DETAIL AND IMAGE GALLERY === */
.detail-page .closet-header { margin-bottom: 2px; }
.back-link { display: inline-block; margin-top: 12px; color: var(--wine); font-size: 12px; font-style: italic; }
.outfit-detail { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); align-items: start; gap: 24px; }
.detail-media { min-width: 0; }
.detail-image { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); background: #fffafa; }
.detail-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.detail-thumbnails { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.gallery-thumbnail { display: block; min-width: 0; aspect-ratio: 1; overflow: hidden; padding: 0; border: 1px solid #efc4cb; border-radius: 0; background: #fff; cursor: pointer; }
.gallery-thumbnail.active { border-color: #87171d; }
.gallery-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbnail:hover,
.gallery-thumbnail:focus-visible { border-color: #b92f51; outline: 1px solid #b92f51; outline-offset: 1px; }

/* === LIGHTBOX CSS === */
.mfp-bg.closet-lightbox { background: #000; }
.closet-lightbox .mfp-title { color: #fff; font-family: "Times New Roman", Times, serif; }
.closet-lightbox .mfp-counter { color: #fff; font-family: "Times New Roman", Times, serif; }

/* CONTROL GROUP POSITION AND SPACING
   - Change top to move both buttons vertically.
   - Change right to move both buttons horizontally.
   - Add gap: 4px (or another value) to change the space between them. */
.closet-lightbox .mfp-controls { position: absolute; z-index: 1047; top: -20px; right: 0; display: flex; align-items: center; height: 30px; }

.closet-lightbox .mfp-image-holder .mfp-controls .mfp-close,
.closet-lightbox .mfp-controls .mfp-reset { position: static; display: flex; align-items: center; justify-content: center; width: 24px; height: 30px; padding: 0; border: 0; border-radius: 0; color: #fff; background: transparent; box-shadow: none; text-shadow: none; text-align: center; opacity: 1; cursor: pointer; }

.closet-lightbox .mfp-controls .mfp-reset { order: 1; }
.closet-lightbox .mfp-image-holder .mfp-controls .mfp-close { order: 2; }
.closet-lightbox .mfp-image-holder .mfp-controls .mfp-close { font: 29px/1 Arial, sans-serif; transform: translate(6px, -6px); }

.closet-lightbox .mfp-controls .mfp-reset img { display: block; width: 13px; height: 15px; object-fit: contain; transform: translate(10px, -7px); pointer-events: none; }
.closet-lightbox .mfp-reset:hover,
.closet-lightbox .mfp-reset:focus-visible { opacity: .75; }
body.mfp-zoom-out-cur { cursor: default; }
.closet-lightbox .mfp-panzoom-stage { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; overflow: hidden; line-height: 0; touch-action: none; user-select: none; }
body.mfp-zoom-out-cur .closet-lightbox .mfp-panzoom-stage { cursor: zoom-in; }
body.mfp-zoom-out-cur .closet-lightbox .mfp-panzoom-stage.is-zoomed { cursor: grab; }
body.mfp-zoom-out-cur .closet-lightbox .mfp-panzoom-stage.is-dragging { cursor: grabbing; }
.closet-lightbox .mfp-panzoom-stage img.mfp-img { max-height: calc(100vh - 100px) !important; padding: 0; transform-origin: center; transition: transform 100ms ease; will-change: transform; }
.closet-lightbox .mfp-panzoom-stage.is-dragging img.mfp-img { transition: none; }
.closet-lightbox .mfp-bottom-bar { position: relative; top: auto; margin-top: 8px; }
.closet-lightbox .mfp-content { max-width: calc(100vw - 88px); }
.closet-lightbox .mfp-figure { position: relative; }
.closet-lightbox .mfp-figure > .mfp-arrow { z-index: 2; top: 50%; width: 54px; height: 86px; margin-top: -43px; opacity: 1; }
.closet-lightbox .mfp-figure > .mfp-arrow-left { left: -54px; }
.closet-lightbox .mfp-figure > .mfp-arrow-right { right: -54px; }
.closet-lightbox .mfp-figure > .mfp-arrow-left::after { left: 17px; margin-left: 0; }
.closet-lightbox .mfp-figure > .mfp-arrow-right::after { right: 17px; left: auto; margin-left: 0; }
.closet-lightbox .mfp-arrow::before { display: none; }
.mfp-fade.mfp-bg { opacity: 0; transition: opacity 180ms ease; }
.mfp-fade.mfp-bg.mfp-ready { opacity: .94; }
.mfp-fade.mfp-bg.mfp-removing { opacity: 0; }
.mfp-fade.mfp-wrap .mfp-content { opacity: 0; transition: opacity 180ms ease; }
.mfp-fade.mfp-wrap.mfp-ready .mfp-content { opacity: 1; }
.mfp-fade.mfp-wrap.mfp-removing .mfp-content { opacity: 0; }
/* === END LIGHTBOX CSS === */

/* === OUTFIT INFORMATION === */
.detail-copy { min-width: 0; }
.detail-heading-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.eyebrow { margin: 0; color: #b67583; font: italic 13px/1.2 Georgia, serif; letter-spacing: .08em; text-transform: uppercase; }
.detail-edit { flex: none; margin-left: auto; color: var(--wine); font-size: 12px; font-style: italic; }
.detail-copy h1 { margin: 0 0 22px; color: var(--wine); font-size: 23px; font-weight: 400; line-height: 1.1; }
.detail-copy dl { margin: 0; border-top: 2px dotted #efc4cb; }
.detail-copy dl div { display: grid; grid-template-columns: 112px minmax(0, 1fr); padding: 9px 0; border-bottom: 2px dotted #efc4cb; }
.detail-copy dt { color: var(--ink); }
.detail-copy dd { margin: 0; color: #984657; }
.description { color: #984657; font-size: 16px; line-height: 1.65; }
.notes-section { display: flex; align-items: baseline; gap: 6px; margin-top: 12px; }
.notes-section h2 { flex: none; margin: 0; color: var(--ink); font: 700 16px/1.2 "Times New Roman", Times, serif; }

/* === ADMIN AND LOGIN FORMS === */
.form-card { padding: 18px; border: 4px double #b92f51; background: #fff; }
.form-card h2 { color: var(--wine); font-weight: 400; }
.form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 7px 10px;
  color: #b92f51;
  background: #f7e1e3;
}
.form-heading h2 {
  margin: 0;
  color: #b92f51;
  font: 400 16px/1.2 "Times New Roman", Times, serif;
}
.form-heading-links { display: flex; align-items: center; justify-content: flex-end; }
.form-heading-links .footer-diamond { font-size: .42em; }
.form-heading a {
  color: #87171d;
  font-size: 11px;
  text-decoration: none;
}
.form-heading a:hover,
.form-heading a:focus-visible { text-decoration: underline; text-underline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-card label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; }
.form-card input, .form-card select, .form-card textarea { width: 100%; padding: 8px 9px; border: 1px solid #efc4cb; border-radius: 0; color: #52151e; background: #fff; font: 13px/1.4 "Times New Roman", Times, serif; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus { outline: 2px solid #efb7c1; outline-offset: 1px; }
.form-card small { color: #9a6b74; }
/* === ADMIN IMAGE UPLOAD PREVIEWS === */
.image-field { display: grid; gap: 6px; }
.image-upload-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 4px; }
.upload-preview-item { position: relative; display: grid; gap: 3px; min-width: 0; color: #9a6b74; font-size: 10px; text-align: center; }
.upload-preview-item[hidden] { display: none; }
.admin-preview-link { display: block; line-height: 0; }
.upload-preview-item img { display: block; width: 100%; aspect-ratio: 1; border: 1px solid #efc4cb; object-fit: cover; }
.form-card .upload-preview-remove { position: absolute; z-index: 2; top: 5px; right: 5px; display: inline-flex; align-items: center; justify-content: center; width: 25px; min-width: 25px; height: 25px; padding: 0; border: 1px solid #dca3ae; border-radius: 0; color: #87171d; background: #fffafa; box-shadow: none; font: 700 20px/1 Arial, sans-serif; cursor: pointer; }
.form-card .upload-preview-remove:hover,
.form-card .upload-preview-remove:focus-visible { background: #f7e1e3; outline: none; }
.admin-preview-link:hover img,
.admin-preview-link:focus-visible img { border-color: #b92f51; outline: 1px solid #b92f51; outline-offset: 1px; }
.form-card .image-caption-input { padding: 5px 6px; font-size: 11px; }
.new-preview img { border-color: #b92f51; }
.span-two { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.primary-button { padding: 8px 18px; border: 0; color: #fff; background: var(--wine); font: italic 13px Georgia, serif; cursor: pointer; }
.primary-button:hover { background: var(--rose); }
.form-error, .form-notice { padding: 10px 12px; background: #fde6e9; color: #8a0c18; }
.form-notice { background: #eef7ee; color: #426642; }
.form-notice a { color: inherit; font-weight: 700; text-underline-offset: 2px; }
.login-shell .login-card { width: min(100%, 380px); margin: 36px auto auto; }
.login-card > p { margin: 0 0 16px; color: #b92f51; font-size: 13px; }
.login-card form { display: grid; gap: 16px; }
/* === ADMIN POST MANAGEMENT === */
.manage-section { margin-top: 42px; }
.manage-section > h2 { margin: 0 0 14px; padding: 7px 10px; color: #b92f51; background: #f7e1e3; font: 400 16px/1.2 "Times New Roman", Times, serif; }
.manage-section > h2 span { color: #ba7e89; font-size: 15px; }
.muted { color: #9a6b74; }
.manage-grid { display: grid; gap: 10px; }
.manage-card { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 16px; padding: 9px; border: 1px solid #efd0d6; background: #fff; }
.manage-card img { width: 64px; height: 64px; object-fit: cover; }
.manage-card h3 { margin: 0; color: var(--wine); font-size: 16px; font-weight: 400; }
.manage-card p { margin: 4px 0 0; font-size: 12px; }
.manage-actions { display: flex; gap: 12px; align-items: center; }
.manage-actions button { padding: 0; border: 0; color: #b02434; background: none; font: inherit; text-decoration: underline; cursor: pointer; }

/* === FOOTER === */
.closet-footer {
  margin: 30px 0 0;
}

/* === RESPONSIVE: TABLETS AND SMALL SCREENS === */
@media (max-width: 620px) {
  .closet-shell,
  .admin-shell { width: min(calc(100% - 24px), 560px); padding: 22px 18px 32px; }
  .closet-layout { grid-template-columns: 1fr; gap: 24px; }
  .category-nav { grid-template-columns: repeat(3, 1fr); }
  .outfit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
  .outfit-detail { grid-template-columns: 1fr; gap: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .image-upload-preview { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
}

/* === RESPONSIVE: PHONES === */
@media (max-width: 430px) {
  .category-nav { grid-template-columns: repeat(2, 1fr); }
  .catalog-bar { align-items: flex-start; flex-direction: column; }
  .form-card { padding: 20px; }
  .manage-card { grid-template-columns: 54px 1fr; }
  .manage-card img { width: 54px; height: 54px; }
  .manage-actions { grid-column: 2; }
}
