/*
 * GINDI Design Studio (/design-studio/) — templates/core/design_studio.html.
 * Desktop: the image (about 68%) beside the configuration panel (about 32%).
 * Below 64rem: the image above, the panel below. The image always keeps its
 * own proportions (set inline from the style's size): never cropped, nothing
 * laid over it except the thin loading line; "View full image" shows it at
 * full size.
 */

.ds {
  --ds-gold-line: color-mix(in srgb, var(--gindi-gold) 55%, transparent);
}

.ds-container {
  max-width: 120rem;
  padding-inline: clamp(1rem, 0.4rem + 2.4vw, 3rem);
}

/* ---------- Heading ---------- */
.ds-head {
  padding-block: calc(var(--header-h) + clamp(1rem, 0.6rem + 1.4vw, 2rem)) clamp(0.75rem, 0.5rem + 0.8vw, 1.25rem);
}

.ds-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--gindi-gold);
}

.ds-title {
  margin-block-start: 0.5rem;
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 1.5rem + 2.4vw, 3.75rem);
  font-weight: var(--fw-regular);
  line-height: 1.05;
}

.ds-lead {
  max-width: 44rem;
  margin-block-start: 0.625rem;
  color: var(--muted);
  font-size: var(--fs-lead);
}

/* ---------- Layout ---------- */
.ds-studio {
  padding-block: clamp(0.5rem, 0.3rem + 0.6vw, 1rem) clamp(2.5rem, 1.75rem + 3vw, 4.5rem);
}

.ds-grid {
  display: grid;
  grid-template-columns: minmax(0, 68fr) minmax(19rem, 32fr);
  align-items: start;
  gap: clamp(1.25rem, 0.75rem + 1.6vw, 2.5rem);
}

/* The room stays in view while the panel scrolls (tall panels). */
.ds-stage {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.ds-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e9e1d6;
}

.ds-photo,
.ds-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ds-photo[hidden],
.ds-canvas[hidden] {
  display: none;
}

/* A thin line while the image's maps or a stone sample load. */
.ds-studio.is-loading .ds-viewport::after,
.ds-studio.is-loading-material .ds-viewport::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gindi-gold), transparent);
  background-size: 50% 100%;
  animation: ds-bar 1s linear infinite;
}

@keyframes ds-bar {
  from { background-position: -50% 0; }
  to { background-position: 150% 0; }
}

.ds-error {
  margin-block-start: 0.75rem;
  padding: 0.75rem 1rem;
  border-inline-start: 2px solid var(--gindi-gold);
  background: color-mix(in srgb, var(--gindi-gold) 8%, transparent);
  color: var(--fg);
  font-size: var(--fs-small);
}

.ds-error[hidden] {
  display: none;
}

.ds-stage__bar {
  display: flex;
  justify-content: flex-end;
  margin-block-start: 0.25rem;
}

.ds-fullview {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ds-fullview[hidden] {
  display: none;
}

.ds-fullview svg {
  width: 1rem;
  height: 1rem;
}

/* The image at full size: fills the screen; on narrow screens it keeps its
   own width so it can be panned (and pinch-zoomed). */
.ds-full {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #10192b;
}

.ds-full::backdrop {
  background: rgb(16 25 43 / 0.92);
}

.ds-full__scroll {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.ds-full__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100dvh;
}

.ds-full__close {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline-end: 0.75rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgb(200 137 43 / 0.75);
  background: rgb(28 44 74 / 0.85);
  color: var(--gindi-ivory);
  cursor: pointer;
}

.ds-full__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.ds-full__close:focus-visible {
  outline: 2px solid var(--gindi-yellow);
  outline-offset: 2px;
}

@media (max-width: 48rem) and (orientation: portrait) {
  .ds-full__img {
    max-width: none;
    width: 200vw;
    max-height: none;
  }

  .ds-full__scroll {
    place-items: center start;
  }
}

.ds-note {
  margin-block-start: 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.ds-sources {
  white-space: nowrap;
}

/* ---------- Panel ---------- */
.ds-panel {
  display: grid;
  gap: 1.25rem;
}

.ds-panel__label,
.ds-subhead {
  color: var(--muted);
}

.ds-style {
  margin-block-start: -0.75rem;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.375rem);
  font-weight: var(--fw-regular);
  line-height: 1.1;
}

.ds-style__text {
  margin-block-start: -0.5rem;
  color: var(--muted);
}

.ds-presets__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-start: 0.5rem;
}

.ds-preset {
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--navy-15);
  background: transparent;
  color: var(--fg);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.ds-preset:hover {
  border-color: var(--gindi-gold);
}

.ds-preset[aria-pressed="true"] {
  border-color: var(--gindi-navy);
  background: var(--gindi-navy);
  color: var(--gindi-ivory);
}

.ds-preset:focus-visible,
.ds-option:focus-visible,
.ds-link:focus-visible {
  outline: 2px solid var(--gindi-navy);
  outline-offset: 2px;
}

