/* =====================================================================
   The IDE tab: the choice between RStudio and Spyder, and the bar that
   switches between them once one is open. (Each IDE has style sheets
   of its own, loaded with it: rstudio.css, spyder.css and r.css.)
   ===================================================================== */
#ideRoot { height: 100%; min-height: 0; }
.ide { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* the bar: RStudio | Spyder, and the help */
.ide-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.ide-switch { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--line); }
.ide-sw { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 3px 10px 3px 8px; border-radius: 6px; font-size: 0.83rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.ide-sw .ic { width: 15px; height: 15px; }
.ide-sw:hover { color: var(--ink); }
.ide-sw.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14); }
.ide-sw:focus-visible, .ide-helpbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* (a dot: green once the IDE is open, orange while it loads) */
.ide-state { width: 7px; height: 7px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.ide-sw.open .ide-state { background: var(--good); box-shadow: none; }
.ide-sw.opening .ide-state { background: var(--act); box-shadow: none; animation: ide-pulse 0.9s ease-in-out infinite alternate; }
@keyframes ide-pulse { from { opacity: 0.35; } to { opacity: 1; } }
.ide-grow { flex: 1; }
.ide-helpbtn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--accent); font-size: 0.82rem; font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: 6px; }
.ide-helpbtn .ic { width: 15px; height: 15px; }
.ide-helpbtn:hover { background: var(--accent-soft); }

.ide-body { flex: 1; min-height: 0; position: relative; }
.ide-host { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ide-host[hidden] { display: none !important; }
.ide-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ide-app > * { flex: 1; min-height: 0; }

/* ---------------- the choice of IDE ---------------- */
.ide-launch { position: absolute; inset: 0; overflow: auto; background: var(--bg); }
.ide-launch-in { max-width: 1000px; padding: 26px 30px 48px; }
.ide-launch h2 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
.ide-intro { margin: 0 0 22px; max-width: 74ch; color: var(--ink-2); }
.ide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.ide-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.ide-card-b { padding: 14px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.ide-card h3 { margin: 0 0 6px; font-size: 1.2rem; display: flex; align-items: baseline; gap: 8px; }
.ide-lang { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.ide-card p { margin: 0 0 10px; color: var(--ink-2); font-size: 0.93rem; }
.ide-card .ide-lead { color: var(--ink); font-weight: 600; }
.ide-go { align-self: flex-start; margin-top: auto; }
.ide-notes { margin-top: 26px; max-width: 80ch; }
.ide-notes h3 { font-size: 1rem; margin: 0 0 6px; }
.ide-notes ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); font-size: 0.92rem; }
.ide-notes li { margin: 0 0 6px; }
.ide-notes .linkbtn { padding: 0; font-weight: 600; }

/* A sketch of each IDE, in its own colours, with its panes where the IDE puts them: what a student will see when
   it opens, and on a computer with the real program. */
.ide-shot { padding: 16px 18px 0; border-bottom: 1px solid var(--line); }
.ide-shot-rstudio { background: #e6eaef; }
.ide-shot-spyder { background: #0e1720; border-bottom-color: #0e1720; }
.ide-shot-bar { height: 15px; border-radius: 7px 7px 0 0; display: flex; align-items: center; gap: 5px; padding: 0 8px; }
.ide-shot-bar i { width: 18px; height: 4px; border-radius: 2px; }
.ide-shot-rstudio .ide-shot-bar { background: #fbfbfc; border: 1px solid #c9ced4; border-bottom: 0; }
.ide-shot-rstudio .ide-shot-bar i { background: #cfd5dc; }
.ide-shot-spyder .ide-shot-bar { background: #263340; border: 1px solid #32414b; border-bottom: 0; }
.ide-shot-spyder .ide-shot-bar i { background: #455364; }
.ide-shot-grid { display: grid; gap: 4px; height: 138px; padding: 4px 4px 0; }
.ide-shot-rstudio .ide-shot-grid { grid-template: 'src env' 1.15fr 'con files' 1fr / 1.2fr 1fr; background: #dfe3e8; border: 1px solid #c9ced4; border-top: 0; border-bottom: 0; }
.ide-shot-spyder .ide-shot-grid { grid-template: 'ed vars' 1fr 'ed con' 1fr / 1.2fr 1fr; background: #19232d; border: 1px solid #32414b; border-top: 0; border-bottom: 0; }
.ide-shot-p { position: relative; overflow: hidden; border-radius: 3px 3px 0 0; padding: 3px 7px; font-size: 0.7rem; font-weight: 600; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
/* (a few lines of "code" or "output" in each pane, under its name) */
.ide-shot-p::after { content: ''; position: absolute; left: 8px; right: 30%; top: 22px; bottom: 6px; background: repeating-linear-gradient(to bottom, currentColor 0 2px, transparent 2px 9px); opacity: 0.16; }
.ide-shot-rstudio .ide-shot-p { background: #fff; color: #4a5561; box-shadow: inset 0 17px 0 #eef0f3; }
.ide-shot-spyder .ide-shot-p { background: #19232d; color: #c4ccd5; border: 1px solid #32414b; box-shadow: inset 0 17px 0 #263340; }
.ide-shot-p.src { grid-area: src; }
.ide-shot-p.env { grid-area: env; }
.ide-shot-p.con { grid-area: con; }
.ide-shot-p.files { grid-area: files; }
.ide-shot-p.ed { grid-area: ed; }
.ide-shot-p.vars { grid-area: vars; }
.ide-shot-spyder .ide-shot-p.ed::after { right: 22%; opacity: 0.22; background: repeating-linear-gradient(to bottom, #57d6e4 0 2px, transparent 2px 9px, #c670e0 9px 11px, transparent 11px 18px, #b0e686 18px 20px, transparent 20px 27px); }

/* code that the AI assistant has just put into a script in RStudio or Spyder: lit up for a moment */
.CodeMirror .ai-inserted { background: rgba(140, 95, 208, 0.22); }

@container bench (max-width: 640px) {
  .ide-launch-in { padding: 18px 16px 40px; }
  .ide-helpbtn span { display: none; }
}
