/* iuvo brand layer (iuvonauts/skills: skills/brand, v2.2.0).
   Loaded after theme.css and hermes.css: it re-points the cosmos-ui tokens
   at the iuvo palette and restyles the shared components. theme.css itself
   stays an unmodified copy of the cosmos-ui skill.

   Inter can't come from Google Fonts (the CSP is default-src 'self'), so it
   is used when installed locally and falls back to the system UI font. */

:root {
  /* Brand palette */
  --iuvo-deep-blue: #222938;
  --iuvo-soft-green: #74d49a;
  --iuvo-warm-sand: #e9d2b2;
  --iuvo-horizon-blue: #a5d1ee;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: var(--iuvo-deep-blue);
  --text-muted: #64748b;
  --brand: var(--iuvo-deep-blue);
  --brand-contrast: #ffffff;
  --accent: var(--iuvo-soft-green);
  --accent-contrast: var(--iuvo-deep-blue);
  --link: var(--iuvo-deep-blue);
  --focus: var(--iuvo-horizon-blue);
  --danger: #c4314b;
  --danger-bg: #fdf2f4;
  --warn-bg: rgba(233, 210, 178, 0.28);
  --info-bg: rgba(165, 209, 238, 0.24);
  --header-bg: var(--iuvo-deep-blue);
  --header-border: #374151;
  --header-text: #ffffff;
  --header-muted: #94a3b8;
  --shadow: 0 1px 2px rgba(34, 41, 56, 0.06), 0 4px 16px rgba(34, 41, 56, 0.06);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: var(--iuvo-deep-blue);
  --surface: #2a3345;
  --surface-alt: #222938;
  --border: #3b4659;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --brand: var(--iuvo-soft-green);
  --brand-contrast: var(--iuvo-deep-blue);
  --link: var(--iuvo-soft-green);
  --danger: #ff8a9b;
  --danger-bg: rgba(255, 138, 155, 0.08);
  --warn-bg: rgba(233, 210, 178, 0.1);
  --info-bg: rgba(165, 209, 238, 0.1);
  --header-bg: #1c2230;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.cosmos {
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Footer stays at the bottom of the window on short pages. */
body.cosmos {
  display: flex;
  flex-direction: column;
}

.cosmos-main {
  flex: 1 0 auto;
  width: 100%;
}

.hermes-footer {
  padding: 1.25rem 1rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* Header: always a Deep Blue band, so the green/white logo works in both themes. */
.cosmos-header {
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  color: var(--header-text);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}

.iuvo-logo {
  display: block;
  height: 28px;
  width: auto;
}

.iuvo-divider {
  width: 1px;
  height: 28px;
  background: var(--header-border);
}

.cosmos-header img.cosmos-logo {
  height: 28px;
}

.cosmos-header .brand-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Cards and headings */
.cosmos-card {
  padding: 2rem 2rem 1.75rem;
}

.cosmos-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cosmos-subtitle {
  margin-bottom: 1.5rem;
}

.cosmos-error-code {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}

/* Form controls */
.hermes-label {
  font-weight: 700;
  font-size: 0.8125rem;
}

textarea,
input[type="text"],
input[type="password"],
input[type="email"],
select {
  background: var(--surface);
  border-color: var(--border);
  font-weight: 500;
}

[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] select {
  background: var(--surface-alt);
}

textarea {
  font-family: var(--mono);
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(165, 209, 238, 0.45);
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand);
}

.hermes-fieldset legend {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hermes-hint {
  font-size: 0.8125rem;
}

/* Buttons: Deep Blue primary, Soft Green for the page's main action. */
.cosmos-btn {
  border-radius: var(--radius);
  padding: 0.6rem 1.15rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.cosmos-btn:hover {
  filter: none;
  opacity: 0.9;
}

.cosmos-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.iuvo-cta {
  background: var(--accent);
  color: var(--accent-contrast);
}

.hermes-btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
}

.hermes-btn-secondary:hover {
  opacity: 1;
  background: var(--surface-alt);
}

[data-theme="dark"] .hermes-btn-secondary:hover {
  background: #2e3a4e;
}

.hermes-btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.hermes-btn-danger:hover {
  opacity: 1;
  background: var(--danger-bg);
}

/* Notices */
.hermes-alert {
  background: var(--danger-bg);
  border-width: 1px 1px 1px 4px;
}

.iuvo-callout {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.875rem;
  border-left: 4px solid;
  border-radius: var(--radius);
}

.iuvo-callout-warn {
  background: var(--warn-bg);
  border-color: var(--iuvo-warm-sand);
}

.iuvo-callout-info {
  background: var(--info-bg);
  border-color: var(--iuvo-horizon-blue);
}

/* The decrypted message */
.hermes-message {
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
}

dialog {
  padding: 1.5rem;
}

dialog::backdrop {
  background: rgba(34, 41, 56, 0.6);
}

@media (max-width: 480px) {
  .cosmos-header {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .iuvo-logo,
  .iuvo-divider,
  .cosmos-header img.cosmos-logo {
    height: 22px;
  }

  .cosmos-card {
    padding: 1.5rem 1.25rem;
  }
}
