/*
 * The look shared by diarmid.tech's two pages: the hub (index.html, a static
 * file) and the sign-in page (rendered by apps/diarmid-auth). One stylesheet,
 * so the page you sign in on and the page you land on are visibly the same
 * place.
 *
 * Dark by default, at Bill's choice, with a switch at the foot of the page
 * for light. It does not follow the operating system: the switch is the one
 * control, and it is remembered per browser.
 *
 * The dark palette is a neutral near-black (#181818, the grey Bill picked
 * over the navy it replaced) with the products' dark-theme accents; every
 * text tone clears 4.5:1 on it. The light palette is the hub's previous
 * white one, unchanged.
 */
:root {
  color-scheme: dark;
  --bg: #181818;
  --surface: #202020;
  --ink: #ededed;
  --ink-soft: #b3b3b3;
  --ink-faint: #8e8e8e;
  --line: #2c2c2c;
  --line-hover: #454545;
  --field: #141414;
  --vexana: #6fa7e4;
  --lanaya: #b07ce8;
  --rubick: #3fbf6a;
  --kael: #ff8a3d;
  --btn: #ededed;
  --btn-ink: #181818;
  --danger: #ff8a98;
  --danger-wash: rgba(255, 138, 152, 0.1);
  --ok: #7ee2a8;
  --ok-wash: rgba(126, 226, 168, 0.1);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 18px 40px rgba(0, 0, 0, 0.45);

  /* Read by suite.js for the canvas: channels, so it can set its own alpha. */
  --vex-rgb: 111, 167, 228;
  --lan-rgb: 176, 124, 232;
  --rub-rgb: 63, 191, 106;
  --lime-rgb: 168, 224, 95;
  --ink-rgb: 237, 237, 237;
  --fx-strength: 1.7;

  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #101d35;
  --ink-soft: #46566e;
  --ink-faint: #607088;
  --line: #e7ebf1;
  --line-hover: #c3ccda;
  --field: #f4f6f9;
  --vexana: #2f6fb8;
  --lanaya: #6d3bb8;
  --rubick: #1f7a45;
  --kael: #c2410c;
  --btn: #101d35;
  --btn-ink: #ffffff;
  --danger: #b42335;
  --danger-wash: rgba(180, 35, 53, 0.08);
  --ok: #13774a;
  --ok-wash: rgba(19, 119, 74, 0.08);
  --card-shadow: 0 1px 2px rgba(16, 20, 35, 0.04), 0 6px 20px rgba(16, 20, 35, 0.06);
  --card-shadow-hover: 0 2px 4px rgba(16, 20, 35, 0.06), 0 14px 32px rgba(16, 20, 35, 0.12);
  --vex-rgb: 47, 111, 184;
  --lan-rgb: 109, 59, 184;
  --rub-rgb: 31, 122, 69;
  --lime-rgb: 92, 150, 34;
  --ink-rgb: 16, 29, 53;
  --fx-strength: 1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  /* Room at the foot for the theme switch, which floats there. */
  padding-block: 48px 104px;
  padding-inline: 20px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease;
}

/* The moving background and the soft clearing behind the words. The veil's
   centre follows whatever the page marks with data-anchor, set by suite.js. */
.backdrop { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 46% 40% at var(--ax, 50%) var(--ay, 46%),
    var(--bg) 0%,
    color-mix(in srgb, var(--bg) 70%, transparent) 45%,
    transparent 100%
  );
}
main { position: relative; z-index: 1; width: 100%; }

/* ---------- the hub ---------- */

.hub { max-width: 680px; text-align: center; }

/* The pack's wordmark numbers: weight 650 and -0.0366em. */
.hub h1 {
  margin: 0;
  font-size: clamp(38px, 8vw, 60px);
  font-weight: 650;
  letter-spacing: -0.0366em;
  line-height: 1.04;
  text-wrap: balance;
}

.tagline {
  margin: 12px 0 0;
  font-size: clamp(15px, 2.2vw, 18px);
  font-weight: 450;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
}
.tagline .who { color: var(--ink); font-weight: 600; }

/* Three products side by side; a card the account cannot open is hidden and
   the rest close up. */
