/* CLIP stylesheet. The rules behind every choice here are in DESIGN.md.
   Change the spec first, then this file. */

@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Surfaces: neutral blacks, no blue tint */
  --bg: #111111;
  --field: #000000;
  --rule: #3d3d3d;
  --edge: #8c8c8c;

  /* Text */
  --text: #f4f2ee;
  --muted: #b5b2ab;
  --ink: #111111;
  --paper: #f4f2ee;

  /* Safety colors. Each has one meaning (DESIGN.md, "Color"). */
  --green: #35c46a;
  --red: #d7282f;
  --red-text: #ff7b72;
  --yellow: #ffcc00;

  --radius: 4px;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --sign: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 1rem/1.4 var(--body);
}
[hidden] { display: none !important; }

/* ----- Top bar: the logo is the only brand red ----- */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--rule);
}
.bar img { display: block; height: 26px; width: auto; }
.bar .app, .bar .where {
  font: 700 1.25rem/1 var(--sign);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bar .where { margin-left: auto; color: var(--muted); font-size: 0.95rem; }

/* Managers' menu, at the right end of the top bar */
.menu { position: relative; border: 0; margin: -6px -8px -6px 0; }
.menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.menu summary::-webkit-details-marker { display: none; }
.menu svg { fill: var(--text); }
.menu[open] summary { background: var(--paper); }
.menu[open] svg { fill: var(--ink); }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  width: max-content;
  min-width: 16rem;
  max-width: calc(100vw - 16px);
  background: var(--bg);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
}
.menu-list > * {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  color: var(--text);
  font: 700 1rem/1.25 var(--body);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-list > :first-child { border-top: 0; }
.menu-list .menu-who { color: var(--muted); font-weight: 500; cursor: default; overflow-wrap: anywhere; }
.menu-list a:hover, .menu-list button:hover { background: var(--paper); color: var(--ink); }

.wrap {
  max-width: 32rem;
  margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}
.wrap.wide { max-width: 64rem; }

/* ----- Type ----- */
h1, h2, legend, .label, .eyebrow, th, button, .yn label, .tag, summary {
  font-family: var(--sign);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
h1 { font-size: 2.1rem; line-height: 1.05; margin: 0 0 8px; }
h2 { font-size: 1.35rem; line-height: 1.1; margin: 32px 0 10px; }
.group { margin-bottom: 40px; }
.group h2 { margin-top: 12px; color: var(--muted); }
.print-only { display: none; }
p { margin: 0 0 10px; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 1rem; letter-spacing: 0.08em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.last { margin: 12px 0 0; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.head { margin-bottom: 20px; }

/* ----- Notices: solid blocks, like a sign ----- */
.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 16px;
  font-weight: 700;
}
.notice.caution { background: var(--yellow); color: var(--ink); }
.notice.error { background: var(--red); color: #ffffff; }

/* ----- Form: ruled rows, not cards ----- */
fieldset.item, .field {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
  padding: 16px 0 18px;
  min-width: 0;
}
legend, .label {
  display: block;
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 10px;
  font-size: 1.3rem;
  line-height: 1.15;
}
legend + *, .label + * { clear: both; }
.label .hint {
  font: 500 0.9rem/1.3 var(--body);
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}
.bad > legend, .bad > .label { color: var(--red-text); }
.field-error { color: var(--red-text); font-weight: 700; margin: 10px 0 0; }

.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.yn label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 64px;
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.yn input:checked + label.yes { background: var(--green); border-color: var(--green); color: var(--ink); }
.yn input:checked + label.no { background: var(--red); border-color: var(--red); color: #ffffff; }
.yn input:checked + label.yes::before { content: "✓"; }
.yn input:checked + label.no::before { content: "✕"; }

input[type="text"], textarea {
  display: block;
  width: 100%;
  font: 500 1.1rem/1.35 var(--body);
  color: var(--text);
  background: var(--field);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  padding: 12px;
}
input[type="text"] { min-height: 56px; }
.bad input[type="text"], .bad textarea { border-color: var(--red-text); }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  min-height: 48px;
  cursor: pointer;
}
.check input { width: 28px; height: 28px; flex: none; margin: 0; accent-color: var(--paper); }

button[type="submit"] {
  display: block;
  width: 100%;
  min-height: 68px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
}
button[type="submit"]:disabled { background: var(--edge); }

/* One focus style everywhere */
:focus-visible, .yn input:focus-visible + label {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

/* ----- Confirmation: one large sign ----- */
.sign {
  border-radius: var(--radius);
  background: var(--green);
  color: var(--ink);
  padding: 28px 20px 24px;
  margin: 4px 0 20px;
}
.sign.problem { background: var(--red); color: #ffffff; }
.sign .mark { font: 700 5rem/0.9 var(--sign); margin: 0 0 8px; }
.sign h1 { font-size: 3.2rem; line-height: 0.95; margin: 0; }
.facts { margin: 0 0 20px; }
.facts div { border-top: 1px solid var(--rule); padding: 10px 0; }
.facts dt { font: 700 0.9rem/1.2 var(--sign); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; }

/* ----- Managers ----- */
.rows { list-style: none; padding: 0; margin: 0 0 24px; border-bottom: 1px solid var(--rule); }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main { gap: 4px; }
.row-main strong { font: 700 1.05rem/1.25 var(--body); }

.tag {
  display: inline-block;
  padding: 6px 10px 5px;
  border-radius: 2px;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border: 2px solid var(--edge);
}
.tag.done { background: var(--green); border-color: var(--green); color: var(--ink); }
.tag.due { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.tag.problem, .tag.overdue { background: var(--red); border-color: var(--red); color: #ffffff; }

details { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 0 12px; }
summary { cursor: pointer; padding: 14px 0; font-size: 1.1rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 14px 10px 0; border-top: 1px solid var(--rule); vertical-align: top; }
th { font-size: 0.9rem; letter-spacing: 0.06em; color: var(--muted); border-top: 0; }
td.no-cell { color: var(--red-text); font-weight: 700; }

/* ----- Paper: black on white, nothing that is only for the screen ----- */
@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #000000;
    --muted: #333333;
    --rule: #999999;
    --edge: #000000;
    --red-text: #000000;
  }
  html { font-size: 11pt; }
  .wrap, .wrap.wide { max-width: none; padding: 12pt 0 0; }
  .bar { padding: 0 0 8pt; border-bottom: 1pt solid #000; }
  .bar .where, .menu, .no-print { display: none !important; }
  .print-only { display: block; }
  .tag, .tag.done, .tag.due, .tag.problem, .tag.overdue {
    background: none;
    color: #000;
    border: 1pt solid #000;
  }
  .scroll { overflow: visible; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  a { text-decoration: none; }
}
