/* ==========================================================================
   ORA UI — shared foundation for the sign-in page, the dashboard and the journal.
   Same language as the landing: near-black, hairlines, Geist + Geist Mono,
   three signal colours (watch / repair / critical) and a quiet "sound" grey.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #030305;
  --bg-1: #07080b;
  --bg-2: #0c0e12;
  --bg-3: #12151a;
  --ink: #f2f2f0;
  --ink-2: rgba(242, 242, 240, 0.74);
  --ink-3: rgba(242, 242, 240, 0.52);
  --ink-4: rgba(242, 242, 240, 0.34);
  --ink-5: rgba(242, 242, 240, 0.18);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-3: rgba(255, 255, 255, 0.2);
  --glass: rgba(8, 9, 13, 0.66);
  --glass-2: rgba(14, 16, 21, 0.78);
  --sound: #c3d0de;
  --watch: #8fd3ff;
  --repair: #f0c45c;
  --critical: #ff5a4e;
  --sans: 'Geist', 'Inter', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;
  --ease: cubic-bezier(0.16, 0.84, 0.24, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.18, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--ink); color: #0a0a0b; }
:focus-visible { outline: 2px solid var(--watch); outline-offset: 2px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
img, svg, canvas { display: block; }
h1, h2, h3, h4, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Type helpers */
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.label {
  font: 500 10.5px/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.muted { color: var(--ink-3); }

/* Film grain over everything (texture generated in JS) */
/* A new pattern every 50 ms (the texture mirrored another way each frame), never one pattern sliding about */
.grain { position: fixed; inset: -100px; z-index: 300; pointer-events: none; background-image: var(--grain, none); background-size: 160px 160px; opacity: 0.05; animation: grain 0.3s infinite; animation-timing-function: steps(1, end); }
@keyframes grain {
  0% { transform: translate3d(0, 0, 0); }
  16.666% { transform: translate3d(-37px, 23px, 0) scale(-1, 1); }
  33.333% { transform: translate3d(29px, -41px, 0) scale(1, -1); }
  50% { transform: translate3d(-13px, -27px, 0) scale(-1, -1); }
  66.666% { transform: translate3d(43px, 11px, 0); }
  83.333% { transform: translate3d(-21px, 37px, 0) scale(-1, 1); }
  100% { transform: translate3d(0, 0, 0); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font: 500 13.5px/1 var(--sans); letter-spacing: -0.01em;
  text-decoration: none; white-space: nowrap;
  transition: color 0.4s var(--ease), border-color 0.3s ease, background-color 0.3s ease, transform 0.5s var(--ease), opacity 0.3s ease;
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; transform: translateY(102%); transition: transform 0.5s var(--ease); }
.btn:hover::before { transform: none; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--solid { background: var(--ink); color: #0a0a0b; }
.btn--solid::before { background: #fff; }
.btn--ghost { border-color: var(--line-2); background: rgba(255, 255, 255, 0.02); color: var(--ink); }
.btn--ghost::before { background: var(--ink); }
.btn--ghost:hover { color: #0a0a0b; border-color: var(--ink); }
.btn--quiet { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn--quiet::before { background: rgba(255, 255, 255, 0.06); transform: none; opacity: 0; transition: opacity 0.25s ease; }
.btn--quiet:hover { color: var(--ink); }
.btn--quiet:hover::before { opacity: 1; }
.btn--danger { border-color: rgba(255, 90, 78, 0.4); color: #ffb3ac; background: rgba(255, 90, 78, 0.06); }
.btn--danger::before { background: var(--critical); }
.btn--danger:hover { color: #0a0a0b; }
.btn--sm { height: 32px; padding: 0 13px; font-size: 12.5px; gap: 7px; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn .arrow { transition: transform 0.45s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn.is-loading > :not(.dots) { opacity: 0; }
.btn .dots { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 5px; }
.btn.is-loading .dots { display: flex; }

/* Three orbiting dots — the house spinner */
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1s var(--ease-io) infinite; }
.dots i:nth-child(2) { animation-delay: 0.12s; }
.dots i:nth-child(3) { animation-delay: 0.24s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: 0.35; } 40% { transform: translateY(-4px); opacity: 1; } }

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
.field { position: relative; display: flex; flex-direction: column; gap: 8px; }
.field > label { font: 500 10.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink); font: 400 15px/1 var(--sans);
  outline: none;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.35s var(--ease);
}
.input::placeholder { color: var(--ink-4); }
.input:hover { border-color: var(--line-3); }
.input:focus { border-color: rgba(143, 211, 255, 0.7); background: rgba(143, 211, 255, 0.04); box-shadow: 0 0 0 4px rgba(143, 211, 255, 0.1); }
.input[aria-invalid='true'] { border-color: rgba(255, 90, 78, 0.7); box-shadow: 0 0 0 4px rgba(255, 90, 78, 0.08); }
.input--sm { height: 34px; font-size: 13px; padding: 0 11px; border-radius: 9px; }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f2f2f0' stroke-opacity='.5' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 14px; }
select.input option { background: #101216; }

/* Switch */
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.1); transition: background-color 0.3s ease; pointer-events: none; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-2); transition: transform 0.45s var(--spring), background-color 0.3s ease; }
.switch input:checked + i { background: var(--watch); }
.switch input:checked + i::after { transform: translateX(16px); background: #04121b; }
.switch input:focus-visible + i { outline: 2px solid var(--watch); outline-offset: 2px; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.02); }
.seg button { position: relative; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font: 500 12.5px/1 var(--sans); white-space: nowrap; transition: color 0.25s ease, background-color 0.3s ease; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.09); color: var(--ink); }
.seg button .c { font: 500 10.5px/1 var(--mono); color: var(--ink-4); letter-spacing: 0.04em; }
.seg button[aria-pressed='true'] .c { color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012));
}
.glass {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
}
/* A soft light that follows the pointer across a surface (set --mx/--my in JS) */
.spot { --mx: -999px; --my: -999px; }
.spot::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(143, 211, 255, 0.07), transparent 45%);
  opacity: 0; transition: opacity 0.4s ease;
}
.spot:hover::before { opacity: 1; }
.spot > * { position: relative; z-index: 1; }

.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Pills and status */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font: 500 11px/1 var(--sans); letter-spacing: 0; white-space: nowrap; border: 1px solid var(--line-2); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--plain::before { display: none; }
.pill--sound { color: var(--sound); border-color: rgba(195, 208, 222, 0.22); background: rgba(195, 208, 222, 0.05); }
.pill--watch { color: var(--watch); border-color: rgba(143, 211, 255, 0.28); background: rgba(143, 211, 255, 0.07); }
.pill--repair { color: var(--repair); border-color: rgba(240, 196, 92, 0.3); background: rgba(240, 196, 92, 0.07); }
.pill--critical { color: var(--critical); border-color: rgba(255, 90, 78, 0.34); background: rgba(255, 90, 78, 0.08); }
.c-sound { color: var(--sound); }
.c-watch { color: var(--watch); }
.c-repair { color: var(--repair); }
.c-critical { color: var(--critical); }

.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; font: 500 10.5px/1 var(--mono); color: var(--ink-3); }

.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; font: 600 11px/1 var(--sans); letter-spacing: 0.02em; color: #0a0a0b; background: linear-gradient(135deg, #e9eef3, #9fb3c6); }
.avatar--sq { border-radius: 9px; }

/* Logo */
.logo { display: inline-flex; color: var(--ink); }
.logo svg { height: 22px; width: auto; }

@keyframes live { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
