@font-face {
  font-family: "Aeonik";
  src: url("assets/fonts/Aeonik-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Aeonik";
  src: url("assets/fonts/Aeonik-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2c2a29;
  --red: #da291c;
  --green: #61ba13;
  --blue: #0096c2;
  --paper: #fafafa;
  --warm: #f1eee8;
  --line: #cdcdcc;
  --soft-line: #e6e6e6;
  --muted: #80807f;
  --white: #ffffff;
  --panel: #fafafa;
  --shadow: 0 18px 50px rgba(44, 42, 41, 0.18);
  --surface-base: #c18a54;
  --surface-dark: #6d3f25;
  --surface-light: #f0c184;
  --surface-angle: 90deg;
  --board-angle: 90deg;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Aeonik", Arial, sans-serif;
  line-height: 1.4;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100svh;
  background: var(--paper);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(270px, 0.8fr) minmax(420px, 1.2fr) auto;
  align-items: stretch;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 250, 0.98);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(44, 42, 41, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 28px;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--soft-line);
}

.brand img {
  display: block;
  width: 180px;
  max-width: 52vw;
  height: auto;
}

.brand span {
  color: var(--muted);
  white-space: nowrap;
}

.topnav {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav__item {
  min-width: 140px;
  border: 0;
  border-right: 1px solid var(--soft-line);
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 0 24px;
  cursor: pointer;
  color: var(--muted);
}

.topnav__item.is-active {
  color: var(--ink);
  border-bottom-color: var(--red);
  background: var(--white);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
}

.icon-button,
.tool-button,
.cycle-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 0;
}

.icon-button svg,
.tool-button svg,
.cycle-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ghost-button,
.primary-button {
  min-height: 42px;
  border-radius: 0;
  padding: 0 18px;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--white);
}

.primary-button {
  border: 1px solid var(--red);
  background: var(--red);
  color: var(--white);
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  min-height: calc(100svh - 72px);
}

.viewer {
  position: relative;
  min-width: 0;
  min-height: calc(100svh - 72px);
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}

.scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: opacity 220ms ease, transform 550ms ease;
  z-index: 0;
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 32%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.42), transparent 36%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), transparent 40%);
}

.surface-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.72;
  mix-blend-mode: multiply;
  transition: clip-path 260ms ease, opacity 180ms ease, filter 180ms ease;
  background:
    radial-gradient(130% 78% at 28% 16%, rgba(255, 255, 255, 0.22), transparent 32%),
    linear-gradient(var(--surface-angle), rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0) 16%, rgba(0, 0, 0, 0.18) 34%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.1) 73%),
    repeating-linear-gradient(var(--board-angle), rgba(255, 255, 255, 0.22) 0 2px, rgba(0, 0, 0, 0.18) 3px 5px, transparent 6px 34px),
    repeating-linear-gradient(calc(var(--board-angle) + 90deg), transparent 0 34px, rgba(255, 255, 255, 0.08) 35px 37px),
    linear-gradient(135deg, var(--surface-light), var(--surface-base) 50%, var(--surface-dark));
  background-size: auto, auto, 150px 150px, 190px 190px, auto;
  filter: saturate(1.08) contrast(1.08) brightness(1.02);
}

#compareButton {
  display: none;
}

.surface-overlay.is-hidden {
  opacity: 0;
}

.surface-wall.env-sauna {
  clip-path: polygon(10% 18%, 89% 15%, 93% 76%, 5% 81%);
}

.surface-bench.env-sauna {
  clip-path: polygon(18% 60%, 80% 57%, 92% 75%, 10% 81%);
}

.surface-ceiling.env-sauna {
  clip-path: polygon(0 0, 100% 0, 91% 30%, 12% 27%);
}

.surface-wall.env-interior {
  clip-path: polygon(23% 5%, 86% 7%, 91% 76%, 21% 81%);
}

.surface-floor.env-interior,
.surface-floor.env-kitchen,
.surface-floor.env-villa {
  clip-path: polygon(6% 66%, 93% 60%, 100% 100%, 0 100%);
}

.surface-ceiling.env-interior,
.surface-ceiling.env-kitchen {
  clip-path: polygon(4% 0, 98% 0, 83% 28%, 12% 24%);
}

.surface-wall.env-kitchen {
  clip-path: polygon(10% 15%, 80% 11%, 88% 72%, 8% 80%);
}

.surface-facade.env-exterior,
.surface-facade.env-villa {
  clip-path: polygon(11% 11%, 87% 8%, 96% 73%, 16% 83%);
}

.surface-deck.env-exterior,
.surface-deck.env-villa {
  clip-path: polygon(4% 66%, 91% 58%, 100% 100%, 0 100%);
}

.viewer__meta {
  position: absolute;
  z-index: 4;
  top: 28px;
  left: 28px;
  max-width: min(460px, calc(100% - 56px));
  color: var(--white);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
}

.viewer__meta .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.viewer__meta h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 62px);
  line-height: 0.96;
  font-weight: 300;
}

.viewer__meta p:last-child {
  max-width: 390px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
}

.viewer__tools {
  position: absolute;
  z-index: 5;
  top: 28px;
  right: 28px;
  display: flex;
  gap: 10px;
}

