/* Falaj panel — HyperCard / classic-Mac skin.
   1-bit black & white, hard-edged drop shadows, bordered "windows" with lined
   title bars, rounded-rect buttons with a pressed state. Served
   content-addressed (hashed filename) so a deploy busts the cache. */

:root {
  --ink: #141414;
  --paper: #fff;
  --desk: #ededed;
  --muted-ink: #4a4a4a;
  --shadow: 3px 3px 0 var(--ink);
  --font: Geneva, "Lucida Grande", Tahoma, Verdana, system-ui, sans-serif;
  --mono: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  /* Modern dot-dither backdrop: a fine ordered dot texture that tiles evenly
     behind the cards. A faint fixed vignette adds depth without darkening tall
     pages (per-layer attachment: dots tile, vignette stays on the viewport). */
  background-color: var(--desk);
  background-image:
    radial-gradient(rgba(20, 20, 20, 0.11) 0.9px, transparent 1px),
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0.03));
  background-size: 8px 8px, 100% 100%;
  background-attachment: scroll, fixed;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

h1 { font-size: 1.5rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
p { margin: 0.5rem 0; }
.muted { color: var(--muted-ink); }
.small { font-size: 0.85rem; }
/* view-count text bars (§2.14): glyph runs, no inline styles (CSP) */
.bars { letter-spacing: -2px; white-space: nowrap; }

/* ---- layout -------------------------------------------------------------- */
main { max-width: 56rem; margin: 0 auto; padding: 1.25rem 1.25rem 0; }

/* ---- footer (identity + sign out; replaces the top menu bar) ------------- */
.footer {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: 56rem; margin: 1.5rem auto 2.5rem; padding: 0.9rem 1.25rem 0;
  border-top: 2px solid var(--ink);
  font-size: 0.85rem; color: var(--muted-ink);
}
.footer .brand { font-weight: 700; letter-spacing: 0.02em; color: var(--ink); }
.footer .spacer { margin-left: auto; }
.footer .who { white-space: nowrap; }
.footer form.inline button { padding: 0.25rem 0.7rem; }

/* ---- window / card ------------------------------------------------------- */
.window {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  margin: 0 0 1.25rem;
}
.window > .titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.3rem 0.6rem 0.3rem 0.8rem;
  border-bottom: 2px solid var(--ink);
  background: #f2f2f2;
}
.window > .titlebar .title {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.window > .titlebar .close { display: none; }
/* compact action button that sits in a window's title bar (top-right) */
.titlebar-action button {
  font: inherit; font-size: 0.72rem; font-weight: 700; text-transform: none; letter-spacing: 0;
  cursor: pointer; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 6px; padding: 0.15rem 0.55rem;
  box-shadow: 1px 1px 0 var(--ink); -webkit-appearance: none; appearance: none;
}
.titlebar-action button:hover { background: #e9e9e9; }
.titlebar-action button:active { transform: translate(1px, 1px); box-shadow: none; }
.window > .body { padding: 1rem; }

/* plain card (no titlebar) */
.card {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin: 0 0 1.25rem;
}

/* ---- buttons ------------------------------------------------------------- */
button, .btn {
  display: inline-block;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 9px;
  padding: 0.4rem 0.9rem;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  -webkit-appearance: none; appearance: none;
}
button:hover, .btn:hover { background: #f0f0f0; color: var(--ink); text-decoration: none; }
button:active, .btn:active { transform: translate(1.5px, 1.5px); box-shadow: none; }
button:focus-visible, .btn:focus-visible { outline: 2px dotted var(--ink); outline-offset: 2px; }
button.default { border-width: 3px; }      /* the default/primary action */
button.ghost { box-shadow: none; font-weight: 400; }
button.danger:hover { background: var(--ink); color: var(--paper); }

/* ---- form controls ------------------------------------------------------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 0;
  padding: 0.4rem 0.5rem;
}
input:focus, select:focus, textarea:focus { outline: 2px dotted var(--ink); outline-offset: 1px; }
label { font-weight: 700; display: inline-flex; gap: 0.4rem; align-items: center; }
.field { display: flex; flex-direction: column; gap: 0.25rem; align-items: stretch; font-weight: 700; }
.field input, .field select { font-weight: 400; height: 2.15rem; }
form.inline { display: inline; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ---- tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 2px solid var(--ink); box-shadow: var(--shadow); background: var(--paper); }
/* A table inside a window: the window already frames it — no nested border. */
.window .table-wrap { border: none; box-shadow: none; }
.window > .body:has(> .table-wrap:only-child) { padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1.5px solid var(--ink); vertical-align: middle; }
thead th { border-bottom: 2px solid var(--ink); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f3f3f3; }

/* ---- tags ---------------------------------------------------------------- */
.tag {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 0.05rem 0.4rem; border: 1.5px solid var(--ink);
  text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.tag.live { background: var(--ink); color: var(--paper); }
.tag.frozen { background: repeating-linear-gradient(45deg, var(--ink) 0 2px, var(--paper) 2px 5px); }

/* ---- code / secrets ------------------------------------------------------ */
code { font-family: var(--mono); background: #fafafa; border: 1px solid var(--ink); padding: 0 0.25rem; font-size: 0.85em; }
.secret { font-family: var(--mono); word-break: break-all; background: var(--paper); border: 2px dashed var(--ink); padding: 0.6rem; }
hr { border: none; border-top: 2px solid var(--ink); margin: 1rem 0; }
.divider { border-top: 1px solid #ddd; margin: 0.9rem 0; }

/* ---- deploy dropzone ----------------------------------------------------- */
.dropzone {
  border: 3px dashed var(--ink); background: var(--paper);
  padding: 1.75rem 1rem; text-align: center; cursor: pointer; user-select: none;
}
.dropzone:hover { background: #f4f4f4; }
.dropzone.drag { background: var(--ink); color: var(--paper); }
.dropzone .big { font-size: 1.1rem; font-weight: 700; }
.dropzone .arrow { font-size: 1.8rem; line-height: 1; display: block; margin-bottom: 0.3rem; }
.dropzone .hint { font-size: 0.85rem; color: var(--muted-ink); }
.dropzone.drag .hint { color: var(--paper); }
.deploy-fields { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; justify-content: center; margin-bottom: 1rem; }
.deploy-fields .field { flex: 1 1 14rem; max-width: 20rem; }

/* agent/CI deploy guide (a disclosure in the tokens window) */
.deploy-log { white-space: pre-wrap; text-align: left; font-family: var(--mono); font-size: 0.8rem; margin: 0.75rem 0 0; min-height: 1.2rem; }
.deploy-log a { display: inline-block; margin-top: 0.3rem; font-family: var(--font); font-weight: 700; }

/* ---- settings list ------------------------------------------------------- */
.settings .setting-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem 1.25rem; flex-wrap: wrap; padding: 0.8rem 0; border-bottom: 1px solid #ddd;
}
.settings .setting-row:first-child { padding-top: 0; }
.settings .setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings .setting-label strong { display: block; }
.settings .setting-label .muted { font-size: 0.85rem; }
.settings form.inline, .settings .actions { margin: 0; }

/* ---- sub-navigation (back link + primary action) ------------------------- */
.subnav { display: flex; align-items: center; gap: 0.9rem; margin: 0.25rem 0 1.25rem; flex-wrap: wrap; }
.subnav .back { text-decoration: none; font-weight: 700; }
.subnav .back:hover { background: none; color: var(--ink); text-decoration: underline; }

/* ---- empty state --------------------------------------------------------- */
.empty { text-align: center; color: var(--muted-ink); padding: 1.5rem; }

/* ---- login (centered) ---------------------------------------------------- */
.login-wrap { max-width: 22rem; margin: 12vh auto; padding: 0 1rem; }
.login-wrap .window > .body { padding: 1.25rem; }
.login-wrap .field, .login-wrap label { width: 100%; }
.login-wrap input, .login-wrap button { width: 100%; margin: 0.35rem 0; }
.center-card { max-width: 26rem; margin: 12vh auto; padding: 0 1rem; }

/* ---- mobile -------------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 0.8rem; }
  h1 { font-size: 1.3rem; }
  .footer { flex-wrap: wrap; gap: 0.5rem; }
  .window, .card, .table-wrap { box-shadow: 2px 2px 0 var(--ink); }
  button, .btn { padding: 0.55rem 1rem; }        /* bigger tap targets */
  .deploy-fields { flex-direction: column; align-items: stretch; }
  .field, .field input, .field select { width: 100%; align-items: stretch; }
  th, td { padding: 0.45rem 0.5rem; font-size: 0.9rem; white-space: nowrap; }
}
