:root {
  --ink: #17130e;
  --dark: #1c1812;
  --paper: #fbf8f2;
  --white: #fffdf9;
  --oak: #b08d57;
  --oak-dark: #8f6f3f;
  --muted: #756d62;
  --hairline: #ded5c7;
  --surface-muted: hsl(39 29% 91%);
  --body-strong: hsl(31 11% 28%);
  --header-height: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}

body.dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.catalog-container {
  width: min(1240px, calc(100% - 3rem));
  margin-inline: auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.catalog-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: var(--header-height);
  color: var(--white);
  background: rgba(23, 19, 14, 0.97);
  border-bottom: 1px solid rgba(176, 141, 87, 0.32);
}

.header-inner {
  width: min(1320px, calc(100% - 2.5rem));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: clamp(1.4rem, 3vw, 3rem);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.brand {
  flex: 0 0 auto;
}

.brand img {
  width: clamp(156px, 14.3vw, 195px);
}

.catalog-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2.4vw, 2.5rem);
  margin-left: auto;
}

.catalog-nav a {
  position: relative;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.catalog-nav a::after {
  position: absolute;
  right: 0;
  bottom: -0.45rem;
  left: 0;
  height: 1px;
  content: "";
  background: var(--oak);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.catalog-nav a:hover::after,
.catalog-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.header-cta,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-height: 46px;
  padding: 0.85rem 1.4rem;
  color: var(--white);
  background: var(--oak);
  border: 1px solid var(--oak);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color 220ms ease, background 220ms ease, border-color 220ms ease;
}

.header-cta:hover,
.primary-button:hover {
  color: var(--white);
  background: var(--oak-dark);
  border-color: var(--oak-dark);
}

.catalog-hero {
  padding: clamp(4.5rem, 8vw, 7.5rem) 0 clamp(2.8rem, 5vw, 4.5rem);
  color: var(--white);
  background: var(--dark);
  border-bottom: 1px solid rgba(176, 141, 87, 0.34);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: clamp(2.5rem, 5vw, 5rem);
  color: #c7bfb3;
  font-size: 0.78rem;
  transition: color 200ms ease;
}

.back-link:hover {
  color: var(--oak);
}

.hero-copy {
  max-width: 850px;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--oak);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 300;
  line-height: 1.08;
}

h1 {
  max-width: 14ch;
  font-size: clamp(2.8rem, 7vw, 6.2rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.6rem);
}

h2 em {
  color: var(--oak);
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
}

.hero-copy > p:last-child {
  max-width: 67ch;
  margin: 1.5rem 0 0;
  color: #c7bfb3;
  font-size: clamp(0.96rem, 1.4vw, 1.08rem);
}

.category-tabs {
  display: flex;
  gap: 0;
  margin-top: clamp(3rem, 6vw, 5rem);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.category-tabs a {
  flex: 1;
  padding: 1.1rem 1.25rem;
  color: #c7bfb3;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
  transition: color 200ms ease, background 200ms ease;
}

.category-tabs a:last-child {
  border-right: 0;
}

.category-tabs a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

.category-tabs a.is-active {
  color: var(--dark);
  background: var(--oak);
}

.models-section {
  padding: clamp(4.5rem, 8vw, 8rem) 0;
}

.models-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.models-meta h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

#modelCount {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.4rem, 2.7vw, 2.5rem);
}

.model-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: var(--white);
  border: 1px solid var(--hairline);
  font: inherit;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(18px);
  animation: card-in 560ms ease forwards;
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.model-card:hover {
  border-color: rgba(176, 141, 87, 0.7);
  box-shadow: 0 16px 44px rgba(23, 19, 14, 0.08);
  transform: translateY(-4px);
}

.model-card:focus-visible {
  outline: 2px solid var(--oak);
  outline-offset: 4px;
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.model-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--hairline);
}

.model-image img {
  width: 100%;
  height: 100%;
  padding: 0.35rem;
  object-fit: contain;
  object-position: center;
}

.image-count {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.3rem 0.55rem;
  color: var(--white);
  background: rgba(23, 19, 14, 0.82);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.model-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.35rem 1.45rem 1.5rem;
}

.model-number {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--oak-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 0.95rem;
  font-style: italic;
}

.model-title {
  display: block;
  margin: 0;
  font-size: 1.17rem;
  font-weight: 400;
  line-height: 1.35;
}

.card-facts {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

.card-fact {
  display: grid;
  gap: 0.12rem;
}

.card-fact strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.card-fact span {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.model-open-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.2rem;
  color: var(--oak-dark);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.is-hidden,
.model-detail[hidden] {
  display: none;
}

.model-detail {
  padding: clamp(3.5rem, 7vw, 7rem) 0 clamp(5rem, 9vw, 9rem);
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--hairline);
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.detail-back:hover,
.detail-back:focus-visible {
  color: var(--oak-dark);
}

#detailPosition,
#detailImageCount {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

.detail-main-image {
  display: grid;
  min-height: 460px;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--hairline);
}

.detail-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-summary h1 {
  max-width: 13ch;
  color: var(--ink);
  font-size: clamp(2.7rem, 5.4vw, 5.2rem);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.2rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-tags span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.detail-tags span::before {
  width: 5px;
  height: 5px;
  content: "";
  background: var(--oak);
  border-radius: 50%;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: clamp(2rem, 4vw, 3.5rem);
}

.detail-fact {
  min-width: 0;
  padding: 1rem 0 0 1rem;
  border-top: 1px solid var(--oak);
  border-left: 1px solid var(--hairline);
}

.detail-fact strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 500;
}

.detail-fact span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.5;
}

.detail-section {
  margin-top: clamp(5rem, 10vw, 10rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--hairline);
}

