/* Editor chrome. Deliberately plain: the interesting pixels belong to the
 * preview, which has to look like paper, not like an app. */

:root {
  --ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --bg: #1d1f21;
  --panel: #26282b;
  --edge: #35383c;
  --text: #e6e6e6;
  --dim: #9a9ea3;
  --accent: #b3261e;
  --warn: #d99b1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
  font: 14px/1.4 var(--ui);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ------------------------------------------------------------------ bar */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 4px;
}

.brand span {
  color: var(--dim);
  font-weight: 400;
}

.spacer {
  flex: 1 1 auto;
}

button,
select {
  font: inherit;
  color: var(--text);
  background: #303336;
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 5px 11px;
  cursor: pointer;
}

button:hover,
select:hover {
  background: #3a3e42;
}

button.primary {
  background: #3b6ea5;
  border-color: #4a80bb;
}

button.primary:hover {
  background: #4479b3;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--edge);
  border-radius: 5px;
  overflow: hidden;
}

.seg button {
  border: 0;
  border-radius: 0;
  background: #2a2d30;
}

/* Active mode is neutral blue — except Key, which keeps the red used for
 * answers throughout the printed page. Seeing red in the toolbar should mean
 * "you are looking at the answer key", which is exactly the thing not to
 * photocopy thirty times. */
.seg button.on {
  background: #3b6ea5;
}

.seg button#mode-key.on {
  background: var(--accent);
}

.status {
  font-size: 12.5px;
  color: var(--dim);
}

.status .bad {
  color: var(--warn);
}

/* ---------------------------------------------------------------- panes */

.panes {
  display: grid;
  grid-template-columns: minmax(320px, 40%) 1fr;
  min-height: 0;
}

.left {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  border-right: 1px solid var(--edge);
}

#source {
  width: 100%;
  height: 100%;
  resize: none;
  border: 0;
  outline: none;
  padding: 14px 16px;
  font: 13px/1.55 var(--mono);
  color: var(--text);
  background: #212326;
  tab-size: 3;
}

.warnings {
  border-top: 1px solid var(--edge);
  background: var(--panel);
  max-height: 34vh;
  overflow: auto;
}

.warnings-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--edge);
  position: sticky;
  top: 0;
  background: var(--panel);
}

.warnings ul {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.warnings li {
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  align-items: baseline;
}

.warnings li:hover {
  background: #2f3236;
}

.warnings .ln {
  color: var(--warn);
  font: 11.5px var(--mono);
  flex: 0 0 auto;
  min-width: 42px;
}

.warnings .clean {
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--dim);
}

.warnings code {
  font: 11.5px var(--mono);
  background: #34373b;
  padding: 0 3px;
  border-radius: 3px;
}

.right {
  min-width: 0;
  overflow: auto;
  background: #ececed;
}

#preview {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ececed;
}

@media (max-width: 820px) {
  .panes {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .left {
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }
}

/* ---------------------------------------------------------------- guide
 *
 * A teacher-facing reference, on top of the editor rather than on another
 * page: every snippet and every design in it acts on the document already
 * open, so reading the guide and trying the thing are the same gesture.
 */

.guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 3vh 3vw;
  z-index: 50;
}

.guide-overlay[hidden] {
  display: none;
}

.guide-panel {
  background: #fbfbfa;
  color: #1b1b1b;
  width: min(58rem, 100%);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.guide-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #ececea;
  border-bottom: 1px solid #d8d8d4;
}

.guide-title {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.guide-bar button {
  color: #1b1b1b;
  background: #fff;
  border-color: #cfcfca;
}

.guide-bar button:hover {
  background: #f2f2ee;
}

.guide-body {
  overflow: auto;
  padding: 22px 34px 60px;
  font: 15px/1.6 var(--ui);
  scroll-behavior: smooth;
}

.guide-body h1 {
  font-size: 26px;
  margin: 6px 0 4px;
}

.guide-body h2 {
  font-size: 19px;
  margin: 34px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddddd8;
}

.guide-body h3 {
  font-size: 15.5px;
  margin: 22px 0 4px;
}

.guide-body p {
  margin: 8px 0;
  max-width: 44rem;
}

.guide-body a {
  color: #8c1d18;
}

.g-lede {
  font-size: 16.5px;
  color: #3a3a3a;
}

.guide-body code {
  font: 13px var(--mono);
  background: #ececea;
  border: 1px solid #dededa;
  border-radius: 3px;
  padding: 0 4px;
}

.guide-body kbd {
  font: 12px var(--mono);
  background: #fff;
  border: 1px solid #c6c6c0;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

.g-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 0 14px;
  border-bottom: 1px solid #e2e2dd;
  margin-bottom: 8px;
  font-size: 13px;
}

.g-callout {
  background: #fdf6e8;
  border: 1px solid #e8d9b4;
  border-left: 3px solid #c99a2e;
  padding: 11px 14px;
  margin: 14px 0;
  max-width: 44rem;
}

.g-tip {
  color: #4a4a4a;
  font-size: 14px;
  border-left: 3px solid #d5d5cf;
  padding-left: 11px;
}

/* A snippet with the button floated into its top-right corner. */
.g-snip {
  position: relative;
  margin: 12px 0 16px;
}

.g-snip pre {
  margin: 0;
  padding: 13px 15px;
  background: #24262a;
  color: #e9e9e6;
  border-radius: 6px;
  overflow-x: auto;
  font: 12.5px/1.55 var(--mono);
  white-space: pre;
}

.g-snip button {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  padding: 3px 9px;
  background: #3b6ea5;
  border-color: #4a80bb;
  color: #fff;
  opacity: 0.75;
}

.g-snip button:hover {
  opacity: 1;
  background: #4479b3;
}

.g-table {
  border-collapse: collapse;
  margin: 10px 0 4px;
  font-size: 14px;
  width: 100%;
  max-width: 44rem;
}

.g-table td {
  border-bottom: 1px solid #e4e4de;
  padding: 5px 10px 5px 0;
  vertical-align: top;
}

.g-table td:first-child {
  width: 12rem;
  white-space: nowrap;
}

.g-cheat td:first-child {
  width: 11rem;
}

.g-list {
  max-width: 44rem;
  padding-left: 20px;
}

.g-list li {
  margin: 6px 0;
}

/* Clickable design and font choices. */
.g-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 8px;
  margin: 12px 0;
  max-width: 46rem;
}

.g-grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.g-grid button {
  display: block;
  text-align: left;
  background: #fff;
  border: 1px solid #dcdcd6;
  color: #1b1b1b;
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
}

.g-grid button:hover {
  background: #f3f6fa;
  border-color: #9fb8d4;
}

.g-grid button b {
  display: block;
  font: 13px var(--mono);
  color: #8c1d18;
  margin-bottom: 2px;
}

.g-grid button span {
  display: block;
  font-size: 12.5px;
  color: #4a4a4a;
  line-height: 1.4;
}
