/* ===========================================================================
   aibo — built on np.lol design system foundations
   Tokens copied verbatim from np.lol/colors_and_type.css.
   Component styles (.btn, .input, .tile, .flash-*) follow the system rules.
   =========================================================================== */

:root {
  /* PAPER */
  --paper:        #F6F1E7;
  --paper-2:      #EDE7D8;
  --paper-3:      #DCD3BD;

  /* INK */
  --ink:          #14110D;
  --ink-2:        #3A352D;
  --ink-3:        #776E5E;
  --ink-4:        #A99F8B;

  /* SIGNATURE */
  --tomato:       #FF4E2E;
  --tomato-deep:  #C9341B;
  --acid:         #DCFF3F;
  --acid-deep:    #B8DC1F;

  /* SUPPORT */
  --sky:          #4A8FFF;
  --bubble:       #FF8FA8;
  --leaf:         #2F8F5C;
  --amber:        #E6A300;
  --berry:        #B5274D;

  /* PER-APP ACCENT (aibo = tomato default) */
  --accent:       var(--tomato);
  --accent-deep:  var(--tomato-deep);

  /* SEMANTIC */
  --bg:           var(--paper);
  --bg-elev-1:    var(--paper-2);
  --bg-elev-2:    var(--paper-3);
  --fg:           var(--ink);
  --fg-2:         var(--ink-2);
  --fg-3:         var(--ink-3);
  --fg-muted:     var(--ink-4);
  --line:         var(--ink);
  --line-soft:    var(--paper-3);
  --success:      var(--leaf);
  --warning:      var(--amber);
  --danger:       var(--berry);
  --info:         var(--sky);

  /* TYPE */
  --font-sans:    'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Boldonse', 'Bricolage Grotesque', serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-xs:      12px;
  --text-sm:      13px;
  --text-base:    15px;
  --text-md:      17px;
  --text-lg:      22px;
  --text-xl:      30px;
  --text-2xl:     44px;
  --text-3xl:     64px;
  --text-display: 96px;

  --lh-tight:    1.05;
  --lh-snug:     1.2;
  --lh-normal:   1.45;
  --lh-relaxed:  1.6;

  --tracking-tight: -0.02em;
  --tracking-snug:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:  0.04em;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  /* SPACING */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-14: 56px;
  --space-20: 80px; --space-30: 120px;

  /* RADII */
  --radius-xs: 4px;   --radius-sm: 8px;
  --radius-md: 14px;  --radius-lg: 20px;
  --radius-xl: 32px;  --radius-full: 999px;

  /* SHADOWS */
  --shadow-hard:    4px 4px 0 var(--ink);
  --shadow-hard-lg: 8px 8px 0 var(--ink);
  --shadow-hard-sm: 2px 2px 0 var(--ink);
  --shadow-soft:    0 8px 24px rgba(20,17,13,0.10);
  --shadow-inset:   inset 0 0 0 1.5px var(--ink);

  /* MOTION */
  --ease:        cubic-bezier(0.2, 0.9, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms; --dur: 220ms; --dur-slow: 400ms;

  /* LAYOUT */
  --max-w:    1120px;
  --gutter:   clamp(20px, 5vw, 80px);
  --border-w: 1.5px;
}

/* ===========================================================================
   ELEMENT-LEVEL DEFAULTS (apply when body.nplol is set)
   =========================================================================== */

body.nplol {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.nplol h1 { font-size: var(--text-3xl); font-weight: var(--weight-semi); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); margin: 0 0 var(--space-4); }
.nplol h2 { font-size: var(--text-2xl); font-weight: var(--weight-semi); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); margin: 0 0 var(--space-3); }
.nplol h3 { font-size: var(--text-xl);  font-weight: var(--weight-semi); line-height: var(--lh-snug);  letter-spacing: var(--tracking-snug);  margin: 0 0 var(--space-3); }
.nplol h4 { font-size: var(--text-lg);  font-weight: var(--weight-semi); line-height: var(--lh-snug);  margin: 0 0 var(--space-2); }

.nplol p { margin: 0 0 var(--space-3); color: var(--fg-2); line-height: var(--lh-relaxed); }
.nplol small { font-size: var(--text-sm); color: var(--fg-3); }

.nplol a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
.nplol a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; }

