:root {
  --bg: #f4f1ec;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --line: #dad2c7;
  --line-strong: #c6bbad;
  --text: #24201c;
  --muted: #5d554b;
  --accent: #6b4a2f;
  --accent-strong: #553b25;
  --accent-soft: #efe7db;
  --success: #335c45;
  --container: 1220px;
  --font: "IBM Plex Sans", "Source Sans 3", "Helvetica Neue", Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
}
body.nav-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
iframe { display: block; width: 100%; border: 0; background: #fff; }
p, ul, ol, pre { margin-top: 0; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.16; color: var(--text); font-weight: 600; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.1rem; }
small { font-size: 0.875rem; }
pre, code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
pre {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbf8f3;
  border-radius: 8px;
  font-size: 0.94rem;
  line-height: 1.5;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 9px 12px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }
.container {
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto;
}
.site-header {
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.brand {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}
.site-nav { margin-left: auto; }
.site-nav > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a,
.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.site-nav a[aria-current="page"],
.site-nav a:hover,
.dropdown-trigger:hover,
.dropdown-trigger[aria-expanded="true"] {
  color: var(--text);
  text-decoration: none;
  border-color: var(--line);
  background: #f7f2eb;
}
.nav-dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 4px 16px rgba(36, 32, 28, 0.08);
  opacity: 0;
  visibility: hidden;
}
.nav-dropdown.open .dropdown-menu { opacity: 1; visibility: visible; }
.dropdown-menu a { display: block; width: 100%; }
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
}
.nav-toggle span + span { margin-top: 6px; }
.page-intro {
  padding: 34px 0 22px;
}
.page-intro p {
  max-width: 880px;
  color: var(--muted);
  font-size: 1.02rem;
}
.page-intro .inline-note {
  margin-top: 16px;
  color: var(--text);
}
.page-intro .inline-note a { color: var(--accent-strong); }
.embed-section,
.page-content,
.listing-section,
.single-column-section {
  padding: 0 0 28px;
}
.app-shell {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.app-shell-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.app-shell-head p {
  margin-bottom: 0;
  color: var(--muted);
}
.app-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  text-decoration: none;
}
.button-secondary {
  background: var(--surface-strong);
  color: var(--text);
  border-color: var(--line-strong);
}
.button-secondary:hover {
  background: #f7f2eb;
  border-color: var(--line-strong);
}
.app-frame-shell {
  position: relative;
  min-height: 820px;
  background: #f6f1e8;
}
.app-frame-shell[data-compact="true"] {
  min-height: 640px;
}
.loading-panel,
.fallback-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 24px;
  text-align: center;
  background: rgba(255, 253, 249, 0.96);
}
.loading-panel[hidden],
.fallback-panel[hidden] {
  display: none;
}
.app-frame-shell[data-state="loaded"] .loading-panel,
.app-frame-shell[data-state="loaded"] .fallback-panel,
.app-frame-shell[data-state="timeout"] .loading-panel {
  display: none;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-copy {
  max-width: 480px;
  color: var(--muted);
}
.progress-track {
  width: min(360px, 100%);
  height: 4px;
  border-radius: 999px;
  background: #ebe3d7;
  overflow: hidden;
}
.progress-indicator {
  width: 35%;
  height: 100%;
  background: var(--accent);
  animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(320%); }
}
.app-frame-shell iframe {
  min-height: inherit;
  opacity: 0;
  transition: opacity 140ms ease;
}
.app-frame-shell[data-state="loaded"] iframe { opacity: 1; }
.fallback-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 34px;
}
.stack > section + section,
.stack > article + section,
.stack > article + article,
.stack > div + div {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 24px;
}
.feature-image {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}
.feature-image img {
  width: 100%;
  height: auto;
}
.section-list,
.link-list,
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.section-list li,
.link-list li,
.post-list li {
  margin: 0;
  padding: 0;
}
.section-list li + li,
.link-list li + li,
.post-list li + li {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}
.section-list p:last-child,
.post-list p:last-child,
.link-list p:last-child { margin-bottom: 0; }
.meta {
  color: var(--muted);
  font-size: 0.95rem;
}
.keyword-line {
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 28px;
}
.footer-row h2 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}
.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-meta {
  color: var(--muted);
  text-align: right;
}
.footer-meta p { margin-bottom: 6px; }
.note-block {
  padding: 14px 16px;
  border-left: 3px solid var(--line-strong);
  background: #fbf8f3;
}
.inline-code-list li + li {
  margin-top: 10px;
}
@media (max-width: 960px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 65px;
    z-index: 20;
    display: none;
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-strong);
  }
  body.nav-open .site-nav { display: block; }
  .site-nav > ul { display: block; }
  .site-nav li + li { margin-top: 8px; }
  .site-nav a,
  .dropdown-trigger { width: 100%; justify-content: flex-start; }
  .dropdown-menu {
    position: static;
    margin-top: 8px;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    display: none;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .page-grid { grid-template-columns: 1fr; }
  .app-shell-head,
  .footer-row { flex-direction: column; }
  .footer-meta { text-align: left; }
}
@media (max-width: 640px) {
  .container { width: min(calc(100% - 24px), var(--container)); }
  .page-intro { padding-top: 28px; }
  .app-frame-shell { min-height: 720px; }
  .app-frame-shell[data-compact="true"] { min-height: 560px; }
}
