/* site/css/style.css */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:          #0d1117;
  --card-bg:     #161b22;
  --border:      #30363d;
  --grid:        #21262d;
  --text:        #c9d1d9;
  --text-bright: #e6edf3;
  --text-dim:    #8b949e;
  --text-faint:  #484f58;
  --green:       #3fb950;
  --red:         #f85149;
  --blue:        #58a6ff;
  --orange:      #f0883e;
  --purple:      #bc8cff;
  --primary:     #58a6ff;
  --axis:        #8b949e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica,
               Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---- Header ---- */

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
}

header .tagline {
  font-size: 13px;
  color: var(--text-faint);
}

.status {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-faint);
}

.status.ok  { color: var(--green); }
.status.err { color: var(--red); }

/* ---- Layout: sidebar + content ---- */

.layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 160px);
}

/* Sidebar */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 0;
  position: sticky;
  top: 24px;
  align-self: flex-start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.sidebar-section {
  padding: 10px 20px;
  color: var(--axis);
  font-size: 0.85rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s,
              color 0.15s;
  user-select: none;
}

.sidebar-section:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-bright);
}

.sidebar-section.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: rgba(88, 166, 255, 0.08);
  font-weight: 500;
}

.sidebar-section.disabled {
  color: var(--axis);
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.sidebar-label {
  padding: 16px 20px 6px;
  color: var(--axis);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
}

/* Content */

.content {
  flex: 1;
  padding: 0 0 0 24px;
  min-width: 0;
}

.chart-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cauldron-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-dim);
}

.cauldron-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cauldron-controls input,
.cauldron-controls select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular,
               Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}

.cauldron-controls input {
  width: 540px;
  max-width: 100%;
}

.cauldron-controls input:focus,
.cauldron-controls select:focus {
  outline: none;
  border-color: var(--primary);
}

.cauldron-controls input.invalid {
  border-color: var(--red);
}

.cauldron-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  align-self: flex-end;
  padding-bottom: 7px;
}

.cauldron-status.ok  { color: var(--green); }
.cauldron-status.err { color: var(--red); }

/* ---- Cards ---- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.card .subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}

.card .subtitle .formula {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
}

.card .subtitle code {
  font-family: ui-monospace, SFMono-Regular,
               Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

.chart {
  width: 100%;
  height: 480px;
}

/* ---- Footer ---- */

footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
}

footer a:hover {
  color: var(--text-bright);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    display: flex;
    overflow-x: auto;
    border-radius: 6px;
    padding: 4px 8px;
    gap: 2px;
    margin-bottom: 16px;
    max-height: none;
  }

  .sidebar-section {
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 8px 14px;
    font-size: 0.78rem;
  }

  .sidebar-section.active {
    border-left-color: transparent;
    border-bottom-color: var(--primary);
  }

  .sidebar-label {
    display: none;
  }

  .content {
    padding: 0;
  }

  body {
    padding: 12px;
  }

  header {
    margin-bottom: 16px;
  }

  .chart {
    height: 360px;
  }

  .card {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .chart {
    height: 320px;
  }
}