.ds-custom {
  margin-block-start: 0.5rem;
  color: var(--gindi-gold);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
}

.ds-custom[hidden] {
  display: none;
}

.ds-group {
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--ds-gold-line);
}

.ds-group__title {
  font-size: 1rem;
  font-weight: var(--fw-medium);
}

.ds-group__title span {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: var(--fw-regular);
}

.ds-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-block-start: 0.75rem;
}

/* A swatch: a crop of the real scan, its name below; gold when chosen. */
.ds-option {
  display: grid;
  gap: 0.375rem;
  padding: 0.25rem;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.ds-option img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px var(--navy-08);
}

.ds-option__name {
  min-height: calc(2 * 1.3em);
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  line-height: 1.3;
  text-wrap: balance;
}

.ds-option:hover {
  color: var(--gindi-navy);
}

.ds-option[aria-checked="true"] {
  border-color: var(--gindi-gold);
  color: var(--gindi-navy);
}

.ds-group__current {
  margin-block-start: 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.ds-summary {
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--ds-gold-line);
}

.ds-summary__list {
  display: grid;
  gap: 0.375rem;
  margin: 0.625rem 0 0;
}

.ds-summary__list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--fs-small);
}

.ds-summary__list dt {
  color: var(--muted);
}

.ds-summary__list dd {
  margin: 0;
  font-weight: var(--fw-medium);
  text-align: end;
}

.ds-actions {
  display: grid;
  gap: 0.75rem;
  margin-block-start: 1.125rem;
}

.ds-discuss {
  width: 100%;
  gap: 0.625rem;
}

.ds-discuss svg {
  width: 0.875rem;
  height: 0.875rem;
}

[dir="rtl"] .ds-discuss svg {
  transform: scaleX(-1);
}

.ds-actions__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.ds-link {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gindi-navy);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  text-decoration: underline;
  text-decoration-color: var(--ds-gold-line);
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.ds-status {
  min-height: 1.5em;
  margin-block-start: 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* An outlined action (Save design, Discover your style, a second suggestion). */
.ds-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3rem;
  padding: 0.75rem 1.375rem;
  border: 1px solid var(--gindi-navy);
  background: transparent;
  color: var(--gindi-navy);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

:lang(ar) .ds-btn-outline {
  letter-spacing: 0;
  font-size: 1rem;
}

.ds-btn-outline svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

[dir="rtl"] .ds-btn-outline svg {
  transform: scaleX(-1);
}

.ds-btn-outline:hover {
  background: var(--gindi-navy);
  color: var(--gindi-ivory);
}

.ds-btn-outline:focus-visible,
.ds-card__cta:focus-visible {
  outline: 2px solid var(--gindi-navy);
  outline-offset: 3px;
}

.ds-btn-outline:disabled {
  opacity: 0.6;
  cursor: progress;
}

.ds-save {
  width: 100%;
}

[dir="rtl"] .ds-save svg {
  transform: none;
}

/* ---------- Heading: the invitation to the guide ---------- */
.ds-head__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.25rem 3rem;
}

.ds-invite {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
  max-width: 22rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--ds-gold-line);
}

.ds-invite[hidden] {
  display: none;
}

.ds-invite__text {
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.55;
}

.ds-invite__text strong {
  display: block;
  color: var(--fg);
  font-weight: var(--fw-medium);
}

/* ---------- The three styles ---------- */
.ds-styles {
  padding-block: clamp(1rem, 0.6rem + 1.2vw, 1.75rem) clamp(1.25rem, 0.8rem + 1.4vw, 2.25rem);
}

.ds-styles__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
}

.ds-styles__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 1.2rem + 0.9vw, 2rem);
  font-weight: var(--fw-regular);
}

.ds-styles__lead {
  color: var(--muted);
  font-size: var(--fs-small);
}

.ds-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 0.5rem + 0.8vw, 1.5rem);
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.ds-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--navy-08);
  background: color-mix(in srgb, var(--gindi-ivory) 60%, white);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.ds-card:hover {
  border-color: var(--ds-gold-line);
}

.ds-card.is-current {
  border-color: var(--gindi-gold);
  box-shadow: inset 0 -3px 0 var(--gindi-gold);
}

.ds-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.ds-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 0.375rem 1rem;
  padding: 1rem 1.125rem 1.125rem;
}

.ds-card__name {
  grid-column: 1 / -1;
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.625rem);
  font-weight: var(--fw-regular);
  line-height: 1.15;
}

.ds-card__text {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* The whole card is the link's target area. */
.ds-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-block-start: 0.25rem;
  color: var(--gindi-navy);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  text-decoration: underline;
  text-decoration-color: var(--ds-gold-line);
  text-underline-offset: 0.3em;
}

.ds-card__cta::after {
  content: "";
  position: absolute;
  inset: 0;
}

.ds-card__cta svg {
  width: 0.875rem;
  height: 0.875rem;
}

[dir="rtl"] .ds-card__cta svg {
  transform: scaleX(-1);
}

