/**
 * Single Door Style (single-door-styles.php) — post_type "door-styles",
 * public URL /door/{slug}/. Masthead (gray bar, centered title) reuses
 * single-room.css's .room-header-bar/.room-header-title, same convention as
 * single-combinations.css — see functions.php's medallion_enqueue_assets().
 */

:root {
	/* The "you've picked this one" indicator on a Material/Color swatch —
	   a plain 1px border with room around it so the stroke doesn't touch
	   the swatch image/label, per chat. One variable so both the
	   border color and the gap are easy to retune later. */
	--door-selected-border: #1a1a1a;
	--door-selected-gap: 10px;
}

.single-door-style {
	margin-bottom: var( --blockSpace, 4rem );
}

/* ---- Optional full-width hero photo ----
   Not every Door Style has one — see has_post_thumbnail() check in
   single-door-styles.php. Full-bleed, no fixed aspect-ratio crop; it just
   scales down proportionally at any width, per chat ("fullwidth, and scale"). */

.door-hero {
	width: 100%;
	line-height: 0;
}

.door-hero-image {
	display: block;
	width: 100%;
	height: auto;
}

/* ---- Two-column layout ----
   Mobile: single column, sidebar (photo + Door Details) stacks above the
   Materials/Colors/Finishes column, nothing sticks (there's no "taller
   sibling" for it to stick alongside).

   Desktop (>=900px): sidebar sticks via plain CSS position:sticky, no JS.
   Because .door-sidebar is a grid item inside .door-layout, sticky
   positioning is automatically bounded by the GRID ROW's height — which is
   as tall as its tallest sibling, i.e. .door-content (Materials + Colors +
   Finishes, usually much taller). That's what makes it "stick on scroll
   until the bottom of the content is reached, then scroll with the rest of
   the page" without a scroll-listener: the browser handles the "let go at
   the bottom" part on its own once .door-sidebar's own bottom edge reaches
   the bottom of that shared row. */

.door-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2.5rem;
	max-width: 1320px;
	margin: 0 auto;
	padding: 2rem 1.5rem 4rem;
	align-items: start;
}

@media ( min-width: 900px ) {
	.door-layout {
		grid-template-columns: minmax( 260px, 600px ) 1fr;
		gap: 3rem;
		padding: 2rem 3rem 5rem;
	}

	.door-sidebar {
		position: sticky;
		top: 2rem;
	}
}

.door-sidebar {
	display: flex;
	flex-direction: column;
  padding-top: 2rem;
}

/* ---- Main preview photo + "Now Showing" caption ----
   Swapped by assets/js/single-door-styles.js whenever a Material swatch is
   clicked — same "swap an existing <img>'s src, drop any stale
   srcset/sizes" mechanism as assets/js/solution-gallery.js's .sg-thumb. */

.door-preview {
  border: 1px solid #cacaca;
  padding: 5rem;
  margin-bottom: 1rem;
}

/* The Multi-Piece/Slab tabs add their own height below the photo, so the
   bottom padding tightens up when they're actually showing. */
.door-preview:has( .door-preview-construction-tabs:not([hidden]) ) {
  padding-bottom: 2rem;
}

/* The preview photo's Image Modal trigger (inc/image-modal.php) — reset
   away the default <button> chrome so it's invisible except for the
   "click to enlarge" cursor; assets/js/single-door-styles.js keeps its
   data-modal-full/data-modal-alt (and disabled state) synced to whichever
   Material's photo is currently showing. */
.door-preview-trigger {
	display: block;
	width: 100%;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	font: inherit;
	cursor: zoom-in;
}

.door-preview-trigger:disabled {
	cursor: default;
}

/* ---- Optional "Multi-Piece"/"Slab" construction tabs ----
   Only shown when the CURRENTLY selected Material actually has both (see
   single-door-styles.php's doc comment) — hidden via the plain `hidden`
   attribute the rest of this template already uses for "in the DOM, just
   not shown right now" (assets/js/single-door-styles.js toggles it on
   every Material click), same reasoning as .door-preview-caption.

   The explicit [hidden] override right below is NOT decorative — without
   it, this element's own `display: flex` (same specificity as the browser
   default `[hidden] { display: none }` rule, but coming later in the
   cascade) would win and the tabs would stay visible — including the
   button for whichever construction's checkbox is actually unchecked —
   no matter what the `hidden` attribute says. .door-preview-caption and
   .door-preview-construction-note don't need this because neither of them
   sets its own `display` at all. */

