:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: rgba(208, 213, 221, 0.76);
  --paper: #f8faf7;
  --surface: #ffffff;
  --navy: #0e1f35;
  --navy-2: #183456;
  --gold: #c59a43;
  --gold-2: #8b641f;
  --green: #2f7b62;
  --cyan: #0f7c8f;
  --red: #b54a3a;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  --soft-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 24% 18%, rgba(197, 154, 67, 0.16), transparent 28%),
    radial-gradient(circle at 84% 72%, rgba(47, 123, 98, 0.14), transparent 30%),
    linear-gradient(135deg, #f9faf7 0%, #eef5f3 48%, #f8f1df 100%);
}

body.fullscreen-fallback {
  overflow: hidden;
}

body.fullscreen-fallback .app-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100vw;
  height: 100dvh;
}

button, input { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr) 188px;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar, .thumb-rail {
  min-height: 0;
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  border-style: solid;
  backdrop-filter: blur(22px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px 20px;
  border-width: 0 1px 0 0;
  overflow: auto;
  box-shadow: 10px 0 36px rgba(15, 23, 42, 0.05);
}

.sidebar > * {
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.brand-logo {
  display: block;
  width: min(216px, 100%);
  line-height: 0;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

.contact-panel span {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.showcase-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(197, 154, 67, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(14, 31, 53, 0.98), rgba(24, 52, 86, 0.94)),
    #102039;
  color: #fff;
  box-shadow: var(--soft-shadow);
}

.showcase-card::after {
  position: absolute;
  right: -26px;
  bottom: -54px;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(197, 154, 67, 0.36);
  border-radius: 50%;
  content: "";
}

.showcase-card span {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(197, 154, 67, 0.18);
  color: #f8e5b6;
  font-size: 12px;
  font-weight: 800;
}

.showcase-card strong {
  display: block;
  margin-top: 12px;
  max-width: 230px;
  font-size: 19px;
  line-height: 1.2;
}

.showcase-card p {
  margin: 8px 0 0;
  max-width: 235px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(197, 154, 67, 0.18);
}

.section-list {
  display: grid;
  gap: 8px;
}

.section-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.section-button:hover, .section-button.active {
  border-color: rgba(178, 132, 46, 0.3);
  background: rgba(197, 154, 67, 0.12);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.section-button.active {
  border-color: rgba(197, 154, 67, 0.55);
  background: linear-gradient(135deg, rgba(197, 154, 67, 0.18), rgba(47, 123, 98, 0.08));
}

.section-button span {
  color: var(--muted);
  font-size: 12px;
}

.contact-panel {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.contact-panel a {
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.catalog {
  display: grid;
  grid-template-rows: auto 3px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(14, 31, 53, 0.22);
}

.page-meta strong {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-meta .eyebrow {
  margin-bottom: 4px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.icon-button:hover, .icon-button.active {
  border-color: var(--gold);
  background: #fff;
  color: var(--gold-2);
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.section-button:focus-visible,
.thumb-button:focus-visible,
.edge-button:focus-visible,
.search-box input:focus-visible {
  outline: 3px solid rgba(15, 124, 143, 0.35);
  outline-offset: 2px;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.viewer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px 40px 22px;
  overflow: auto;
}

.viewer::before {
  position: fixed;
  inset: 84px 188px 0 318px;
  z-index: -1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.14)),
    rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  content: "";
}

.page-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  min-height: 100%;
  transform-origin: center top;
  transition: transform 180ms ease;
}

.catalog-page {
  flex: 0 1 auto;
  display: block;
  width: min(100%, calc((100vh - 206px) * 1.4142), 1220px);
  aspect-ratio: 1.4142;
  margin: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  outline: 1px solid rgba(255, 255, 255, 0.7);
}

.catalog-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.edge-button {
  position: absolute;
  top: 45%;
  z-index: 2;
  width: 26px;
  height: 180px;
  border: 0;
  border-radius: 8px;
  background: rgba(14, 31, 53, 0.08);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.edge-button:hover {
  background: rgba(197, 154, 67, 0.22);
  transform: scaleX(1.08);
}
.edge-button.left { left: 8px; }
.edge-button.right { right: 8px; }

.progress-track {
  height: 3px;
  background: rgba(14, 31, 53, 0.08);
}

.progress-track div {
  width: 2.5%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--green), var(--cyan));
  transition: width 220ms ease;
}

.thumb-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-width: 0 0 0 1px;
  min-width: 0;
  overflow: hidden;
  box-shadow: -10px 0 34px rgba(15, 23, 42, 0.04);
}

.thumb-header {
  padding: 16px 14px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.thumb-list {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 0 14px 18px;
  overflow: auto;
}

.thumb-button {
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.thumb-button.active {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.thumb-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.thumb-button img {
  display: block;
  width: 100%;
  border-radius: 6px;
  background: #fff;
}

.thumb-button span {
  display: block;
  padding: 6px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .thumb-rail {
    display: none;
  }
  .viewer::before {
    inset: 84px 0 0 260px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .sidebar {
    border-width: 0 0 1px;
  }
  .brand-logo {
    width: 188px;
  }
  .showcase-card {
    display: none;
  }
  .section-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 14px 12px;
    background: rgba(246, 243, 236, 0.92);
    backdrop-filter: blur(14px);
  }
  .toolbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .icon-button {
    width: 100%;
    height: 42px;
  }
  .viewer {
    min-height: 54vh;
    padding: 10px;
  }
  .viewer::before {
    display: none;
  }
  .catalog-page {
    width: 100%;
  }
  .edge-button {
    display: none;
  }
}

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