.ds-card__current {
  align-self: center;
  justify-self: end;
  margin-block-start: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: var(--gindi-navy);
  color: var(--gindi-ivory);
  font-size: 0.75rem;
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
}

.ds-card__current[hidden] {
  display: none;
}

.ds-studio {
  scroll-margin-block-start: var(--header-h);
}

.ds-studio:focus {
  outline: none;
}

.ds-style:focus {
  outline: none;
}

.ds-panel[hidden] {
  display: none;
}

/* ---------- Discover your style (a dialog) ---------- */
html:has(.ds-quiz[open]) {
  overflow: hidden;
}

.ds-quiz {
  width: min(58rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  background: var(--gindi-ivory);
  color: var(--gindi-navy);
  box-shadow: 0 1.5rem 4rem rgb(28 44 74 / 0.28);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ds-quiz::backdrop {
  background: rgb(28 44 74 / 0.6);
}

.ds-quiz[open] {
  animation: ds-quiz-in 280ms var(--ease-out);
}

@keyframes ds-quiz-in {
  from { opacity: 0; transform: translateY(0.75rem); }
}

.ds-quiz__inner {
  padding: clamp(1rem, 0.6rem + 1.4vw, 2rem);
}

.ds-quiz__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ds-quiz__title {
  color: var(--gindi-gold);
}

.ds-quiz__close {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-inline-end: -0.625rem;
  border: 0;
  background: none;
  color: var(--gindi-navy);
  cursor: pointer;
}

.ds-quiz__close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.ds-quiz__close:focus-visible,
.ds-quiz__answer:focus-visible,
.ds-quiz .ds-link:focus-visible {
  outline: 2px solid var(--gindi-navy);
  outline-offset: 2px;
}

.ds-quiz__body {
  display: grid;
  gap: 1rem;
  margin-block-start: 0.75rem;
}

.ds-quiz__progress {
  display: grid;
  gap: 0.5rem;
}

.ds-quiz__step {
  color: var(--muted);
  font-size: 0.8125rem;
}

.ds-quiz__bar {
  height: 2px;
  background: var(--navy-08);
}

.ds-quiz__bar span {
  display: block;
  height: 100%;
  background: var(--gindi-gold);
  transition: inline-size var(--dur-base) var(--ease-out);
}

.ds-quiz__intro {
  color: var(--muted);
  font-size: var(--fs-small);
}

.ds-quiz__question,
.ds-quiz__result {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 1.15rem + 1.1vw, 2.25rem);
  font-weight: var(--fw-regular);
  line-height: 1.15;
}

.ds-quiz__question:focus,
.ds-quiz__result:focus {
  outline: none;
}

.ds-quiz__answers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.ds-quiz__answer {
  display: grid;
  gap: 0.5rem;
  padding: 0.375rem;
  border: 1px solid var(--navy-08);
  background: color-mix(in srgb, var(--gindi-ivory) 50%, white);
  color: var(--gindi-navy);
  text-align: start;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.ds-quiz__answer:hover,
.ds-quiz__answer[aria-pressed="true"] {
  border-color: var(--gindi-gold);
}

.ds-quiz__img {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #e9e1d6;
}

.ds-quiz__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ds-quiz__img.is-swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ds-quiz__label {
  padding: 0.125rem 0.25rem 0.25rem;
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
}

.ds-quiz__nav {
  min-height: 2.75rem;
}

.ds-quiz__eyebrow {
  color: var(--gindi-gold);
}

.ds-quiz__result {
  margin-block-start: -0.5rem;
}

.ds-quiz__preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 44vh;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.ds-quiz__text,
.ds-quiz__why {
  color: var(--muted);
}

.ds-quiz__why {
  color: var(--gindi-navy);
}

.ds-quiz__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.ds-quiz__also {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  color: var(--muted);
  font-size: var(--fs-small);
}

.ds-quiz__disclaimer {
  padding-block-start: 0.875rem;
  border-block-start: 1px solid var(--ds-gold-line);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ---------- Tablet and phone ---------- */
@media (max-width: 64rem) {
  .ds-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ds-stage {
    position: static;
  }

  .ds-head__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ds-cards {
    grid-template-columns: repeat(3, minmax(15rem, 1fr));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-block-end: 0.5rem;
  }

  .ds-card {
    scroll-snap-align: start;
  }
}

@media (max-width: 40rem) {
  .ds-cards {
    grid-template-columns: repeat(3, 78%);
  }

  /* Phones: the guide fills the screen; answers stack as rows (image beside label). */
  .ds-quiz {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
  }

  .ds-quiz__answers {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .ds-quiz__answer {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.875rem;
  }

  .ds-quiz__actions .btn {
    width: 100%;
  }
}

@media (max-width: 30rem) {
  .ds-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ds-studio.is-loading .ds-viewport::after,
  .ds-studio.is-loading-material .ds-viewport::after,
  .ds-quiz[open] {
    animation: none;
  }
}