.door-preview-construction-tabs {
	display: flex;
	gap: 0.5rem;
	margin-top: 1.75rem;
}

.door-preview-construction-tabs[hidden] {
	display: none;
}

.door-preview-construction-tab {
	background: none;
	border: 1px solid #cacaca;
	padding: 0.4rem 0.9rem;
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 0.75rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: inherit;
	cursor: pointer;
	border-radius: 2px;
}

.door-preview-construction-tab.is-selected {
	border-color: var( --door-selected-border );
	background: var( --door-selected-border );
	color: #ffffff;
}

.door-preview-image {
	display: block;
	width: 100%;
	height: auto;
	background: #f0f0f0;
}

/* Same [hidden]-gets-overridden-by-this-element's-own-`display` issue as
   .door-preview-construction-tabs above — assets/js/single-door-styles.js's
   applyPreview() sets this element's `hidden` property when a photo has no
   url at all, and without this override that would silently do nothing. In
   practice this should now be rare (medallion_get_door_style_slab_image()
   falls back to a generic photo rather than an empty url), but it's cheap
   insurance against the exact same bug class showing up here too. */
.door-preview-image[hidden] {
	display: none;
}

.door-caption {

  margin-bottom: 2rem;

  & .door-preview-caption {
    margin: 0.85rem 0 0;
    font-family: var( --font-primary );
    font-weight: var( --font-weight-medium );
    font-style: normal;
    font-size: 0.8rem;
    color: #333333;
  }

  /* Per chat: "Available in Slab or Multi-Piece Drawer Construction" —
     only shown alongside the construction tabs above (same `hidden`
     toggle), so it's styled as a quieter, secondary note under "Now
     Showing" rather than competing with it. */
  & .door-preview-construction-note {
    margin: 0.5rem 0 0;
    font-family: var( --font-primary );
    font-weight: var( --font-weight-regular );
    font-style: italic;
    font-size: 0.75rem;
    color: #666666;
  }
}
/* ---- Door Details (the post's own editor content) ---- */

.door-details-heading {
	margin: 0 0 0.85rem;
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 1.625rem;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

.door-details-body {
	font-size: 1rem;
	line-height: 1.6;
	color: #333333;
}

.door-details-body ul {
	margin: 0;
	padding-left: 1.1em;
}

.door-details-body p:first-child {
	margin-top: 0;
}

/* ---- Shared section heading style (Available Materials / Colors / Finishes) ---- */

.door-section-heading {
	margin: 0 0 1.25rem;
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 1.625rem;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}


.door-content {
  padding-top: 2rem;
}


.door-content > section + section {
	margin-top: 3rem;
}

/* ---- Available Materials ---- */

.door-materials-grid {
	/*
  display: grid;
	grid-template-columns: repeat( 2, 1fr );
	*/
  gap: 1.5rem 0rem;
  display: flex;
  flex-wrap: wrap;
}





.door-material-item {
  flex-basis: 50%;
  display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	background: none;
	border: 1px solid transparent;
	padding: var( --door-selected-gap );
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: center;
	border-radius: 2px;
}


@media ( min-width: 500px  ) {
	.door-materials-grid {
		/*grid-template-columns: repeat( 4, 1fr );*/
	}
  .door-material-item {
    flex-basis: 33.3333%;
  }
}
@media ( min-width: 768px ) {
  .door-material-item {
    flex-basis: 25%;
  }
}
@media ( min-width: 900px ) {
  .door-material-item {
    flex-basis: 50%;
  }
}
@media ( min-width: 1200px ) {
  .door-material-item {
    flex-basis: 33.33333%;
  }
}
@media ( min-width: 1420px ) {
  .door-material-item {
    flex-basis: 25%;
  }
}



.door-material-item.is-selected {
	border-color: var( --door-selected-border );
}

.door-material-media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var( --room-line, #e0e0e0 );
	border-radius: 2px;
}

.door-material-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.door-material-label {
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 0.8rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

/* ---- Colors ----
   A toggle, not a plain single-select: clicking the already-selected color
   clears it again (assets/js/single-door-styles.js), with a small "x"
   overlaid on the swatch as an explicit "clear" affordance — clicking the
   x IS clicking the button (it's nested inside, no separate handler
   needed), so it triggers that exact same clear behavior. */

.door-colors-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem 5% /*1.125rem*/;
}

.door-color-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	font: inherit;
	color: inherit;
	width: 14% /*5.5rem*/;
}

