/* AORYN Portal — base tokens, layout, login */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0A0613;
  --bg-2: #15101F;
  --bg-3: #1d1729;
  --fg: #ffffff;
  --fg-2: #A8A0B8;
  --fg-3: #6B6478;
  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.14);
  --glass: rgba(21, 16, 31, 0.6);
  --glass-2: rgba(10, 6, 19, 0.6);
  --topbar-bg: rgba(10, 6, 19, 0.75);
  --modal-bg: rgba(7,7,10,0.85);

  --accent: #FF6B35;
  --accent-2: #E91E63;
  --accent-3: #5B6BFF;
  --accent-purple: #8B5CF6;
  --grad-brand: linear-gradient(135deg, #FF6B35 0%, #E91E63 50%, #5B6BFF 100%);
  --ok: #10B981;
  --warn: #F59E0B;
  --err: #EF4444;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 260px;
  --topbar-h: 72px;
  --radius: 14px;
  --radius-lg: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

:root[data-theme="light"] {
  --bg: #F7F4F0;
  --bg-2: #ffffff;
  --bg-3: #ece6dd;
  --fg: #0F0A1A;
  --fg-2: #5B5468;
  --fg-3: #8C8597;
  --line: rgba(15,10,26,0.08);
  --line-2: rgba(15,10,26,0.14);
  --glass: rgba(255,255,255,0.7);
  --glass-2: rgba(247,244,240,0.7);
  --topbar-bg: rgba(247,244,240,0.85);
  --modal-bg: rgba(15,10,26,0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); transition: background-color .35s var(--ease), color .35s var(--ease); }
body {
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--accent-purple); color: white; }

/* Backdrop */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 60px 60px;
}
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 800px; height: 800px; border-radius: 50%;
  filter: blur(120px); opacity: 0.18;
}
.bg-glow.g1 { top: -200px; left: -200px; background: radial-gradient(circle, var(--accent), transparent 60%); }
.bg-glow.g2 { bottom: -300px; right: -200px; background: radial-gradient(circle, var(--accent-3), transparent 60%); opacity: 0.14; }

/* Utility */
.text-grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--fg-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: background .35s var(--ease), border-color .35s var(--ease);
}
:root[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(15,10,26,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,10,26,0.04) 1px, transparent 1px);
}
:root[data-theme="light"] .bg-glow { opacity: 0.10; }

.reveal { opacity: 1; transform: none; animation: revealIn .7s var(--ease) both; animation-delay: var(--reveal-delay, 0ms); }
@keyframes revealIn { from { transform: translateY(16px); } to { transform: none; } }

/* LOGIN */
.login-page { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; position: relative; overflow: hidden; }
.login-mark { margin-bottom: 32px; text-align: center; }
.login-back {
  position: absolute;
  top: -56px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.login-back:hover { transform: translateX(-50%) translateX(-2px); }
@media (max-width: 480px) {
  .login-back { top: -48px; }
}
.login-mark .symbol { width: 56px; height: 56px; background: url('../assets/aoryn-symbol.png') center/contain no-repeat; filter: drop-shadow(0 8px 24px rgba(255,107,53,0.35)); margin: 0 auto 14px; }
.login-mark .wordmark { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.4em; font-weight: 400; padding-left: 0.4em; }
.login-card { width: 100%; max-width: 440px; padding: 40px 36px; position: relative; opacity: 1; animation: loginIn .6s var(--ease) both; }
@keyframes loginIn { from { transform: scale(0.96) translateY(20px); } to { transform: none; } }
.login-card .eyebrow { margin-bottom: 18px; }
.login-card h1 { font-family: var(--font-display); font-size: 36px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 10px; }
.login-card .sub { color: var(--fg-2); font-size: 14px; margin-bottom: 32px; }
.login-field { margin-bottom: 22px; position: relative; }
.login-field label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 8px; }
.login-field .input-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); transition: border-color .25s var(--ease); }
.login-field .input-wrap:focus-within { border-color: var(--accent-purple); }
.login-field svg { width: 16px; height: 16px; color: var(--fg-3); flex-shrink: 0; }
.login-field input { flex: 1; background: transparent; border: none; outline: none; font-size: 15px; color: var(--fg); padding: 0; }
.login-field input::placeholder { color: var(--fg-3); }
.login-field .toggle-pw { background: transparent; border: none; color: var(--fg-3); padding: 4px; transition: color .2s; }
.login-field .toggle-pw:hover { color: var(--fg); }
.login-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: 13px; }
.login-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); cursor: pointer; }
.login-row input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); }
.login-row a { color: var(--accent-purple); border-bottom: 1px solid transparent; transition: border-color .25s; }
.login-row a:hover { border-bottom-color: currentColor; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 22px; border-radius: 999px;
  background: var(--grad-brand); color: white;
  font-size: 14px; font-weight: 500; letter-spacing: 0.02em;
  position: relative; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .3s var(--ease);
}
.btn-primary::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); transition: left .6s var(--ease); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px -8px rgba(233, 30, 99, 0.5); }
.btn-primary:hover::after { left: 100%; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 22px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg);
  font-size: 14px; font-weight: 500;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.btn-outline:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.2); }