/* Two by two: four products in three columns left the fourth alone on a row. */
.choices { display: grid; gap: 14px; margin-top: 38px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
@media (max-width: 560px) { .choices { grid-template-columns: minmax(0, 1fr); } }

/* The whole card is the link: one target with one name. Translucent, so the
   motion reads through it faintly and the cards sit in the scene. */
.choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--card-shadow);
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.choice:hover, .choice:focus-visible { border-color: var(--line-hover); box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 14 of 64 in the marks' own viewBox, resolved at 38px. */
.tile { width: 38px; height: 38px; flex-shrink: 0; border-radius: 8.3px; }
.name { font-size: 17px; font-weight: 600; letter-spacing: -0.012em; }
.what { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.go {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.go svg { transition: transform 0.15s ease; }
.choice:hover .go svg { transform: translateX(3px); }

.foot { margin: 30px 0 0; font-size: 12.5px; color: var(--ink-faint); }
.foot b { color: var(--ink-soft); font-weight: 600; }
.foot form { display: inline; }
.foot a, .foot button, .back {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--line-hover);
  text-underline-offset: 3px;
  cursor: pointer;
}
.foot a:hover, .foot button:hover, .back:hover { color: var(--ink); }

/* ---------- sign in ---------- */

.login-wrap { display: grid; justify-items: center; gap: 18px; }

.login {
  width: 100%;
  max-width: 380px;
  padding: 30px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--card-shadow);
  display: grid;
  gap: 16px;
}
.login .mark { width: 44px; height: 44px; border-radius: 10px; }
.login h1 { margin: 2px 0 0; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.login .sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }

.next {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: var(--field);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.next svg { width: 20px; height: 20px; border-radius: 5px; }
.next b { color: var(--ink); font-weight: 600; }

.field { display: grid; gap: 6px; }
.field label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.input { position: relative; }
.input input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.input input:focus { border-color: var(--ink-faint); background: var(--surface); }
.input input[aria-invalid="true"] { border-color: var(--danger); }
.input input#pass { padding-right: 64px; }
.peek {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.peek:hover { background: var(--line); color: var(--ink); }

.keep { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.keep input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }

.error { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--danger-wash); color: var(--danger); font-size: 13px; }
.notice { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--ok-wash); color: var(--ok); font-size: 13px; }
.hint { margin: 2px 0 0; font-size: 12px; color: var(--ink-faint); }

.submit {
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.submit:hover { opacity: 0.92; }
.submit:disabled { opacity: 0.6; cursor: progress; }

.back { font-size: 12.5px; }

.submit:focus-visible, .peek:focus-visible, .keep input:focus-visible,
.foot a:focus-visible, .foot button:focus-visible, .back:focus-visible {
  outline: 2px solid var(--vexana);
  outline-offset: 2px;
}

@media (max-width: 560px) { .login { padding: 24px 20px 22px; } }

/* ---------- not on the account ---------- */

.denied { gap: 14px; }
.denied-head { display: flex; align-items: center; gap: 14px; }
.denied-head svg { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; opacity: 0.75; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.denied h1 { margin: 2px 0 0; }
.denied .sub b { color: var(--ink); }
.denied-home { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.denied-out { display: flex; }

/* ---------- admin ---------- */

/* Wide and top-aligned, unlike the two cards above: it is a working page,
   not a form in the middle of a scene. */
.admin { width: 100%; max-width: 1180px; align-self: start; display: grid; gap: 26px; }

.admin-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 36px; height: 36px; border-radius: 9px; }
.brand b { display: block; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.brand span { font-size: 12px; color: var(--ink-faint); }
.admin-top .foot { margin: 0; }

.admin-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }

.admin-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.admin-h h1, .admin-h h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.admin-h span { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; text-align: right; }

.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.user-row { display: block; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; color: inherit; }
.user-row:hover { background: var(--field); }
.user-row.current {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-color: var(--line-hover);
  box-shadow: var(--card-shadow);
}
.user-row:focus-visible { outline: 2px solid var(--vexana); outline-offset: 2px; }
.user-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.user-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; font-weight: 600; }
.badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--btn); color: var(--btn-ink);
}
.badge.off { background: var(--danger-wash); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.user-display { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.chips .none { font-size: 12px; color: var(--ink-faint); }

.add { margin-top: 8px; border: 1px dashed var(--line-hover); border-radius: 12px; }
.add summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; padding: 0 14px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.add summary::-webkit-details-marker { display: none; }
.add summary:hover { color: var(--ink); }
.add[open] summary { border-bottom: 1px solid var(--line); }
.add form { display: grid; gap: 12px; padding: 14px; }
.add .submit { height: 42px; }

.admin-detail { display: grid; gap: 20px; }
.card {
  padding: 20px 24px; border: 1px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--card-shadow);
}
.card.empty p { margin: 0; font-size: 14px; color: var(--ink-faint); }
.who-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; }
.who h2 {
  margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 22px; font-weight: 650; letter-spacing: -0.01em;
}
.who-display { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.who-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.who-actions form { display: contents; }
.ghost {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  background: none; color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.ghost:hover { border-color: var(--line-hover); color: var(--ink); }
.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.ghost.danger:hover { background: var(--danger-wash); }
.ghost:focus-visible { outline: 2px solid var(--vexana); outline-offset: 2px; }

.access { display: grid; gap: 16px; }
.access .admin-h { margin: 8px 0 0; }
.dim { color: var(--ink-faint); font-weight: 400; }

.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.app {
  min-width: 0; display: grid; gap: 10px; align-content: start;
  padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}
.app-name { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex-shrink: 0; }
.app .what { margin: -4px 0 0; font-size: 12px; color: var(--ink-faint); }
.gate {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border-radius: 10px; background: var(--field); font-size: 14px; font-weight: 600; cursor: pointer;
}
.app input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); cursor: pointer; flex-shrink: 0; }
.app input:disabled { cursor: not-allowed; }
.features { display: grid; gap: 2px; padding: 0 2px; }
.features[data-closed] { opacity: 0.4; }
.flabel { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); padding: 4px 0 2px; }
.features label { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; cursor: pointer; }
.app.next { border-style: dashed; border-color: var(--line-hover); background: none; color: var(--ink-faint); align-content: center; gap: 6px; min-height: 200px; }
.app.next b { font-size: 14px; color: var(--ink-soft); }
.app.next p { margin: 0; font-size: 13px; line-height: 1.55; }

.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.actions .submit { height: 44px; padding: 0 18px; }
.actions .dim { font-size: 12px; }

.reveal { display: grid; gap: 6px; color: var(--ink); }
.reveal b { font-size: 13px; }
.reveal code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; font-weight: 600; letter-spacing: 0.04em; }
.reveal span { font-size: 12.5px; color: var(--ink-soft); }
.reveal span b { color: var(--ink); }

/* ---------- the theme switch ---------- */

.mode-toggle {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.mode-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.mode-toggle button:hover { color: var(--ink); }
.mode-toggle button[aria-pressed="true"] { background: var(--line); color: var(--ink); font-weight: 600; }
.mode-toggle button:focus-visible { outline: 2px solid var(--vexana); outline-offset: 1px; }
.mode-toggle svg { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  .choice, .choice:hover, .choice:focus-visible { transition: border-color 0.15s ease; transform: none; }
  .go svg { transition: none; }
  body { transition: none; }
}
