/* Baseline Nuex styling */
@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/courier-prime/CourierPrime-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/courier-prime/CourierPrime-Bold.ttf") format("truetype");
}

:root {
  color-scheme: light dark;
  --page-bg: #f7f4ec;
  --page-text: #111;
  --accent: #223d6b;
  --warning: #8b2f2f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Courier Prime", "Courier New", monospace;
  background: var(--page-bg);
  color: var(--page-text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main.page-shell {
  flex: 1 0 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem clamp(1.5rem, 5vw, 4rem);
}

.site-header {
  background: #050505;
  color: #f4f4f4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header__inner {
  margin: 0 auto;
  width: 100%;
  max-width: 1280px;
  padding: 0.35rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.9rem;
  flex: 1;
}

.site-page-dropdown {
  flex: 3;
  max-width: 75%;
  display: block;
  position: relative;
  background: #0f0f0f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: inherit;
}

.site-page-dropdown summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.site-page-dropdown summary::-webkit-details-marker {
  display: none;
}

.summary-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  font-size: 0.75rem;
}

.summary-value {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-page-dropdown__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  background: #0f0f0f;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: none;
  z-index: 10;
}

.site-page-dropdown[open] .site-page-dropdown__list {
  display: block;
}

.site-page-dropdown__list li {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-page-dropdown__list li:last-child {
  border-bottom: none;
}

.site-page-dropdown__list a {
  display: block;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.site-page-dropdown__list a.is-active {
  color: var(--accent);
}

.site-footer {
  background: #050505;
  color: #f4f4f4;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.site-footer__inner {
  margin: 0 auto;
  width: 100%;
  max-width: 1280px;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.8rem;
}

.site-footer__links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__links a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.site-footer__links a:hover {
  color: var(--accent);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead p {
  margin: 0.25rem 0 0;
  max-width: 60ch;
  line-height: 1.6;
}

.render-wrapper {
  display: grid;
  gap: 1rem;
}

.render-canvas {
  aspect-ratio: 3 / 2;
  width: min(100%, 960px);
  min-height: 320px;
  border: 3px solid var(--accent);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(200, 200, 200, 0.35));
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.warning {
  color: var(--warning);
  font-weight: 700;
}

/* Code block styling for editor-like appearance */
pre {
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.45;
  font-size: 0.95em;
  font-family: "Courier Prime", "Courier New", monospace !important;
}

pre code {
  background: transparent;
  padding: 0;
  font-family: "Courier Prime", "Courier New", monospace !important;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
  white-space: pre;
  display: block;
  overflow-x: auto;
  min-width: min-content;
}

code:not(pre code) {
  background: rgba(110, 118, 129, 0.4);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.9em;
}

/* Page grid layout - single column */
.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.page-grid .cell {
  aspect-ratio: auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 3px solid var(--accent);
  padding: 1rem;
  background: var(--page-bg);
  overflow-x: hidden;
  overflow-y: visible;
  box-sizing: border-box;
}

.page-grid .cell[data-cell-type="threejs"] {
  padding: 1rem;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
}

.page-grid .cell[data-cell-type="threejs"] .render-canvas {
  width: 100% !important;
  height: auto !important;
  min-height: 0;
  min-width: 0;
  max-width: 100% !important;
  max-height: 100%;
  border: none;
  display: block;
  aspect-ratio: 1 / 1;
  flex: 1 1 auto;
  /* Override base .render-canvas rule completely */
  background: transparent;
  box-shadow: none;
}

.page-grid .cell[data-cell-type="threejs"] .render-canvas canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block;
}

.page-grid .cell[data-cell-type="markdown"] {
  padding: 1rem;
  min-width: 0;
}

.page-grid .cell[data-cell-type="markdown"] .markdown-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.page-grid .cell[data-cell-type="youtube"] {
  padding: 1rem;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
}

.page-grid .cell[data-cell-type="youtube"] .youtube-embed {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}

.page-grid .cell[data-cell-type="youtube"] .youtube-embed iframe {
  border: none;
  width: 100%;
  height: 100%;
  display: block;
}

.page-grid .cell[data-cell-type="image"] {
  padding: 1rem;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.page-grid .cell[data-cell-type="image"] .image-embed {
  width: 100%;
  height: auto;
  display: flex !important;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 1rem;
}

.page-grid .cell[data-cell-type="image"] .image-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.page-grid .cell[data-cell-type="image"] .image-container img,
.page-grid .cell[data-cell-type="image"] .image-container svg {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

details.internal-thought-placeholder {
  margin: 1rem 0;
}

details.internal-thought-placeholder > summary {
  cursor: pointer;
}
}

@media (max-width: 640px) {
  main.page-shell {
    padding: 1.5rem;
  }

  .site-header__inner,
  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-page-dropdown {
    width: 100%;
    border-radius: 12px;
  }

  .site-footer__links {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-grid {
    gap: 1.5rem;
  }

  .page-grid .cell {
    aspect-ratio: auto;
    min-height: 320px;
  }

  .page-grid .cell[data-cell-type="youtube"] {
    aspect-ratio: auto;
    min-height: auto;
  }

  .render-canvas {
    aspect-ratio: 1 / 1;
  }

  pre {
    padding: 12px;
    font-size: 0.9em;
  }
}