.detail-description {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(2rem, 7vw, 7rem);
}

.detail-section-heading h2 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
}

.detail-prose {
  max-width: 78ch;
  color: var(--body-strong);
  font-size: clamp(0.95rem, 1.3vw, 1.08rem);
  line-height: 1.75;
}

.detail-prose p {
  margin: 0 0 1.2rem;
}

.detail-gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.75rem);
}

.gallery-item {
  display: grid;
  min-width: 0;
  aspect-ratio: 4 / 3;
  padding: 0;
  place-items: center;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--hairline);
  cursor: zoom-in;
  transition: border-color 220ms ease, transform 220ms ease;
}

.gallery-item:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

.gallery-item:hover {
  border-color: var(--oak);
  transform: translateY(-2px);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--oak);
  outline-offset: 4px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.specification-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 3rem;
  margin-top: clamp(2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--hairline);
}

.specification-item {
  padding: 0.9rem 0;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  font-size: 0.84rem;
}

.specification-item.is-heading {
  color: var(--ink);
  font-weight: 600;
}

.detail-contact {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3rem;
  margin-top: clamp(5rem, 10vw, 10rem);
  padding: clamp(2.5rem, 5vw, 4.5rem);
  color: var(--white);
  background: var(--dark);
  border: 1px solid rgba(176, 141, 87, 0.42);
}

.detail-contact h2 {
  max-width: 16ch;
}

.detail-contact h2 em {
  color: var(--oak);
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
}

.catalog-cta {
  padding: clamp(4rem, 7vw, 7rem) 0;
  color: var(--white);
  background: var(--dark);
  border-top: 1px solid rgba(176, 141, 87, 0.32);
}

.cta-inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3rem;
}

.cta-inner h2 {
  max-width: 18ch;
}

.catalog-footer {
  padding: 1.4rem 0;
  color: var(--muted);
  background: #120f0b;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.catalog-footer a:hover {
  color: var(--oak);
}

.model-dialog {
  width: min(1220px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(176, 141, 87, 0.7);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.4);
}

.model-dialog::backdrop {
  background: rgba(11, 9, 7, 0.82);
  backdrop-filter: blur(3px);
}

.dialog-close {
  position: absolute;
  z-index: 3;
  top: 0.8rem;
  right: 0.8rem;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--white);
  background: rgba(23, 19, 14, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-media {
  position: relative;
  display: grid;
  min-height: min(72vh, 760px);
  place-items: center;
  overflow: hidden;
  background: #e8e1d7;
}

.dialog-media img {
  width: 100%;
  max-height: min(76vh, 820px);
  object-fit: contain;
}

.image-step {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 44px;
  height: 44px;
  color: var(--white);
  background: rgba(23, 19, 14, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  cursor: pointer;
  transform: translateY(-50%);
}

.image-step-prev {
  left: 0.85rem;
}

.image-step-next {
  right: 0.85rem;
}

.image-step[hidden] {
  display: none;
}

.dialog-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.2rem 1.5rem;
}

.dialog-caption .eyebrow {
  margin-bottom: 0.25rem;
}

.dialog-caption h2 {
  font-size: clamp(1.35rem, 2.6vw, 2.2rem);
}

.image-dots {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.image-dots button {
  flex: 0 0 34px;
  width: 34px;
  height: 3px;
  padding: 0;
  background: var(--hairline);
  border: 0;
  cursor: pointer;
}

.image-dots button.is-active {
  background: var(--oak);
}

@media (max-width: 1020px) {
  .catalog-nav {
    display: none;
  }

  .header-cta {
    margin-left: auto;
  }

  .model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-summary h1 {
    max-width: 16ch;
  }
}

@media (max-width: 680px) {
  .catalog-container,
  .header-inner {
    width: min(100% - 1.25rem, 1240px);
  }

  .header-inner {
    gap: 0.65rem;
  }

  .brand img {
    width: clamp(135px, 44vw, 156px);
  }

  .header-cta {
    min-height: 44px;
    padding: 0.7rem 0.85rem;
    font-size: 0.62rem;
  }

  .catalog-hero {
    padding: 3rem 0 2.75rem;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 3.6rem);
  }

  .back-link {
    min-height: 44px;
    margin-bottom: 2rem;
  }

  .category-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .category-tabs a {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    text-align: left;
  }

  .category-tabs a:last-child {
    border-bottom: 0;
  }

  .models-meta,
  .cta-inner,
  .footer-inner,
  .dialog-caption,
  .detail-contact,
  .detail-gallery-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-grid {
    grid-template-columns: 1fr;
  }

  .detail-hero {
    gap: 2rem;
  }

  .detail-main-image {
    min-height: 0;
  }

  .detail-facts,
  .detail-description,
  .detail-gallery,
  .specification-list {
    grid-template-columns: 1fr;
  }

  .gallery-item:first-child {
    grid-column: auto;
    aspect-ratio: 4 / 3;
  }

  .dialog-media {
    min-height: 42vh;
    min-height: 42dvh;
  }

  .dialog-caption {
    gap: 0.8rem;
  }

  .model-dialog {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .detail-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-contact {
    padding: 2rem 1.25rem;
  }
}

@media (max-width: 380px) {
  .header-cta {
    padding-inline: 0.65rem;
    font-size: 0.57rem;
    letter-spacing: 0.09em;
  }

  .catalog-hero,
  .models-section,
  .model-detail {
    overflow-wrap: anywhere;
  }

  .category-tabs a {
    padding-inline: 0.9rem;
  }

  .model-copy {
    padding-inline: 1rem;
  }

  .detail-summary h1 {
    font-size: clamp(2.2rem, 13vw, 3rem);
  }

  .image-dots button {
    flex-basis: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
