/* ═══════════════════════════════════════════════════════════════
   MonoAH App — auth + main layout
   Aesthetic: Apple-like minimal. Cool neutrals + terracotta accent.
   Inter for UI body, Fraunces for emotional headings only.
   Light + dark mode via CSS variables.
   ═══════════════════════════════════════════════════════════════ */


/* ───── Tokens (light) ──────────────────────────────────────── */
:root {
  /* Type */
  --font-display:  'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Color — cool neutrals, brand accent only as accent */
  --bg:            #fafafa;
  --bg-elev:       #ffffff;
  --bg-soft:       #f4f4f5;
  --bg-sunken:     #ececec;

  --ink:           #0a0a0a;
  --ink-mut:       #525252;
  --ink-soft:      #a3a3a3;

  --rule:          rgba(0, 0, 0, 0.08);
  --rule-strong:   rgba(0, 0, 0, 0.14);

  --accent:        #c44528;
  --accent-deep:   #8f2c14;
  --accent-soft:   rgba(196, 69, 40, 0.08);

  --danger:        #b1351c;
  --success:       #2c6e3f;
  --info:          #2563eb;

  /* Shadows — subtle, Apple-like */
  --shadow-1:      0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-2:      0 4px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-3:      0 10px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Layout */
  --gutter:        clamp(16px, 3vw, 32px);

  /* Radii */
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     20px;

  /* Motion */
  --ease:          cubic-bezier(0.32, 0.72, 0, 1);
  --t-1:           150ms;
  --t-2:           250ms;
  --t-3:           400ms;
}

/* ───── Tokens (dark) — Apple-style cool dark ───────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0a0a0a;
    --bg-elev:       #161616;
    --bg-soft:       #1f1f1f;
    --bg-sunken:     #050505;

    --ink:           #f5f5f5;
    --ink-mut:       #a3a3a3;
    --ink-soft:      #525252;

    --rule:          rgba(255, 255, 255, 0.08);
    --rule-strong:   rgba(255, 255, 255, 0.14);

    --accent:        #d75a3a;
    --accent-deep:   #f37b56;
    --accent-soft:   rgba(215, 90, 58, 0.12);

    --danger:        #e26849;
    --success:       #5cae6f;
    --info:          #60a5fa;

    --shadow-1:      0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2:      0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-3:      0 10px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

/* Manual dark override (we may add a toggle later) */
[data-theme="dark"] {
  --bg:            #0a0a0a;
  --bg-elev:       #161616;
  --bg-soft:       #1f1f1f;
  --bg-sunken:     #050505;
  --ink:           #f5f5f5;
  --ink-mut:       #a3a3a3;
  --ink-soft:      #525252;
  --rule:          rgba(255, 255, 255, 0.08);
  --rule-strong:   rgba(255, 255, 255, 0.14);
  --accent:        #d75a3a;
  --accent-deep:   #f37b56;
  --accent-soft:   rgba(215, 90, 58, 0.12);
  --danger:        #e26849;
  --success:       #5cae6f;
  --info:          #60a5fa;
  --shadow-1:      0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2:      0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-3:      0 10px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}


/* ───── Reset ───────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
*::selection { background: var(--accent); color: white; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'kern', 'ss01';
  min-height: 100dvh;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--t-1) var(--ease);
}
a:hover { color: var(--accent); }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* Inputs — Apple-like: minimal border, generous padding, soft focus */
input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  width: 100%;
  transition: border-color var(--t-1) var(--ease),
              box-shadow var(--t-1) var(--ease),
              background var(--t-1) var(--ease);
}
input::placeholder, textarea::placeholder {
  color: var(--ink-soft);
}
input:hover, textarea:hover, select:hover {
  border-color: var(--rule-strong);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}


/* ═══════════════════════════════════════════════════════════════
   Splash (index.html)
   ═══════════════════════════════════════════════════════════════ */
.splash {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}
.splash__inner { text-align: center; }
.splash__logo {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--accent);
  margin-bottom: var(--s-3);
  animation: pulse 1.6s var(--ease) infinite;
  line-height: 1;
}
.splash__hint {
  color: var(--ink-mut);
  font-size: 13px;
  letter-spacing: 0.02em;
}
@keyframes pulse {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: 0.5;  transform: scale(0.95); }
}


