/* Keo's pages outside class: a classroom after dark. The whole room is the board, green-black and dusted with chalk,
   lit by one warm lamp. Nothing sits in boxes; words are written straight on the room, and hairlines are chalk lines.
   The class page keeps its own keo.css. */
:root {
  --night: #0b0e0d;       /* the room, which is the board */
  --rail: #0e1211;        /* the side panel */
  --fill: #141918;        /* where you write */
  --fill-2: #1a201f;
  --hair: rgba(236, 235, 228, .08);
  --hair-2: rgba(236, 235, 228, .14);
  --chalk: #ecebe4;
  --dim: #9ba29d;
  --faint: #626a65;
  --amber: #f0a83a;       /* the lamp */
  --glow: rgba(240, 168, 58, .16);
  --red: #f08c7b;
  --green: #8fd3a5;
  --side: 248px;
  --r: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--night); }
body { margin: 0; min-height: 100vh; color: var(--chalk); font: 400 15.5px/1.6 "Hanken Grotesk", system-ui, sans-serif;
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
       background: radial-gradient(1100px 620px at 78% -12%, rgba(240, 168, 58, .075), transparent 62%),
                   radial-gradient(900px 700px at -10% 110%, rgba(120, 160, 140, .05), transparent 60%), var(--night); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55;  /* chalk dust from earlier lessons */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
[hidden] { display: none !important; }
::selection { background: var(--glow); }
a { color: var(--chalk); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--hair-2); }
a:hover { text-decoration-color: var(--chalk); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-weight: 500; color: var(--chalk); }
h1 { font-size: clamp(36px, 4.2vw, 54px); line-height: 1.04; letter-spacing: -.035em; }
h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 15.5px; }
p { margin: 0; }
.dim { color: var(--dim); }
.small { font-size: 13.5px; }

/* buttons: a stick of chalk for the one thing to press; a chalk outline for the rest */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 40px; padding: 0 18px; border-radius: 999px;
       font: 500 14.5px/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
       border: 1px solid var(--hair-2); background: transparent; color: var(--chalk);
       transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .3s var(--ease), transform .12s var(--ease); }
