/* =============================================================================
   callroman.com
   A personal page: warm paper background, one accent, Roman's portrait up front.
   Theme via color-scheme + light-dark(); JS sets data-theme before paint.
   ============================================================================= */

:root {
  color-scheme: light dark;

  --bg:        light-dark(#f8f5ef, #171512);
  --surface:   light-dark(#fffdf9, #1f1c18);
  --surface-2: light-dark(#f0ebe2, #29251f);
  --fg:        light-dark(#23201c, #f1ece3);
  --fg-2:      light-dark(#5c564d, #b8b0a3);
  --fg-3:      light-dark(#756e62, #958d80);
  --line:      light-dark(rgba(35,32,28,.10), rgba(241,236,227,.10));
  --line-2:    light-dark(rgba(35,32,28,.18), rgba(241,236,227,.18));
  --accent:    light-dark(#a8492a, #e39472);
  --accent-soft: light-dark(#f3e4da, #3a2a22);

  --shadow: 0 1px 2px rgba(35,32,28,.05), 0 10px 30px -18px rgba(35,32,28,.28);

  --font:  "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --col: 700px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -20px rgba(0,0,0,.7); }

/* ---- Base -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Top bar ------------------------------------------------------------------ */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; flex-direction: column; line-height: 1.25; text-decoration: none; color: inherit; min-width: 0; }
.bar-left strong { font-weight: 600; font-size: 15px; }
.status { font-size: 12.5px; color: var(--fg-3); display: none; }
body.chatting .status, body.page .status { display: block; }
.status.busy { color: var(--accent); }

.bar-right { display: flex; align-items: center; gap: 4px; }
.icon-btn, .text-btn, .theme {
  display: inline-grid; place-items: center; height: 36px; min-width: 36px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--fg-2);
  transition: background .18s, color .18s, border-color .18s;
}
.text-btn { font-size: 14px; font-weight: 500; }
.icon-btn:hover, .text-btn:hover, .theme:hover { background: var(--surface-2); color: var(--fg); }
#newChat { display: none; }
body.chatting #newChat { display: inline-grid; }
.theme { position: relative; width: 36px; padding: 0; }
.theme .knob { position: absolute; inset: 0; display: grid; place-items: center; }
.theme svg { position: absolute; width: 16px; height: 16px; transition: opacity .25s; }
.theme .moon { opacity: 0; }
:root[data-theme="dark"] .theme .sun  { opacity: 0; }
:root[data-theme="dark"] .theme .moon { opacity: 1; }

/* ---- Thread -------------------------------------------------------------------- */
.thread { position: relative; flex: 1; width: 100%; max-width: var(--col); margin: 0 auto; padding: 24px 20px; }

/* ---- Home: introduction --------------------------------------------------------- */
.hero { padding: clamp(12px, 4vh, 40px) 0 20px; }
.hero.is-gone { animation: sink .35s var(--ease) forwards; pointer-events: none; }

.intro { display: flex; align-items: center; gap: 28px; }
.portrait {
  flex: none; width: 148px; height: 148px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); box-shadow: 0 0 0 5px var(--surface), 0 0 0 6px var(--line-2), var(--shadow);
}
.intro h1 {
  margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 5.2vw, 42px);
  line-height: 1.1; letter-spacing: -.015em;
}
.lead { margin: 0; font-size: 17.5px; color: var(--fg-2); max-width: 44ch; }

.reach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 28px 0 0; }
.reach-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); text-decoration: none;
  font-size: 15px; font-weight: 500; transition: border-color .18s, background .18s, color .18s;
}
.reach-btn svg { width: 17px; height: 17px; flex: none; }
.reach-btn:hover { border-color: var(--accent); color: var(--accent); }
.reach-btn.is-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.reach-btn.is-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.reach-rest { display: inline-flex; gap: 16px; margin-left: 6px; }
.reach-more { font-size: 14.5px; color: var(--fg-2); text-underline-offset: 3px; }
.reach-more:hover { color: var(--accent); }

.label { margin: 44px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }

.companies { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.companies li + li { border-top: 1px solid var(--line); }
.companies a {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: baseline;
  padding: 16px 20px; text-decoration: none; transition: background .18s;
}
.companies a:hover { background: var(--surface-2); }
.co-name { font-weight: 600; font-size: 16.5px; }
.co-host { font-size: 13.5px; color: var(--fg-3); white-space: nowrap; transition: color .18s; }
.companies a:hover .co-host { color: var(--accent); }
.co-tag { grid-column: 1 / -1; color: var(--fg-2); font-size: 15px; line-height: 1.5; }

.ask-text { margin: 0 0 14px; color: var(--fg-2); max-width: 56ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  color: var(--fg-2); font-size: 14.5px; line-height: 1.35; text-align: left;
  transition: border-color .18s, background .18s, color .18s;
}
.chip:hover { color: var(--fg); background: var(--surface); border-color: var(--accent); }

/* ---- Messages -------------------------------------------------------------------- */
.messages { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; margin: 12px 0; animation: rise .35s var(--ease) both; }
.badge {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--serif); font-weight: 600; font-size: 15px;
}
.msg.cont { margin-top: -2px; }
.msg.cont .badge { visibility: hidden; }
.msg-body { min-width: 0; }
.msg-name { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.msg-name span { font-weight: 400; color: var(--fg-3); margin-left: 6px; }
.msg.user { grid-template-columns: 1fr; justify-items: end; }
.msg.user .bubble {
  max-width: 82%; background: var(--surface-2); color: var(--fg);
  padding: 10px 15px; border-radius: 18px 18px 4px 18px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.from-rami .bubble { line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 .75em; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: .4em 0 .75em; padding-left: 1.25em; }
.bubble li { margin: .25em 0; }
.bubble a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.bubble code { font-size: .9em; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }
.bubble strong { font-weight: 600; }
.thinking { display: inline-flex; gap: 5px; padding: 10px 2px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); animation: dots 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
.msg.system .bubble { color: var(--fg-2); font-size: 14.5px; }

/* Rich replies: company card, portrait, contact links */
.card {
  --c: var(--accent);
  margin: 12px 0 6px; padding: 16px 18px; border-radius: 14px;
  border: 1px solid var(--line); border-left: 3px solid var(--c); background: var(--surface);
  display: grid; gap: 8px; font-size: 15px;
}
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-name { font-weight: 600; font-size: 17px; }
.card-link { font-size: 13.5px; text-decoration: none; color: var(--fg-2); white-space: nowrap; }
.card-link:hover { color: var(--accent); }
.card-tag { margin: 0; color: var(--fg); font-weight: 500; }
.card-what { margin: 0; color: var(--fg-2); line-height: 1.55; }
.card-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.card-facts span { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); }

.photo { margin: 12px 0 6px; }
.photo figure { margin: 0; display: flex; align-items: center; gap: 14px; }
.photo img { display: block; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line-2); }
.photo figcaption { font-size: 14px; color: var(--fg-2); }

.contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.contact a {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); text-decoration: none;
  font-size: 14px; font-weight: 500; color: var(--fg); transition: border-color .18s, color .18s;
}
.contact a:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Composer ------------------------------------------------------------------ */
.composer-wrap {
  position: sticky; bottom: 0; z-index: 15;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.composer {
  width: 100%; max-width: var(--col); margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 18px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 26px; box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow); }
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none;
  color: var(--fg); font: inherit; font-size: 16px; line-height: 1.45; padding: 9px 0; max-height: 160px;
}
.composer textarea::placeholder { color: var(--fg-3); }
.send {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--fg); color: var(--bg); display: grid; place-items: center;
  transition: opacity .18s, background .18s;
}
.send:disabled { opacity: .25; cursor: default; }
.composer.has-text .send:not(:disabled) { background: var(--accent); color: #fff; }
.fineprint { max-width: var(--col); margin: 8px auto 0; text-align: center; font-size: 12.5px; color: var(--fg-3); line-height: 1.45; }
.fineprint a { color: var(--fg-2); }

/* ---- Notes drawer -------------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); animation: fade .25s both; }
.scrim[hidden], .notes[hidden] { display: none; }
.notes {
  position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  padding: 20px 24px 40px; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  animation: slide .35s var(--ease) both;
}
.notes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.notes h2 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.note { padding: 18px 0; border-top: 1px solid var(--line); }
.note time { font-size: 12.5px; color: var(--fg-3); }
.note h3 { margin: 4px 0 8px; font-size: 17px; font-weight: 600; }
.note p { margin: 0; color: var(--fg-2); font-size: 15px; }

/* ---- Prose page (privacy) ------------------------------------------------------------- */
.prose { width: 100%; max-width: 660px; margin: 0 auto; padding: 48px 20px 80px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.prose h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 5vw, 40px); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 18px; }
.prose h1 em { font-style: italic; }
.prose .lede { font-size: 17.5px; color: var(--fg-2); }
.prose h2 { font-size: 19px; font-weight: 600; margin: 36px 0 10px; }
.prose p, .prose li { color: var(--fg-2); line-height: 1.65; }
.prose li { margin: 8px 0; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose a { color: var(--accent); }
.prose .updated { font-size: 13.5px; color: var(--fg-3); margin-top: 40px; }
.btn-primary {
  display: inline-block; padding: 10px 18px; border-radius: 999px; border: 0;
  background: var(--fg); color: var(--bg) !important; font-weight: 500; font-size: 15px; text-decoration: none;
}
.btn-primary:hover { background: var(--accent); color: #fff !important; }

/* ---- Keyframes ------------------------------------------------------------------------- */
@keyframes rise  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sink  { to { opacity: 0; transform: translateY(-10px); } }
@keyframes dots  { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }

/* ---- Small screens ----------------------------------------------------------------------- */
@media (max-width: 600px) {
  .intro { flex-direction: column; align-items: flex-start; gap: 20px; }
  .portrait { width: 112px; height: 112px; }
  .lead { font-size: 17px; }
  .label { margin-top: 36px; }
  .companies a { padding: 14px 16px; }
  .msg.user .bubble { max-width: 90%; }
}

/* ---- Motion preferences -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