/* ═══════════════════════════════════════════════════════════════
   Auth topbar (signup, login)
   ═══════════════════════════════════════════════════════════════ */
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--gutter);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}
.brand-name {
  font-size: 15px;
  letter-spacing: -0.02em;
}

/* Locale switch — minimal pill */
.locale-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-mut);
  transition: background var(--t-1) var(--ease),
              color var(--t-1) var(--ease);
}
.locale-switch:hover {
  background: var(--bg-sunken);
  color: var(--ink);
}
.locale-switch .locale-on  { color: var(--ink); }
.locale-switch .locale-off { color: var(--ink-soft); }


/* ═══════════════════════════════════════════════════════════════
   Auth main + card (signup, login)
   ═══════════════════════════════════════════════════════════════ */
.auth-main {
  display: grid;
  place-items: center;
  padding: var(--s-6) var(--gutter) var(--s-9);
  min-height: calc(100dvh - 80px);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 34px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: var(--s-3);
}

.auth-sub {
  color: var(--ink-mut);
  font-size: 14px;
  margin-bottom: var(--s-7);
}

/* Google button — subtle elevated card style */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  width: 100%;
  padding: 12px var(--s-4);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-1);
  transition: border-color var(--t-1) var(--ease),
              box-shadow   var(--t-1) var(--ease),
              transform    var(--t-1) var(--ease);
}
.btn-google:hover  {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-2);
}
.btn-google:active { transform: translateY(0); box-shadow: var(--shadow-1); }

/* Divider "or" */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-5) 0;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* Form */
.auth-form { display: grid; gap: var(--s-4); }

.field { display: grid; gap: 6px; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mut);
}
.field-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* Primary CTA — terracotta, signature accent */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  padding: 13px var(--s-5);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-1);
  transition: background var(--t-1) var(--ease),
              box-shadow var(--t-1) var(--ease),
              transform  var(--t-1) var(--ease);
}
.btn-primary:hover    {
  background: var(--accent-deep);
  box-shadow: var(--shadow-2);
}
.btn-primary:active   { transform: translateY(1px); box-shadow: var(--shadow-1); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; transform: none; }

/* Ghost button — for low-priority actions */
.btn-ghost {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mut);
  transition: background var(--t-1) var(--ease),
              color      var(--t-1) var(--ease);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }

/* Status messages */
.auth-status {
  font-size: 13px;
  min-height: 1em;
  text-align: center;
}
.auth-status.is-error   { color: var(--danger);  }
.auth-status.is-success { color: var(--success); }

/* Footer of auth card */
.auth-foot {
  margin-top: var(--s-7);
  font-size: 14px;
  color: var(--ink-mut);
  text-align: center;
}
.auth-foot a {
  color: var(--ink);
  font-weight: 600;
  margin-left: 4px;
  position: relative;
}
.auth-foot a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  opacity: 0.2;
  transition: opacity var(--t-1) var(--ease);
}
.auth-foot a:hover { color: var(--accent); }
.auth-foot a:hover::after { opacity: 0.5; }

.auth-fine {
  margin-top: var(--s-4);
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════
   App layout (app.html)
   ═══════════════════════════════════════════════════════════════ */
.app-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow: hidden;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  z-index: 10;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-topbar__right {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mut);
}
.user-pill:empty { display: none; }


/* Three-column shell */
.app-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  min-height: 0; /* allow children to scroll */
}

.app-sidebar,
.app-feed,
.app-chat {
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-5);
}

.app-sidebar {
  border-right: 1px solid var(--rule);
  background: var(--bg);
}

.app-feed {
  background: var(--bg);
}

.app-chat {
  border-left: 1px solid var(--rule);
  background: var(--bg-soft);
}


/* Placeholder block (used by empty columns in MVP) */
.placeholder-block {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-5) 0;
}
.placeholder-block--center {
  place-content: center;
  text-align: center;
  height: 100%;
}
.placeholder-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mut);
}
.placeholder-note {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-soft);
  font-style: italic;
  font-weight: 400;
}


/* ═══════════════════════════════════════════════════════════════
   Responsive — collapse to single column on narrow viewports
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar,
  .app-chat {
    display: none; /* will reactivate as tabs/drawer in Sprint 3 */
  }
}

@media (max-width: 540px) {
  .auth-card { padding: 0 var(--s-3); }
  .auth-title { font-size: 26px; }
}


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