/* ---------------------------------------------------------------------
 * Mind — CommunitySolidServer page theme (dark)
 *
 * Drops onto every HTML page CSS renders (login, register, consent,
 * account, root index) plus the Mind landing page. Recreates the
 * @mind-studio/ui "mind" brand look (teal accent, cool-gray dark surface,
 * radius 0.625rem) in plain CSS so the pod-host journey matches the
 * mind-builder app. Loaded via the override config at
 * urn:solid-server:default:StylesStaticAsset.
 *
 * The per-page form/content is wrapped by infra/css/main.html.ejs.
 * ------------------------------------------------------------------- */

:root {
  /* Mind dark palette (cool-gray ramp + teal primary). */
  --bg:          #101319;   /* gray-950 */
  --surface:     #181c23;   /* gray-900 — cards */
  --surface-2:   #21262f;   /* gray-800 */
  --border:      rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text:        #f6f7f8;   /* gray-50 */
  --text-soft:   #c4c9d1;
  --text-faint:  #8b93a0;   /* gray-400 */
  --primary:     #16b88a;   /* Mind teal */
  --primary-bright: #2fd9aa;
  --primary-ink: #06231b;
  --status-bad:  #ff8a72;
  --focus-ring:  rgba(22, 184, 138, 0.30);
  --radius:      0.625rem;

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Soft warm-teal wash behind the page. */
  background:
    radial-gradient(ellipse 60% 45% at 50% -5%, rgba(22, 184, 138, 0.12), transparent 60%),
    var(--bg);
}

/* ----- shell: header / main / footer (from main.html.ejs) ------------ */

body > header,
body > main,
body > footer {
  width: 100%;
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

body > header {
  padding-top: 3rem;
  padding-bottom: 1.25rem;
  text-align: center;
}

.mind-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.mind-symbol { display: inline-flex; filter: drop-shadow(0 2px 8px rgba(22, 184, 138, 0.35)); }
.mind-symbol svg { display: block; border-radius: 8px; }
.mind-wordmark {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.mind-tagline {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--text-faint);
}

/* The card that holds each CSS page's form / content. */
body > main {
  flex: 0 1 auto;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  padding: 1.75rem 1.75rem 1.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7);
}

body > footer {
  margin-top: auto;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
body > footer a { color: inherit; text-decoration: none; }
body > footer a:hover { color: var(--primary-bright); }

/* Hide any leftover default CSS shell chrome (Solid logo / heading). */
header > img[alt*="Solid"] { display: none; }

/* ----- typography inside <main> ------------------------------------- */

main h1 {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
}

main h2,
fieldset > legend {
  margin: 1.5rem 0 0.4rem;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

main h1 + p,
main h2 + p,
fieldset > legend + p { margin-top: 0.25rem; color: var(--text-soft); }

main p { margin: 0.85rem 0; color: var(--text-soft); }
main strong { font-weight: 600; color: var(--text); }

main a {
  color: var(--primary-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
main a:hover { color: var(--text); }

main code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}
main pre {
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ----- lists -------------------------------------------------------- */

main ul, main ol { padding-left: 1.4em; }
main li { margin: 0.4em 0; color: var(--text-soft); }
main ul > li::marker { color: var(--primary); }

main dl { margin: 0.75em 0; padding: 0 0 0 0.5em; }
main dl dt { font-weight: 600; float: left; clear: left; min-width: 5em; color: var(--text); }
main dl dt::after { content: ":\00a0"; }
main dl dd { margin: 0 0 0.35em 0; color: var(--text-soft); }

/* ----- forms (CSS uses fieldset > ol > li for every form) ----------- */

fieldset {
  border: none;
  margin: 1.1rem 0 0;
  padding: 0;
  max-width: 100%;
}
fieldset.hidden legend { display: none; }
fieldset ol { list-style: none; margin: 0; padding: 0; }
fieldset ol ol {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

/* Stack label above field — reads better in a narrow card than a 2-col grid. */
fieldset ol li:not(.checkbox, .radio) {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.85rem 0;
}

fieldset li label { font-weight: 500; color: var(--text); cursor: pointer; }
fieldset li li label { font-weight: 400; color: var(--text-soft); }

fieldset li.checkbox > label,
fieldset li.radio > label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
fieldset li.checkbox > label > input,
fieldset li.radio > label > input { margin: 0; accent-color: var(--primary); }

fieldset li p { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--text-faint); }

/* ----- inputs ------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input::placeholder { color: var(--text-faint); }

/* ----- buttons ------------------------------------------------------ */

button,
input[type="submit"] {
  font: inherit;
  cursor: pointer;
  width: 100%;
  padding: 0.7rem 1.25rem;
  margin-top: 0.35rem;
  background: var(--primary);
  color: var(--primary-ink);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: filter 0.15s ease, transform 0.05s ease;
}
button:hover, input[type="submit"]:hover { filter: brightness(1.08); }
button:active, input[type="submit"]:active { transform: translateY(1px); }
button:focus-visible, input[type="submit"]:focus-visible {
  outline: 2px solid var(--primary-bright);
  outline-offset: 2px;
}
button:disabled, input[type="submit"]:disabled {
  background: var(--surface-2);
  color: var(--text-faint);
  border-color: var(--border);
  cursor: not-allowed;
  filter: none;
}

/* Secondary / inline links rendered by CSS as <button class="alternate">. */
button.alternate {
  display: inline-block;
  width: auto;
  padding: 0;
  margin: 0.5em 0;
  background: none;
  color: var(--primary-bright);
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
}
button.alternate:hover { background: none; color: var(--text); filter: none; }

/* ----- actions row -------------------------------------------------- */

p.actions, ul.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0.5rem;
  padding: 0;
}
ul.actions > li { list-style: none; flex: 1 1 auto; }

/* ----- errors / notices --------------------------------------------- */

p.error {
  color: var(--status-bad);
  font-weight: 500;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 138, 114, 0.10);
  border-left: 3px solid var(--status-bad);
  border-radius: 6px;
}
p.error:empty { display: none; }

/* ----- containers (directory listings) ----------------------------- */

ul.container { padding: 0; margin: 0.75rem 0; }
ul.container > li {
  list-style: none;
  margin: 0.2rem 0;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border-soft);
}
ul.container > li.container > a { font-weight: 600; color: var(--text); }

ol.breadcrumbs {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
ol.breadcrumbs > li { display: inline; }
ol.breadcrumbs > li > a { color: var(--text-faint); text-decoration: none; }
ol.breadcrumbs > li > a:hover { color: var(--primary-bright); }
ol.breadcrumbs > li:not(:last-child)::after {
  content: " / "; color: var(--border); padding: 0 0.35em;
}
ol.breadcrumbs > li:last-child { color: var(--text); }
ol.breadcrumbs > li:only-child { display: none; }

/* ----- form-row reveal animation (CSS toggles .hidden) -------------- */

form.loaded * { max-height: 1000px; transition: max-height 0.2s ease; }
form .hidden:not(button) { display: block; max-height: 0; overflow: hidden; }
.hidden { display: none; }

@media (max-width: 480px) {
  body > main { border-radius: 0.875rem; padding: 1.4rem; }
}
