/* Affordable Drafting assistant. ADS Design System tokens: no shadows, 8px corners, Exo 2 headings, Noto Sans body. */
:root {
  --ads-blue: #0753a0;
  --ads-blue-deep: #004794;
  --accent: #2b7bb9;
  --ink: #000000;
  --body-text: #444444;
  --muted: #757575;
  --page-bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #e9eef4;
  --on-blue: #ffffff;
  --line: #d9d9d9;
  --radius: 8px;
  --font-head: "Exo 2", system-ui, sans-serif;
  --font-body: "Noto Sans", system-ui, sans-serif;
  --composer-h: 150px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ffffff;
    --body-text: #d6d6d6;
    --muted: #9a9a9a;
    --page-bg: #121417;
    --surface: #1c1f24;
    --surface-2: #262b33;
    --line: #363b44;
    --accent: #5aa0dc;
  }
}
:root[data-theme="dark"] {
  --ink: #ffffff;
  --body-text: #d6d6d6;
  --muted: #9a9a9a;
  --page-bg: #121417;
  --surface: #1c1f24;
  --surface-2: #262b33;
  --line: #363b44;
  --accent: #5aa0dc;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--body-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
a { color: var(--accent); }
h1 { font-family: var(--font-head); color: var(--ink); font-weight: 700; line-height: 1.2; margin: 0 0 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Light/dark logo swap */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: inline-block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline-block; }

/* Top bar: hidden on the home screen, shown once chatting */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid transparent;
}
.top-brand img { height: 36px; width: auto; visibility: hidden; }
body.mode-chat .top { border-color: var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
body.mode-chat .top-brand img { visibility: visible; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.who { font-size: .8rem; color: var(--muted); margin-right: 4px; }
.who strong { color: var(--ink); font-weight: 600; }
@media (max-width: 480px) { .who { display: none; } }
.btn-link {
  font-family: var(--font-head); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem;
  color: var(--ads-blue); text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 12px; background: var(--surface);
}
:root[data-theme="dark"] .btn-link { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-link { color: var(--accent); } }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); width: 36px; height: 36px; cursor: pointer; font-size: 18px; line-height: 1; }
.when-dark { display: none; }
:root[data-theme="dark"] .when-light { display: none; }
:root[data-theme="dark"] .when-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-light { display: none; }
  :root:not([data-theme="light"]) .when-dark { display: inline; }
}

main { flex: 1; width: 100%; }

/* Home: Google-simple */
.home { max-width: 720px; margin: 0 auto; padding: 8vh 16px 16px; text-align: center; }
.home .logo { width: min(260px, 60vw); height: auto; margin-bottom: 1rem; }
.home h1 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px auto 0; max-width: 720px; }
body.mode-chat .starters { display: none; }
.starter {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.starter:hover { border-color: var(--accent); }

/* Chat */
.chat { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--composer-h) + 16px); }
.messages { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: var(--radius); white-space: normal; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ads-blue); color: var(--on-blue); white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); color: var(--body-text); }
.msg.assistant p { margin: 0 0 .6em; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 .6em; padding-left: 1.3em; }
.msg.assistant li { margin: .15em 0; }
.msg.assistant strong { color: var(--ink); }
.msg.assistant.error { border-color: #c62828; color: #c62828; }
.msg.assistant.status { color: var(--muted); font-style: italic; }
.notice { align-self: center; font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius); padding: 6px 12px; text-align: center; }
.msg.assistant.thinking::after { content: "…"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Composer: centered on home, pinned to the bottom while chatting */
.composer-wrap { padding: 0 16px 10px; }
body.mode-home .composer-wrap { max-width: 720px; margin: -0.25rem auto 0; width: 100%; order: 0; }
body.mode-home main { flex: 0 0 auto; }
body.mode-home .composer-wrap { flex: 1 0 auto; }
body.mode-chat .composer-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--page-bg); border-top: 1px solid var(--line);
  padding: 10px 16px calc(8px + env(safe-area-inset-bottom));
}
body.mode-chat .composer { max-width: 760px; margin: 0 auto; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 8px 8px 8px 16px;
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 1.05rem;
  line-height: 1.4; max-height: 160px; padding: 6px 0;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ads-blue); color: var(--on-blue); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.send:disabled { opacity: .45; cursor: default; }
.disclosure { max-width: 760px; margin: 14px auto 0; font-size: .78rem; color: var(--muted); text-align: center; }
body.mode-chat .disclosure { margin-top: 6px; }

/* Inside the website bubble (/embed): compact, with Open-in-new-tab and Close buttons */
.embed-only { display: none; }
body.embed .embed-only { display: inline-flex; align-items: center; }
body.embed .top { border-color: var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
body.embed .top-brand img { visibility: visible; height: 28px; }
body.embed .home { padding-top: 16px; }
body.embed .home .logo { width: 150px; margin-bottom: .5rem; }
body.embed .home h1 { font-size: 1.1rem; }
body.embed .starter { font-size: .88rem; padding: 7px 11px; }
body.embed #themeToggle { display: none; }

/* Starter buttons disappear once a chat starts; the home section too */
body.mode-chat #home { display: none; }

@media (max-width: 480px) {
  .home { padding-top: 5vh; }
  .msg { max-width: 96%; }
  .top-brand img { height: 30px; }
}
