/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 *
 * Everything below is built from the locked warm-editorial design system: reference tokens live in
 * tokens.css (loaded separately in the layout), and the component recipes below are adapted from
 * .lila/components.html (buttons, fields, panels). Do not hardcode hex colors or px spacing here —
 * always go through var(--token).
 */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  min-height: 100vh;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  /* iOS standalone safe-area: keep content clear of the notch / home indicator */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

a { color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* App shell: top nav                                                     */
/* ---------------------------------------------------------------------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-6);
  /* iOS standalone safe-area: clear the notch when running full-screen */
  padding-top: calc(var(--space-4) + env(safe-area-inset-top));
  padding-left: calc(var(--space-6) + env(safe-area-inset-left));
  padding-right: calc(var(--space-6) + env(safe-area-inset-right));
}

.app-nav__brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: var(--tracking-display);
}

.app-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.app-nav__link {
  color: var(--fg-2);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

.app-nav__link:hover { color: var(--accent); }

.app-nav__signout {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg-2);
  font: 700 var(--text-sm) / 1 var(--font-body);
  cursor: pointer;
}

.app-nav__signout:hover { color: var(--accent); }

.app-main {
  flex: 1;
}

/* ---------------------------------------------------------------------- */
/* Buttons (adapted from .lila/components.html)                           */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: 700 var(--text-sm) / 1 var(--font-body);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard),
              color var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-standard);
}

.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border); box-shadow: var(--elev-ring); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* Form fields (adapted from .lila/components.html)                       */
/* ---------------------------------------------------------------------- */

.field { display: grid; gap: var(--space-2); margin-block-start: var(--space-5); }

.field label {
  color: var(--fg-2);
  font-size: var(--text-sm);
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

.field input:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* Flash messages                                                         */
/* ---------------------------------------------------------------------- */

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-block-end: var(--space-4);
}

.flash-alert { background: color-mix(in oklab, var(--danger), white 88%); color: var(--danger); border: 1px solid color-mix(in oklab, var(--danger), white 70%); }
.flash-notice { background: color-mix(in oklab, var(--success), white 88%); color: var(--success); border: 1px solid color-mix(in oklab, var(--success), white 70%); }

/* ---------------------------------------------------------------------- */
/* Auth pages (sign in / password reset)                                  */
/* ---------------------------------------------------------------------- */

.auth-page {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 58%, var(--surface-warm) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-raised);
  padding: var(--space-8);
}

.auth-card .eyebrow {
  display: block;
  color: var(--meta);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-block-end: var(--space-2);
}

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: 760;
}

.auth-card .lead {
  color: var(--fg-2);
  font-size: var(--text-sm);
  margin-block-start: var(--space-2);
}

.auth-card form { margin-block-start: var(--space-2); }

.auth-card .actions { margin-block-start: var(--space-6); }

.auth-card .auth-links {
  margin-block-start: var(--space-6);
  display: flex;
  justify-content: center;
  font-size: var(--text-sm);
}

.auth-card .auth-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-card .auth-links a:hover { color: var(--accent); }