.btn-outline svg { width: 18px; height: 18px; }

.login-sep { display: flex; align-items: center; gap: 14px; margin: 24px 0; font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.18em; }
.login-sep::before, .login-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-foot { text-align: center; margin-top: 28px; font-size: 13px; color: var(--fg-2); }
.login-foot a { color: var(--accent); border-bottom: 1px dotted currentColor; }

/* Theme toggle button */
.theme-toggle {
  position: relative;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-2);
  transition: background .2s, color .2s, transform .3s var(--ease);
}
.theme-toggle:hover { background: rgba(255,255,255,0.06); color: var(--fg); transform: rotate(20deg); }
.theme-toggle svg { width: 16px; height: 16px; transition: opacity .3s; }
.theme-toggle .moon { display: block; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle { background: rgba(15,10,26,0.04); }
:root[data-theme="light"] .theme-toggle:hover { background: rgba(15,10,26,0.07); }

/* Back-to-site button */
.back-site {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  font-size: 12px; color: var(--fg-2);
  transition: background .2s, color .2s, border-color .2s, transform .25s var(--ease);
}
.back-site:hover { background: rgba(255,255,255,0.06); color: var(--fg); border-color: var(--line-2); transform: translateX(-2px); }
.back-site svg { width: 13px; height: 13px; }
:root[data-theme="light"] .back-site { background: rgba(15,10,26,0.03); }
:root[data-theme="light"] .back-site:hover { background: rgba(15,10,26,0.06); }
.app { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

/* Sidebar */
.sidebar {
  background: var(--glass-2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  overflow-y: auto; z-index: 10;
  transition: background .35s var(--ease), border-color .35s var(--ease);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-family: var(--font-display); font-size: 16px; letter-spacing: 0.38em; }
.sidebar-brand .mark { width: 22px; height: 22px; background: url('../assets/aoryn-symbol.png') center/contain no-repeat; filter: drop-shadow(0 0 12px rgba(255,107,53,0.4)); }
.sidebar-divider { height: 1px; background: var(--line); margin: 0 -16px 16px; }
.sidebar-group { margin-bottom: 22px; }
.sidebar-group .label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg-3); padding: 0 10px; margin-bottom: 8px; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: 10px; font-size: 14px;
  color: var(--fg-2); cursor: pointer; position: relative;
  transition: color .2s var(--ease), background .2s var(--ease);
  width: 100%; text-align: left;
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-item:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.sidebar-item.active { color: var(--fg); background: rgba(255,107,53,0.08); }
.sidebar-item.active::before { content: ''; position: absolute; left: -16px; top: 4px; bottom: 4px; width: 3px; background: var(--grad-brand); border-radius: 0 4px 4px 0; }
.sidebar-item .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-2); color: white; font-family: var(--font-mono); font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-item .badge.dim { background: var(--bg-3); color: var(--fg-2); }
.sidebar-help { margin-top: auto; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, rgba(255,107,53,0.08), rgba(91,107,255,0.08)); border: 1px solid rgba(255,107,53,0.15); }
.sidebar-help h5 { font-family: var(--font-display); font-size: 16px; font-weight: 400; margin-bottom: 6px; }
.sidebar-help p { font-size: 12px; color: var(--fg-2); margin-bottom: 12px; line-height: 1.4; }
.sidebar-help button { font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); transition: background .2s; }
.sidebar-help button:hover { background: rgba(255,255,255,0.12); }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: var(--topbar-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); transition: background .35s var(--ease), border-color .35s var(--ease); }
.crumb { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--fg-2); }
.crumb .here { color: var(--fg); font-weight: 500; }
.search { display: flex; align-items: center; gap: 10px; padding: 8px 14px; width: 320px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 999px; color: var(--fg-3); font-size: 13px; transition: border-color .25s; }
.search:focus-within { border-color: var(--line-2); color: var(--fg-2); }
.search input { flex: 1; background: transparent; border: none; outline: none; font-size: 13px; color: var(--fg); }
.search input::placeholder { color: var(--fg-3); }
.search kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); color: var(--fg-2); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.03); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--fg-2); transition: background .2s, color .2s; }
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .ping { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.icon-btn .ping::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--accent-2); animation: pingExpand 2s ease-out infinite; }
@keyframes pingExpand { from { transform: scale(0.8); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.avatar-pill { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); transition: background .2s, border-color .2s; }
.avatar-pill:hover { background: rgba(255,255,255,0.06); border-color: var(--line-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--grad-brand); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: white; flex-shrink: 0; }
.avatar-pill .name { font-size: 13px; font-weight: 500; }
.avatar-pill .status { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }

.main { min-width: 0; }
.view { padding: 40px; min-height: calc(100vh - var(--topbar-h)); position: relative; }
