/* Procedural Data house kit 1.0.0 (adeptum-branding/ProceduralData-House-Kit-v1.0.0), as on
   proceduraldata.com: ink, paper and grid neutrals; Signal Blue for links and actions; Verify Green
   for success only; red for errors only. */

/* Brand faces, served from this site (not Google Fonts), Latin subsets from the Adeptum Desktop
   brand kit 3.3.4. SIL Open Font License 1.1: each family's OFL.txt sits next to its files. Other
   scripts fall back to the system faces. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/space-grotesk/space-grotesk-latin-600-normal.woff2") format("woff2"); }
:root {
  --pd-ink: #16181A;
  --pd-paper: #F4F4F1;
  --pd-grid: #DCDCD8;
  --pd-void: #121416;
  --pd-white: #FFFFFF;
  --pd-signal-blue: #3A6FD8;

  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Each colour: light-dark(light theme, dark theme). The theme follows the system unless the
     visitor picks one with the header toggle (theme.js sets data-theme on <html>). */
  --bg: light-dark(var(--pd-paper), var(--pd-void));
  --card: light-dark(var(--pd-white), #1A1D20);
  --text: light-dark(var(--pd-ink), var(--pd-paper));
  --muted: light-dark(#5f6367, #9aa0a6);
  --line: light-dark(var(--pd-grid), #2a2e31);
  --hover: light-dark(#EAEAE5, #22262A);
  --link: light-dark(#2F5FC4, #7FA6F0);          /* Signal Blue; darker on light so small text passes 4.5:1 */
  --action: light-dark(var(--pd-ink), var(--pd-paper));   /* primary buttons: ink on paper, paper on void */
  --action-text: light-dark(var(--pd-paper), var(--pd-ink));
  --ok: light-dark(#117555, #2DC08E);            /* Verify Green, text */
  --error: light-dark(#B3261E, #F2B8B5);         /* errors only */
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Theme toggle: shows the moon in the light theme and the sun in the dark one. */
.header-end { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
#theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#theme-toggle:hover { color: var(--text); background: var(--hover); opacity: 1; }
#theme-toggle svg { width: 1rem; height: 1rem; }
#theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) #theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] #theme-toggle .sun { display: block; }
:root[data-theme="dark"] #theme-toggle .moon { display: none; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; margin: 0; font-size: 1.15rem; font-weight: 500; }

/* Horizontal lockup: bare R-pentomino + lowercase mono wordmark, as on proceduraldata.com. */
.lockup {
  display: inline-flex;
  align-items: center;
  gap: .42em;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.lockup .mark { height: .94em; width: auto; display: block; flex: none; }
.brand .area {
  font-family: var(--mono);
  letter-spacing: -0.02em;
  margin-left: .35em;
  padding-left: .6em;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-weight: 400;
}

#who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; white-space: nowrap; min-width: 0; }
header { flex-wrap: wrap; row-gap: .4rem; }
@media (max-width: 600px) {
  header { padding: .75rem 1rem; }
  main { padding: 1.25rem 1rem 2.5rem; }
  #who-email { overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
}
#who-email { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

h2 { font-family: var(--display); font-size: 1.1rem; font-weight: 600; margin: 0 0 .5rem; letter-spacing: -0.01em; }

main {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
  display: grid;
  align-content: start;
  gap: 1rem;
}

section { display: grid; gap: 1rem; }
#apps { display: grid; gap: 1rem; }
[hidden] { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}

form { display: grid; gap: .75rem; max-width: 26rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row input { flex: 1 1 14rem; }

label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }

input {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem .65rem;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
#redeem-code, #totp-code, #confirm-code { font-family: var(--mono); letter-spacing: .04em; }

button {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--action);
  border-radius: 8px;
  padding: .5rem .95rem;
  background: var(--action);
  color: var(--action-text);
  cursor: pointer;
  justify-self: start;
}
button:hover { opacity: .88; }
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.secondary:hover { background: var(--hover); opacity: 1; }
button.link { background: none; border: 0; color: var(--link); padding: 0; text-decoration: underline; font-weight: 400; }
/* Signing a computer out is not an error, so it stays neutral (red is for errors only). */
button.danger { background: transparent; color: var(--text); border-color: var(--line); padding: .25rem .65rem; }
button.danger:hover { background: var(--hover); opacity: 1; }
button:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); }
.tabs button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); opacity: 1; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }

#message {
  margin: 0;
  padding: .6rem .9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
}
#message.error { color: var(--error); border-color: currentColor; }
#message.ok { color: var(--ok); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
/* ALL-CAPS label: mono, +10% tracking, as in the house kit. */
th { color: var(--muted); font-family: var(--mono); font-weight: 500; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
td.empty { color: var(--muted); }
.muted { color: var(--muted); margin: 0; font-size: .9rem; }

.license, .takeovers { color: var(--muted); margin: .25rem 0 .75rem; }
.qr svg {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  /* Stays black on white in dark mode too, as scanners expect. */
}

.key { font-family: var(--mono); font-size: 1.1rem; letter-spacing: .08em; word-break: break-all; }

footer {
  padding: 1.25rem 1.5rem 1.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  max-width: 24rem;
  width: calc(100% - 2rem);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
