/* ==========================================================================
   Reset, typography and page layout.
   ========================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--plane);
  font-feature-settings: 'ss01', 'cv05';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* ─────────────────────────────── page shell ─────────────────────────────── */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: 0 var(--gap-5);
  background: color-mix(in srgb, var(--plane) 72%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  margin-right: auto;
  min-width: 0;
}

/* The mark is the idea: one point, two futures. */
.brand__mark {
  width: 26px;
  height: 26px;
  flex: none;
  overflow: visible;
}

.brand__name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.022em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__tag {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
@media (max-width: 900px) { .brand__tag { display: none; } }

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
}

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  gap: var(--gap-5);
  padding: var(--gap-5);
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

.sidebar > * { flex: 0 0 auto; }

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + var(--gap-5));
  max-height: calc(100vh - var(--topbar-h) - var(--gap-6));
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
  padding-right: 4px;
  scrollbar-width: thin;
}

.main {
  display: flex;
  flex-direction: column;
  gap: var(--gap-5);
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--gap-3);
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-head p {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: auto;
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--gap-4);
    gap: var(--gap-4);
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .shell[data-mobile-view='results'] .sidebar { display: none; }
  .shell[data-mobile-view='inputs'] .main { display: none; }
}