.tool-button {
  grid-auto-flow: column;
  gap: 8px;
  min-height: 42px;
  border-radius: 0;
  padding: 0 14px;
  color: var(--ink);
  backdrop-filter: blur(12px);
}

.cycle-button {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 54px;
  height: 74px;
  transform: translateY(-50%);
  border: 0;
  color: var(--white);
  background: rgba(44, 42, 41, 0.68);
  backdrop-filter: blur(12px);
}

.cycle-button--left {
  left: 18px;
  border-radius: 0;
}

.cycle-button--right {
  right: 18px;
  border-radius: 0;
}

.environment-strip {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 22px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 48px);
  overflow-x: auto;
  padding: 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  background: rgba(44, 42, 41, 0.52);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
}

.environment-strip::-webkit-scrollbar {
  display: none;
}

.environment-card {
  display: grid;
  grid-template-rows: 50px min-content;
  justify-items: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 6px 6px 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  cursor: pointer;
  text-align: center;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.environment-card img {
  width: 100%;
  height: 50px;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
}

.environment-card span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.environment-card.is-active {
  border-color: var(--red);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px var(--red);
}

.environment-card:hover {
  background: rgba(255, 255, 255, 0.16);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-height: calc(100svh - 72px);
  overflow-y: auto;
  padding: 0 20px 20px;
  border-left: 1px solid var(--line);
  background: var(--warm);
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(44, 42, 41, 0.06);
}

.summary-panel {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 18px;
  margin: 0 -20px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--warm);
}

.summary-panel h2,
.panel-section h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 400;
}

.selection-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.summary-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.summary-specs {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.summary-specs dt {
  color: var(--muted);
  font-size: 12px;
}

.summary-specs dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.product-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid var(--red);
  color: var(--red);
  font-size: 14px;
  text-decoration: none;
}

.panel-section {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.surface-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.surface-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
  padding: 0 12px;
  cursor: pointer;
  color: var(--ink);
}

.surface-tab svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.surface-tab.is-active {
  border-color: var(--red);
  color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.segmented button.is-active {
  background: var(--ink);
  color: var(--white);
}

.material-panel {
  padding-bottom: 14px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.material-card {
  display: block;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
  padding: 8px;
  cursor: pointer;
  text-align: left;
}

.material-card.is-active {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red), 0 8px 18px rgba(218, 41, 28, 0.12);
}

.swatch {
  display: block;
  position: relative;
  width: 100%;
  height: 76px;
  margin-bottom: 9px;
  overflow: hidden;
  border-radius: 0;
  background:
    linear-gradient(var(--swatch-angle), rgba(255, 255, 255, 0.15), transparent 20%, rgba(0, 0, 0, 0.16) 34%, transparent 55%),
    repeating-linear-gradient(var(--swatch-board), rgba(255, 255, 255, 0.22) 0 1px, rgba(0, 0, 0, 0.16) 2px 3px, transparent 4px 18px),
    linear-gradient(135deg, var(--swatch-light), var(--swatch-base), var(--swatch-dark));
  box-shadow: inset 0 0 0 1px rgba(44, 42, 41, 0.12);
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 60% at 20% 12%, rgba(255, 255, 255, 0.22), transparent 42%);
}

.material-card strong {
  display: -webkit-box;
  min-height: 32px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.material-copy {
  min-width: 0;
}

.material-copy span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(230px, auto) minmax(300px, 1fr) auto;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  }

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

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .brand {
    padding: 0 18px;
  }

  .brand span,
  .topnav {
    display: none;
  }

  .workspace {
    display: block;
  }

  .viewer {
    min-height: 68svh;
  }

  .control-panel {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-panel {
    top: 86px;
  }

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

@media (max-width: 620px) {
  .topbar {
    min-height: 64px;
  }

  .brand img {
    width: 150px;
  }

  .topbar__actions {
    padding-right: 12px;
  }

  .ghost-button {
    display: none;
  }

  .viewer {
    min-height: 62svh;
  }

  .viewer__meta {
    top: 18px;
    left: 18px;
  }

  .viewer__meta h1 {
    font-size: 34px;
  }

  .viewer__meta p:last-child {
    display: none;
  }

  .viewer__tools {
    top: auto;
    right: 18px;
    bottom: 104px;
  }

  .tool-button span {
    display: none;
  }

  .cycle-button {
    width: 42px;
    height: 56px;
  }

  .environment-strip {
    bottom: 16px;
    grid-auto-columns: 92px;
    max-width: calc(100% - 24px);
    padding: 8px;
  }

  .environment-card {
    grid-template-rows: 42px min-content;
    min-height: 0;
    padding: 5px;
  }

  .environment-card img {
    width: 100%;
    height: 42px;
    margin: 0;
  }

  .environment-card span {
    font-size: 10.5px;
  }

  .control-panel {
    padding: 0 14px 14px;
  }

  .summary-panel {
    top: 78px;
    grid-template-columns: 1fr;
    margin: 0 -14px;
    padding: 14px;
  }

  .surface-tabs,
  .material-grid,
  .summary-specs {
    grid-template-columns: 1fr;
  }

  .summary-actions {
    justify-items: start;
  }
}