.door-color-swatch-wrap {
	position: relative;
	display: inline-flex;
	padding: 10% /*var( --door-selected-gap )*/;
	border: 1px solid transparent;
	border-radius: 50%;
}

.door-color-item.is-selected .door-color-swatch-wrap {
	border-color: var( --door-selected-border );
}

.door-color-swatch {
	display: block;
	width: 100% /* 5rem */;
	height: auto /* 5rem */;
	border-radius: 50%;
  box-shadow: 0px 1px 2px rgba(0,0,0,0.5);
	overflow: hidden;
	background: var( --room-line, #e0e0e0 );
}

.door-color-swatch img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.door-color-clear {
	display: none;
	position: absolute;
	top: -2px;
	right: 14px;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	background: var( --door-selected-border );
	color: #ffffff;
	font-size: 0.75rem;
	line-height: 1.1rem;
	text-align: center;
	pointer-events: none; /* purely visual — the whole button is already the click target */
}

.door-color-item.is-selected .door-color-clear {
	display: block;
}

.door-color-label {
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 0.75rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	text-align: center;
}

/* ---- Finishes ---- */

.door-finish-group + .door-finish-group {
	margin-top: 2rem;
}

.door-finish-group.is-empty {
	display: none;
}

.door-finish-group-heading {
	margin: 0 0 1rem;
	font-family: var( --font-primary );
	font-weight: var( --font-weight-bold );
	font-style: normal;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #333333;
}

.door-finish-grid {
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 1.5rem 1rem;
}

@media ( min-width: 600px ) {
	.door-finish-grid {
		grid-template-columns: repeat( 4, 1fr );
	}
}

.door-finish-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	text-decoration: none;
	color: inherit;
	text-align: center;
	opacity: 1;
	transition: opacity 0.2s;
}

.door-finish-media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var( --room-line, #e0e0e0 );
	border-radius: 2px;
}

.door-finish-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.door-finish-label {
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 0.8rem;
	letter-spacing: 0.02em;
}

/* Unavailable for the currently-selected Material — dimmed, name
   italicized, not clickable/keyboard-focusable (per chat: "dim to 40%
   opacity, and the term italicizes and are disabled from selection"). */
.door-finish-item.is-unavailable {
	opacity: 0.4;
	pointer-events: none;
}

.door-finish-item.is-unavailable .door-finish-label {
	font-style: italic;
}

/* Hidden entirely by the Colors filter — a stronger cut than the Material
   dimming above, since a color mismatch isn't "still an option, just not
   right now", it's "not part of what you asked to see". */
.door-finish-item.is-hidden {
	display: none;
}

/* ---- Get Inspired ----
 * Rooms that feature this Door Style (medallion_get_rooms_featuring_
 * door_style(), inc/door-styles.php) — meant to echo the Room Gallery's
 * own .room-card look (page-templates/template-room-gallery.php), just
 * smaller and always 2-up rather than that page's wider grid, per chat.
 *
 * NOTE: this is a reasonable first pass built from this theme's own
 * existing patterns (same media-box + caption shape as .door-finish-item
 * above), NOT yet checked against the Room Gallery's actual CSS — still
 * waiting on that file (whatever styles .room-card/.room-grid/.room-card-
 * media/.room-card-caption) to true this up to match it exactly.
 */

.door-inspired-grid {
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 1.5rem 1rem;
}

.door-inspired-card {
	display: block;
	text-decoration: none;
	color: inherit;
}

.door-inspired-media {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var( --room-line, #e0e0e0 );
	border-radius: 2px;
}

.door-inspired-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.door-inspired-caption {
	margin: 0.5rem 0 0;
	font-family: var( --font-primary );
	font-weight: var( --font-weight-regular );
	font-style: normal;
	font-size: 0.8rem;
	line-height: 1.5;
	color: #333333;
}

.door-inspired-name {
	font-weight: var( --font-weight-medium );
}