/* Tear sheet base theme: warm paper, black ink, one burnt-orange accent. Fonts: Inter + IBM Plex Mono (OFL). */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/vendor/inter-400.woff2) format('woff2'), url(/vendor/inter-400.woff) format('woff'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(/vendor/inter-600.woff2) format('woff2'), url(/vendor/inter-600.woff) format('woff'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(/vendor/inter-700.woff2) format('woff2'), url(/vendor/inter-700.woff) format('woff'); }
@font-face { font-family: 'Plex Mono'; font-weight: 400; font-display: swap; src: url(/vendor/ibm-plex-mono-400.woff2) format('woff2'), url(/vendor/ibm-plex-mono-400.woff) format('woff'); }
@font-face { font-family: 'Plex Mono'; font-weight: 500; font-display: swap; src: url(/vendor/ibm-plex-mono-500.woff2) format('woff2'), url(/vendor/ibm-plex-mono-500.woff) format('woff'); }
@font-face { font-family: 'Plex Mono'; font-weight: 600; font-display: swap; src: url(/vendor/ibm-plex-mono-600.woff2) format('woff2'), url(/vendor/ibm-plex-mono-600.woff) format('woff'); }

:root {
  --desk: #e7e0d3;
  --paper: #f3ede2;
  --card: #fbf8f2;
  --ink: #1b1b1b;
  --ink-2: #3a3833;
  --muted: #6b655b;
  --rule: #9b9384;
  --hair: #d6cebf;
  --accent: #c4420e;
  --up: #2f7a4a;
  --down: #b23a2e;
  --amber: #f0a020;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --bar-h: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: inherit; }
.ico { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }

/* ---------- Panels (one per section; the header toggles it) ---------- */
.panel { --rule-color: var(--ink); --code-color: var(--accent); background: var(--paper); position: relative; }
.panel.tinted { --rule-color: var(--tint); --code-color: var(--tint); }
.panel-head {
  display: flex; align-items: baseline; gap: 10px;
  border-top: 3px solid var(--rule-color); border-bottom: 1px solid var(--ink);
  padding: 6px 0 5px; user-select: none;
  font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase;
}
.panel-head .ico { align-self: center; }
.panel-title { flex: 1; min-width: 0; margin: 0; font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-code { color: var(--code-color); flex: none; }
.panel-controls { display: flex; gap: 2px; flex: none; align-self: center; }
.panel-controls button {
  font: 600 12px var(--mono); color: var(--ink); background: none; border: 0; padding: 2px 4px; min-width: 0; min-height: 0; cursor: pointer;
}
.admin .panel-controls button:hover { color: var(--accent); }
.panel-body { padding: 12px 0 2px; }
.panel.collapsed .panel-body, .panel.collapsed .panel-foot, .panel.collapsed .menu-bar { display: none; }
.menu-bar { display: none; }

.panel-foot { display: flex; gap: 12px; border-top: 1px solid var(--hair); margin-top: 10px; padding: 6px 0 0; font: 400 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.foot-field { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-field.fit { flex: none; }
.foot-field:last-child:not(:first-child) { text-align: right; }

/* ---------- Controls ---------- */
button, .btn {
  font: 500 13px var(--mono); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink);
  background: var(--card); border: 1px solid var(--ink); border-radius: 0;
  min-height: 40px; padding: 6px 14px;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  -webkit-appearance: none; appearance: none; touch-action: manipulation;
  transition: background-color 0.12s, color 0.12s;
}
/* Hover colors are for the admin only; the public page keeps its colors on hover. */
.admin button:hover, .admin .btn:hover { background: var(--ink); color: var(--paper); }
.btn.sm, button.sm { min-height: 34px; padding: 4px 11px; font-size: 12px; gap: 6px; }
button:active, .btn:active, button.active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.default, .btn.default { background: var(--ink); color: var(--paper); }
.admin button.default:hover, .admin .btn.default:hover { background: var(--accent); border-color: var(--accent); }
button:disabled { color: var(--rule); border-color: var(--hair); background: transparent; cursor: default; transform: none; }
.go { font-family: var(--mono); font-weight: 600; letter-spacing: 0; white-space: nowrap; }

input[type=text], input[type=url], input[type=password], input[type=tel], input[type=email], input[type=number], textarea, select {
  font: 400 16px var(--sans); color: var(--ink);
  background: var(--card); border: 1px solid var(--ink); border-radius: 0;
  padding: 9px 10px; width: 100%;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: #a39b8c; }
textarea { line-height: 1.5; resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select {
  padding-right: 34px; font-family: var(--mono); font-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0h12L6 8z' fill='%231b1b1b'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; min-height: 34px; user-select: none; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box { width: 18px; height: 18px; background: var(--card); border: 1px solid var(--ink); display: grid; place-items: center; flex: none; }
.check input:checked + .box { background: var(--ink); }
.check input:checked + .box::after { content: ''; width: 10px; height: 6px; border: solid var(--paper); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

fieldset { min-width: 0; border: 1px solid var(--ink); padding: 16px 12px 12px; margin: 0; position: relative; background: var(--paper); }
legend { background: var(--paper); padding: 0 6px; font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }

hr.etched { border: 0; border-top: 1px solid var(--hair); margin: 12px 0; }

/* ---------- Dialog overlay ---------- */
.overlay { position: fixed; inset: 0; background: rgba(27, 27, 27, 0.4); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; z-index: 1000; }
.overlay[hidden] { display: none; }
.dialog { width: min(380px, 100%); padding: 0 16px 16px; border: 1px solid var(--ink); box-shadow: 6px 6px 0 rgba(27, 27, 27, 0.18); }
.dialog .dialog-content { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0 14px; font-size: 15px; line-height: 1.5; }
.dialog .dialog-content .ico { color: var(--accent); }
.dialog .dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.shake { animation: shake 0.3s; }
@keyframes blink { 50% { opacity: 0.2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
