:root {
  color-scheme: light;
  --ink: #203029;
  --muted: #66746d;
  --paper: #f6f4ec;
  --surface: #fffdf7;
  --line: #d9d4c7;
  --moss: #5f7f61;
  --moss-dark: #304f3b;
  --water: #547f91;
  --clay: #b36b4b;
  --shadow: 0 18px 50px rgba(34, 44, 38, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

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

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  padding: 12px clamp(16px, 3vw, 34px);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(130px, 1fr);
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand span {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 17px;
}

.brand small,
.toolbar-kicker,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topnav,
.segmented,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-actions {
  flex-wrap: wrap;
}

.topnav {
  justify-content: center;
  flex-wrap: wrap;
}

.nav-button,
.segment,
.tool-button,
.primary-link {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 13px;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
  transform 160ms ease;
}

.compact-tool {
  min-width: 40px;
  padding-inline: 10px;
}

.nav-button:hover,
.segment:hover,
.tool-button:hover,
.primary-link:hover,
.board-card:hover {
  transform: translateY(-1px);
  border-color: rgba(48, 79, 59, 0.45);
}

.nav-button.is-active,
.segment.is-active,
.source-pill,
.primary-link {
  background: var(--moss-dark);
  border-color: var(--moss-dark);
  color: #fff;
}

.source-pill {
  justify-self: end;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
}

main {
  flex: 1;
  min-height: 0;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
}

.board-view {
  height: calc(100vh - 72px);
  min-height: 0;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  overflow: hidden;
}

.control-panel {
  padding: clamp(20px, 3vw, 34px);
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--moss);
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

.split-view h1,
.renders-view h1,
.access-view h1 {
  font-size: clamp(30px, 4vw, 52px);
}

.intro {
  color: var(--muted);
  line-height: 1.55;
  max-width: 64ch;
}

.board-list {
  display: grid;
  gap: 10px;
  margin: 28px 0;
}

.board-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfaf4;
  color: var(--ink);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.board-card.is-active {
  border-color: var(--moss-dark);
  box-shadow: inset 3px 0 0 var(--moss-dark);
}

.board-card strong {
  display: block;
  margin-bottom: 4px;
}

.board-card small {
  color: var(--muted);
}

.board-meta {
  margin: 0;
  display: grid;
  gap: 12px;
  font-size: 13px;
}

.board-meta div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.board-meta dt {
  color: var(--muted);
}

.board-meta dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.pdf-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-toolbar {
  min-height: 82px;
  padding: 14px clamp(14px, 2vw, 26px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fcfbf5;
}

.toolbar-kicker {
  margin: 0 0 4px;
}

.panel-toolbar h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 25px);
}

.pdf-frame-wrap {
  min-height: 0;
  padding: clamp(10px, 1.5vw, 18px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(32, 48, 41, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 48, 41, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

iframe {
  border: 0;
}

.pdf-canvas-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 580px;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #f4f1e7;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pdf-canvas-shell canvas {
  display: block;
  max-width: none;
  background: #fff;
  box-shadow: 0 14px 36px rgba(18, 26, 22, 0.22);
}

.pdf-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  background: rgba(244, 241, 231, 0.9);
  color: var(--muted);
}

.pdf-loader.is-hidden {
  display: none;
}

.split-view {
  min-height: calc(100vh - 72px);
  grid-template-columns: minmax(280px, 410px) minmax(0, 1fr);
  gap: 0;
}

.section-copy {
  padding: clamp(22px, 4vw, 44px);
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.section-copy.compact {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.segmented {
  margin: 24px 0 18px;
  flex-wrap: wrap;
}

.presentation-stage {
  min-width: 0;
  padding: clamp(12px, 2vw, 24px);
  display: grid;
  background: #ece8da;
}

.presentation-frame {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 680px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.presentation-frame.is-active {
  display: block;
}

.pdf-presentation-frame {
  overflow: hidden;
}

.canva-link-frame {
  align-items: center;
  justify-items: center;
  padding: clamp(22px, 4vw, 50px);
  background:
    linear-gradient(90deg, rgba(32, 48, 41, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 48, 41, 0.05) 1px, transparent 1px),
    #f4f1e7;
  background-size: 32px 32px;
}

.canva-link-frame.is-active {
  display: grid;
}

.canva-link-frame > div {
  max-width: 560px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.canva-link-frame h2 {
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
  margin-bottom: 16px;
}

.pdf-presentation-frame.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.slide-toolbar {
  min-height: 58px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  background: #fcfbf5;
}

.slide-toolbar span {
  min-width: 150px;
  text-align: center;
  color: var(--muted);
}

.slide-canvas-shell {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 18px;
  background: #ece8da;
}

.slide-canvas-shell canvas {
  display: block;
  max-width: none;
  background: #fff;
  box-shadow: 0 14px 36px rgba(18, 26, 22, 0.22);
}

.renders-view,
.access-view {
  min-height: calc(100vh - 72px);
  align-content: start;
}

.render-grid {
  padding: clamp(14px, 3vw, 34px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.render-card {
  position: relative;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #e7e1d2;
  cursor: zoom-in;
}

.render-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease;
}

.render-card:hover img {
  transform: scale(1.03);
}

.render-card span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(32, 48, 41, 0.78);
  color: #fff;
  font-size: 13px;
}

.access-grid {
  padding: clamp(14px, 3vw, 34px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.access-card {
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(34, 44, 38, 0.08);
}

.access-card h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.access-card p {
  color: var(--muted);
  line-height: 1.5;
}

.access-card a {
  width: fit-content;
}

.render-dialog {
  width: min(94vw, 1180px);
  border: 0;
  border-radius: 8px;
  padding: 16px;
  background: #111714;
  color: #fff;
}

.render-dialog::backdrop {
  background: rgba(12, 17, 14, 0.76);
}

.render-dialog img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}

.dialog-close {
  float: right;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  background: transparent;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
}

#renderCaption {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

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

  .source-pill {
    justify-self: start;
  }

  .board-view,
  .split-view {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 72px);
    overflow: visible;
  }

  .control-panel,
  .section-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .panel-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-canvas-shell,
  .presentation-frame {
    min-height: 70vh;
  }
}

@media (max-width: 560px) {
  .topnav,
  .toolbar-actions {
    align-items: stretch;
  }

  .nav-button,
  .tool-button,
  .segment {
    flex: 1 1 auto;
  }

  .board-list {
    grid-template-columns: 1fr;
  }
}