.btn:hover:not(:disabled) { border-color: rgba(236, 235, 228, .32); background: rgba(236, 235, 228, .04); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary { background: var(--chalk); color: #101413; border-color: var(--chalk); }
.btn.primary:hover:not(:disabled) { background: #fff; border-color: #fff; }
.btn.big { height: 56px; padding: 0 30px; font-size: 16.5px; }
.btn.lit { box-shadow: 0 0 0 1px rgba(240, 168, 58, .25), 0 18px 50px -12px rgba(240, 168, 58, .45); }
.btn.lit:hover:not(:disabled) { box-shadow: 0 0 0 1px rgba(240, 168, 58, .45), 0 22px 60px -10px rgba(240, 168, 58, .6); }
.btn.danger { color: var(--red); border-color: rgba(240, 140, 123, .3); }
.btn.danger:hover:not(:disabled) { border-color: var(--red); background: rgba(240, 140, 123, .08); }
.btn.quiet { border-color: transparent; color: var(--dim); }
.btn.quiet:hover:not(:disabled) { color: var(--chalk); border-color: transparent; }

input[type=text], input[type=password], select, textarea {
  width: 100%; background: var(--fill); color: var(--chalk); border: 1px solid transparent; border-radius: var(--r);
  box-shadow: inset 0 0 0 1px var(--hair); padding: 10px 14px; min-height: 44px; font: inherit; font-size: 15px;
  transition: box-shadow .2s var(--ease), background .2s var(--ease); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { background: var(--fill-2); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--fill-2); box-shadow: inset 0 0 0 1px rgba(240, 168, 58, .55), 0 0 0 4px rgba(240, 168, 58, .1); }
textarea { line-height: 1.65; resize: vertical; padding: 14px 16px; }
select { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: #161b1a; }
label { display: block; font-weight: 500; font-size: 13.5px; margin-bottom: 8px; color: var(--dim); }

/* the side panel */
.side { position: fixed; z-index: 10; inset: 0 auto 0 0; width: var(--side); display: flex; flex-direction: column; padding: 22px 14px 16px;
        background: linear-gradient(180deg, rgba(14, 18, 17, .9), rgba(11, 14, 13, .9)); border-right: 1px solid var(--hair); backdrop-filter: blur(10px); }
.side .mark { display: block; padding: 4px 12px 26px; }
.side .mark canvas { height: 34px; width: auto; display: block; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: 9px;
              text-decoration: none; color: var(--dim); font-weight: 500; font-size: 14.5px; transition: color .15s, background .15s; }
.side nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.side nav a:hover { color: var(--chalk); background: rgba(236, 235, 228, .035); }
.side nav a[aria-current=page] { color: var(--chalk); background: rgba(236, 235, 228, .06); }
.side nav a[aria-current=page]::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px;
                                         background: var(--amber); box-shadow: 0 0 12px 2px var(--glow); }
.side .menu { display: none; }
/* the student's classes, newest first, below the pages; only this part scrolls */
.side .classes { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 26px -6px 0; }
.side .classes h2 { font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--faint); padding: 0 18px 8px; }
.side .list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 12px; scrollbar-width: thin; scrollbar-color: rgba(236, 235, 228, .12) transparent;
              mask-image: linear-gradient(180deg, #000 calc(100% - 24px), transparent); }
.side .list a { position: relative; display: block; padding: 7px 12px; border-radius: 8px; color: var(--dim); font-size: 14px; line-height: 1.45;
                text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s, background .15s; }
.side .list a:hover { color: var(--chalk); background: rgba(236, 235, 228, .035); }
.side .list a[aria-current=page] { color: var(--chalk); background: rgba(236, 235, 228, .06); }
.side .list .none { color: var(--faint); font-size: 13px; padding: 4px 12px; }
/* the right edge: drag it to make the panel wider or narrower */
.side .grip { position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; touch-action: none; }
.side .grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: var(--amber); opacity: 0; transition: opacity .15s; }
.side .grip:hover::after, .side .grip:focus-visible::after, .sizing .side .grip::after { opacity: .55; }
.side .grip:focus-visible { outline: none; }
.sizing, .sizing * { cursor: col-resize !important; user-select: none; }
.side .who { display: flex; align-items: center; gap: 11px; padding: 14px 10px 4px; border-top: 1px solid var(--hair); }
.side .who .name { font-weight: 500; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .who .mail { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .who > div { min-width: 0; flex: 1; }
.side .out { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 6px; border-radius: 7px; display: grid; place-items: center; }
.side .out:hover { color: var(--chalk); background: rgba(236, 235, 228, .06); }
.side .out svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--fill-2); object-fit: cover; display: grid; place-items: center; flex: none;
          font-weight: 600; font-size: 13px; color: var(--dim); box-shadow: 0 0 0 1px var(--hair-2); }

/* the page, to the right of the side panel */
.page { position: relative; z-index: 1; margin-left: var(--side); max-width: calc(1080px + var(--side)); padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 72px) 120px; }
.page.narrow { max-width: calc(900px + var(--side)); }
.head { margin-bottom: clamp(40px, 6vw, 64px); }
.head p { margin-top: 14px; color: var(--dim); max-width: 52ch; font-size: 16.5px; }

/* sections are written straight on the room: what it is on the left, what to do on the right, a chalk line between */
.sect { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px 64px; padding: 40px 0; border-top: 1px solid var(--hair); }
.head + .sect { border-top: 0; padding-top: 0; }
.sect > .about p { margin-top: 8px; color: var(--dim); font-size: 14.5px; max-width: 32ch; }
.panel { position: relative; }
.panel + .panel { margin-top: 48px; }
.panel h2 + p { margin-top: 6px; color: var(--dim); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.say { font-size: 13.5px; color: var(--dim); min-height: 1.4em; }
.say.ok { color: var(--green); }
.say.bad { color: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--dim); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.on { color: var(--green); } .chip.on::before { box-shadow: 0 0 10px rgba(143, 211, 165, .6); }
.chip.off { color: var(--red); }
.chip.plain::before { display: none; }

/* a key on the settings page */
.key { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center; }
.key + .key { margin-top: 32px; }
.key .about { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.key .about label { margin: 0; font-size: 15.5px; color: var(--chalk); }
.key .about p { color: var(--dim); font-size: 14px; flex-basis: 100%; }
.key .say { grid-column: 1 / -1; min-height: 0; }
.setup { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* tables (admin): rows ruled in chalk, nothing around them */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--faint); padding: 0 16px 12px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.table td { padding: 15px 16px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table td.num { font-variant-numeric: tabular-nums; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(236, 235, 228, .025); }
.scroll { overflow-x: auto; }

@media (max-width: 900px) {
  .side { position: sticky; top: 0; inset: auto; width: auto; height: 60px; flex-direction: row; align-items: center; padding: 0 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--hair); }
  .side .mark { padding: 0 8px 0 4px; } .side .mark canvas { height: 24px; }
  .side nav { flex-direction: row; } .side nav a { padding: 0 10px; } .side nav a span { display: none; }
  .side nav a[aria-current=page]::before { left: 10px; right: 10px; top: auto; bottom: -11px; width: auto; height: 2px; }
  .side .who { margin: 0; border: 0; padding: 0; } .side .who > div { display: none; }
  .side .grip { display: none; }
  .side .menu { display: grid; place-items: center; margin-left: auto; width: 38px; height: 38px; border: 0; border-radius: 9px; background: none; color: var(--dim); cursor: pointer; }
  .side .menu:hover, .side.open .menu { color: var(--chalk); background: rgba(236, 235, 228, .06); }
  .side .menu svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
  .side .classes { display: none; }
  .side.open .classes { display: flex; position: absolute; top: 60px; left: 0; right: 0; height: calc(100dvh - 60px); margin: 0; padding: 18px 12px 0;
                        background: var(--night); }
  .page, .page.narrow { margin-left: 0; max-width: none; }
  .sect { grid-template-columns: 1fr; gap: 16px; padding: 32px 0; }
  .setup { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
