/*
  mygeeg design system — foundations (cream white & blue edition)
  ----------------------------------
  Tokens, reset, typography, forms, buttons, alerts, auth screens.
  Components live in app.css. Light + dark themes via [data-theme] (set by theme.js),
  falling back to the visitor's OS preference.

  Legacy token names (--ink, --gold, --signal, --text-hi …) are kept as aliases so that
  older inline styles in templates keep working.
*/

:root {
  /* Brand: blue + white */
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;
  --accent:    #38bdf8;
  --accent-2:  #0ea5e9;
  --grad: linear-gradient(135deg, #1d4ed8 0%, #2563eb 38%, #3b82f6 70%, #38bdf8 118%);
  --grad-soft: linear-gradient(135deg, rgba(37,99,235,.08), rgba(56,189,248,.07));
  --grad-deep: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);

  /* Light theme (default): warm cream white with deep blue ink and royal-blue accents */
  --bg:         #faf6ec;
  --surface:    #fffdf8;
  --surface-2:  #f4eddd;
  --border:     #e9e0cb;
  --border-strong: #d7caa9;
  --text:       #0e1f42;
  --text-dim:   #5a6580;
  --primary:    var(--brand-600);
  --primary-hover: var(--brand-700);
  --on-primary: #ffffff;
  --success:    #0f9f77;
  --warning:    #d98a0b;
  --danger-c:   #dc4a3a;
  --code-bg:    #0a1630;
  --code-fg:    #e4ecff;
  --shadow-sm:  0 1px 2px rgba(10,26,58,.06), 0 1px 1px rgba(10,26,58,.04);
  --shadow-md:  0 10px 28px -10px rgba(29,78,216,.22), 0 2px 6px rgba(10,26,58,.05);
  --shadow-lg:  0 30px 70px -24px rgba(29,78,216,.45);
  --ring:       0 0 0 3px rgba(37,99,235,.30);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Noto Serif', serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: var(--font-body);
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, monospace;

  /* Legacy aliases (used by inline styles in existing templates) */
  --ink: var(--surface-2);
  --ink-raised: var(--surface);
  --ink-border: var(--border);
  --paper: #fffdf8;
  --gold: var(--primary);
  --gold-dim: var(--primary-hover);
  --signal: var(--success);
  --danger: var(--danger-c);
  --text-hi: var(--text);
  --text-lo: var(--text-dim);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg:         #060e22;
  --surface:    #0b1a38;
  --surface-2:  #102245;
  --border:     #1c3262;
  --border-strong: #2a4580;
  --text:       #eaf1ff;
  --text-dim:   #97abd1;
  --primary:    #5b9dff;
  --primary-hover: #86b8ff;
  --on-primary: #061330;
  --success:    #34d3a0;
  --warning:    #f0b24a;
  --danger-c:   #ff7a68;
  --code-bg:    #050c1d;
  --code-fg:    #e4ecff;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  0 10px 30px -10px rgba(0,0,0,.6);
  --shadow-lg:  0 30px 70px -25px rgba(37,99,235,.55);
  --ring:       0 0 0 3px rgba(91,157,255,.40);
  --grad-soft:  linear-gradient(135deg, rgba(91,157,255,.14), rgba(56,189,248,.10));
  color-scheme: dark;
}

/* Cream & blue is the default for everyone; dark navy is opt-in with the theme toggle. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 .5em;
  color: var(--text);
}
h1 { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.35rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .7vw, 1.65rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, pre { font-family: var(--font-mono); }
:not(pre) > code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: .12em .4em; font-size: .88em;
}
::selection { background: rgba(37,99,235,.28); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.03em; font-size: 1.2rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(37,99,235,.65);
}
.brand b { color: var(--primary); font-weight: 800; }
/* legacy */
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: -.03em; color: var(--text); margin-bottom: 24px; }
.auth-brand:hover { text-decoration: none; }

/* ---------- Auth ---------- */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(37,99,235,.18), transparent 60%),
    radial-gradient(700px 500px at 100% 110%, rgba(56,189,248,.16), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-dim); font-size: .95rem; margin-bottom: 24px; }
.auth-foot { margin-top: 22px; font-size: .9rem; color: var(--text-dim); text-align: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.field input, select, textarea, input[type=text], input[type=number], input[type=url], input[type=email], input[type=password], input[type=search] {
  width: 100%; padding: 11px 13px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: .95rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, select:focus, textarea:focus, input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; line-height: 1.5; }
.field-hint { font-size: .78rem; color: var(--text-dim); margin-top: 6px; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 12px 18px; background: var(--primary); color: var(--on-primary); border: 1px solid transparent;
  border-radius: var(--radius-sm); font-size: .95rem; font-weight: 650; font-family: inherit; cursor: pointer;
  text-align: center; transition: transform .12s, background .15s, box-shadow .15s;
  box-shadow: 0 6px 16px -8px rgba(29,78,216,.6);
}
.btn:hover { background: var(--primary-hover); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 18px; border: 1px solid; }
.alert-error   { background: color-mix(in srgb, var(--danger-c) 10%, transparent); border-color: color-mix(in srgb, var(--danger-c) 35%, transparent); color: var(--danger-c); }
.alert-success { background: color-mix(in srgb, var(--success) 10%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.alert-info    { background: var(--grad-soft); border-color: var(--border-strong); color: var(--text); }
