/* Quarry — REG brand. Red-forward, bold, dark/charcoal, generous whitespace. */

:root {
  --red: #de3341;
  --red-dark: #a92024;
  --teal: #00d09c;
  --charcoal: #1f1f25;
  --charcoal-2: #2a2a33;
  --charcoal-3: #3a3a45;
  --off-white: #f8f9fc;
  --muted: #9a9aa5;
  --border: #35353f;

  --grad: linear-gradient(145deg, var(--red-dark), var(--red));
  --grad-soft: linear-gradient(145deg, rgba(169,32,36,0.12), rgba(222,51,65,0.20));

  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--charcoal);
  color: var(--off-white);
  font-family: var(--sans);
  font-feature-settings: "cv11","ss01","ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(222,51,65,0.10), transparent 60%),
    radial-gradient(900px 700px at 0% 110%, rgba(0,208,156,0.06), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Hero (signed-out) ---- */

.hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 7rem 2rem 4rem;
  text-align: left;
}
.brand-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 3.5rem; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad);
  display: grid; place-items: center;
  box-shadow: 0 8px 32px rgba(222,51,65,0.3);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-word { font-weight: 800; letter-spacing: -0.01em; font-size: 1.125rem; }
.brand-word em { font-style: normal; color: var(--red); }

.hero h1 {
  font-weight: 900;
  font-size: clamp(2.75rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 1.5rem;
}
.hero h1 .mark { color: var(--red); }
.hero .tag {
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 620px;
  line-height: 1.55;
  margin: 0 0 2.5rem;
}

.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 5rem; }
button.primary {
  background: var(--grad);
  color: white;
  border: 0;
  padding: 1rem 1.75rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(222,51,65,0.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
button.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 40px rgba(222,51,65,0.45); }
button.primary:active { transform: translateY(0); }
button.primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.ghost {
  color: var(--muted);
  font-size: .925rem;
}

.pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 3rem; }
.pill {
  font-size: .8rem;
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}
.pill strong { color: var(--off-white); font-weight: 600; }

.signin-card {
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  max-width: 420px;
}
.signin-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.signin-card input {
  width: 100%;
  padding: .75rem .9rem;
  background: var(--charcoal-2);
  color: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: .95rem;
}
.signin-card input:focus { outline: 2px solid var(--red); outline-offset: 1px; }

.footnote { color: var(--muted); font-size: .8rem; line-height: 1.5; margin-top: 3rem; max-width: 560px; }

/* ---- App shell (signed-in) ---- */

.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  gap: 0;
}
.sidebar {
  background: #16161c;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-head {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-head .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.new-chat {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--off-white);
  padding: .5rem .75rem;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.new-chat:hover { background: var(--charcoal-2); border-color: var(--red); }

.conv-list { flex: 1; overflow-y: auto; padding: .75rem .5rem; }
.conv-item {
  padding: .625rem .75rem;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: .875rem;
  cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.conv-item:hover { background: var(--charcoal-2); color: var(--off-white); }
.conv-item.active { background: var(--grad-soft); color: var(--off-white); border: 1px solid rgba(222,51,65,0.3); }
.conv-empty { color: var(--muted); font-size: .85rem; padding: 1rem; text-align: center; }

.sidebar-foot {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
}
.userchip { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { background: none; border: 0; color: var(--muted); font-size: .8rem; cursor: pointer; padding: 0; }
.signout:hover { color: var(--red); }

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.main-head {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.main-head .title { font-weight: 600; font-size: .95rem; }
.model-picker {
  background: var(--charcoal-2);
  color: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: .4rem .65rem;
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0;
}
.messages { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; display: flex; flex-direction: column; gap: 1.75rem; }
.bubble {
  display: flex; gap: 1rem;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bubble .avatar {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-weight: 700; font-size: .8rem;
}
.bubble.user .avatar { background: var(--charcoal-2); color: var(--muted); border: 1px solid var(--border); }
.bubble.assistant .avatar { background: var(--grad); color: white; }
.bubble .content {
  flex: 1;
  line-height: 1.6;
  color: var(--off-white);
  font-size: .975rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding-top: .25rem;
}
.bubble.assistant .content { color: #e8e8ee; }
.bubble .content.reasoning { color: var(--muted); font-style: italic; font-size: .9rem; border-left: 2px solid var(--border); padding-left: .75rem; }

.main-foot {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1.5rem;
  background: rgba(22,22,28,0.95);
  backdrop-filter: blur(8px);
}
.composer {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}
.composer textarea {
  width: 100%;
  min-height: 58px; max-height: 280px;
  padding: 1rem 3.5rem 1rem 1.25rem;
  background: var(--charcoal-2);
  color: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-family: inherit;
  font-size: .975rem;
  line-height: 1.5;
  resize: none;
}
.composer textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
.send-btn {
  position: absolute;
  right: .55rem; bottom: .55rem;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--grad);
  color: white;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .12s ease;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.composer-hint { font-size: .75rem; color: var(--muted); text-align: center; margin-top: .75rem; }

/* empty state inside main */
.empty-state {
  max-width: 720px;
  margin: 10vh auto 0;
  padding: 0 1.5rem;
  text-align: left;
}
.empty-state h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 2.25rem;
  margin: 0 0 .75rem;
  line-height: 1.05;
}
.empty-state p { color: var(--muted); font-size: 1rem; max-width: 520px; line-height: 1.55; }
.starter-grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.starter {
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.02);
  text-align: left;
  color: var(--off-white);
  font-family: inherit;
  font-size: .9rem;
  cursor: pointer;
  line-height: 1.4;
  transition: border-color .15s, background .15s;
}
.starter:hover { border-color: var(--red); background: var(--grad-soft); }
.starter strong { display: block; margin-bottom: .25rem; }
.starter span { color: var(--muted); font-size: .8rem; }

@media (max-width: 760px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .starter-grid { grid-template-columns: 1fr; }
}

/* banner for errors / status */
.banner {
  padding: .75rem 1rem;
  background: rgba(222,51,65,0.12);
  border: 1px solid rgba(222,51,65,0.4);
  color: #ffb4ba;
  border-radius: var(--r-md);
  font-size: .85rem;
  margin: 0 0 1rem;
}