.nplol ::selection { background: var(--acid); color: var(--ink); }

/* Reserved for at-most-once-per-screen "lol moment" */
.nplol .display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  margin: 0;
}

/* ===========================================================================
   COMPONENTS
   =========================================================================== */

/* Wordmark — Bricolage 800, lowercase, with tomato dot brand-moment */
.wordmark {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  text-transform: lowercase;
}
.wordmark .dot {
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  background: var(--accent);
  border-radius: 999px;
  align-self: center;
  margin: 0 0.05em;
}

/* Button — rounded 10px, 1.5px ink, 2px hard shadow that "presses in" */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-weight: var(--weight-semi);
  font-size: 14px;
  line-height: 1.1;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-hard-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.btn:hover  { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

.btn.fill-tomato { background: var(--accent); color: var(--ink); }
.btn.fill-tomato:hover { background: var(--accent-deep); }
.btn.fill-acid   { background: var(--acid); color: var(--ink); }
.btn.fill-ink    { background: var(--ink); color: var(--paper); }
.btn.fill-paper  { background: var(--paper); color: var(--ink); }
.btn.fill-berry  { background: var(--berry); color: var(--paper); }

.btn-ghost {
  border: 0;
  box-shadow: none;
  background: transparent;
}
.btn-ghost:hover  { background: var(--bg-elev-1); transform: none; box-shadow: none; }
.btn-ghost:active { transform: none; box-shadow: none; }

/* Input — rounded 10px, 1.5px ink, acid drop-shadow on focus */
.input {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  outline: 0;
  width: 100%;
  box-sizing: border-box;
  transition: box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--fg-muted); }
.input:focus { box-shadow: 2px 2px 0 var(--acid); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Card / tile — slim 6px rounding · ink border · optional hard shadow */
.tile {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 20px 24px;
  box-sizing: border-box;
}
.tile.shadow { box-shadow: 3px 3px 0 var(--ink); }
.tile.elev   { background: var(--paper-2); }

/* Flash — semantic color block, ink border, light hard shadow */
.flash {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.flash > div {
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow-hard-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  background: var(--paper);
  color: var(--ink);
}
.flash-notice { background: var(--acid); }
.flash-alert  { background: var(--berry); color: var(--paper); }

/* ===========================================================================
   PAGES
   =========================================================================== */

.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-14) var(--gutter) var(--space-10);
  gap: var(--space-10);
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-8);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hard);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.auth-card h1 {
  font-size: var(--text-xl);
  margin: 0;
}
.auth-card .lede {
  font-size: var(--text-sm);
  color: var(--fg-3);
  margin: 0;
}
.auth-card form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-card .submit-row { margin-top: var(--space-2); }

.welcome-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-14) var(--gutter);
  gap: var(--space-10);
  text-align: center;
  box-sizing: border-box;
}
.welcome-page .display { color: var(--ink); }
.welcome-page .display .accent { color: var(--accent); }

/* ===========================================================================
   CHAT PAGE
   =========================================================================== */

.chat-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--gutter) var(--space-8);
  gap: var(--space-6);
  max-width: 720px;
  margin: 0 auto;
  box-sizing: border-box;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.chat-header .wordmark { font-size: 28px; }

.user-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-2);
}
.user-bar .user-name .accent { color: var(--accent); font-weight: var(--weight-semi); }

.chat-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-height: 0;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--bg-elev-1);
  min-height: 320px;
  overflow-y: auto;
}
.messages .empty {
  color: var(--fg-3);
  font-size: var(--text-sm);
  text-align: center;
  margin: auto;
}

.message {
  display: flex;
  max-width: 100%;
}
.message-user      { justify-content: flex-end; }
.message-assistant { justify-content: flex-start; }

.message-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  line-height: var(--lh-snug);
  word-wrap: break-word;
}
.message-user      .message-bubble { background: var(--accent); color: var(--ink); border-bottom-right-radius: var(--radius-xs); }
.message-assistant .message-bubble { background: var(--paper);  color: var(--ink); border-bottom-left-radius:  var(--radius-xs); box-shadow: var(--shadow-hard-sm); }

.message-form {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
}
.message-form .input { flex: 1; }

/* Reset some Rails defaults */
.button_to { margin: 0; }
input, button { font-family: inherit; }
