/* scaruffi.ai — editorial design ported from philipdifiore.com (v2 draft) */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #fdfcfa;
  --ink: #1a1814;
  --dim: #807a72;
  --rule: #e2ddd5;
  --kw: #524d47;
  --link-h: #c0392b;
  --lock: #2d7a36;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  padding: 40px 80px 32px;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }

.hero {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 40px 80px;
  align-items: stretch;
  flex: 1;
}
.hero-left { display: flex; flex-direction: column; }

.masthead {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(44px, 5vw, 70px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
.masthead em { font-style: normal; display: block; }
.masthead-section { font-size: clamp(48px, 6vw, 84px); }

/* category column */
.keywords {
  list-style: none; padding: 0;
  margin: 28px 0 0;
  width: fit-content; max-width: 100%;
  line-height: 1.35;
}
.keywords .portal {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--kw);
  cursor: pointer;
  display: block;
  width: fit-content;
  padding: 3px 0;
  transition: color 0.18s ease;
}
.keywords .portal:hover { color: var(--link-h); }
.keywords .portal.locked,
.keywords .portal.locked:hover { color: var(--lock); }

.keywords-nav { margin-top: auto; padding-top: 28px; line-height: 1.6; }
.nav-keyword {
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
  display: inline-block; margin-right: 1.8em;
  transition: color 0.18s ease;
}
.nav-keyword:hover { color: var(--link-h); }

/* preview pane */
.hero-preview { min-height: 0; padding: 6px 0; position: relative; }
.hero-preview h2 {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400; font-size: 2.4rem; line-height: 1.04;
  letter-spacing: -0.025em; color: var(--ink);
  margin: 0 0 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}
.hero-preview .pane-intro {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  max-width: 18ch;
}
.hero-preview .pane-links { list-style: none; margin: 0; padding: 0; }
.hero-preview .pane-links li { margin: 0; }
.hero-preview .pane-links a {
  display: block;
  font-size: 15px; font-weight: 500; line-height: 1.5;
  color: var(--ink); padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  transition: color 0.16s ease;
}
.hero-preview .pane-links a:last-child { border-bottom: 0; }
.hero-preview .pane-links a:hover { color: var(--link-h); }
.hero-preview .pane-open {
  display: inline-block; margin-top: 18px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--ink);
  border-bottom: 1px solid var(--ink); padding-bottom: 3px;
}
.hero-preview .pane-open::after { content: ' \2192'; }
.hero-preview .pane-open:hover { opacity: 0.55; }

/* live "Latest" feed */
.pane-feed, .feed { list-style: none; margin: 0; padding: 0; }
.feed-item {
  padding: 7px 0; border-bottom: 1px solid var(--rule);
  font-size: 14px; line-height: 1.4;
}
.pane-feed .feed-item { font-size: 13.5px; }
.feed-item:last-child { border-bottom: 0; }
.feed-tag {
  display: inline-block; margin-right: 9px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--lock);
  vertical-align: 1px;
}
.feed-item a { color: var(--ink); font-weight: 500; transition: color 0.16s ease; }
.feed-item a:hover { color: var(--link-h); }
.feed-note { color: var(--dim); font-style: italic; font-size: 12px; }

/* section page */
.hero-section { min-height: 0; }
.sub-list {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0 56px; align-content: start;
  border-top: 1px solid var(--ink);
}
.sub-list .sub {
  font-size: 16px; font-weight: 500; line-height: 1.4;
  color: var(--ink); padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  transition: color 0.16s ease;
}
.sub-list .sub:hover { color: var(--link-h); }

/* footer */
footer {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule);
  color: var(--dim); font-size: 11px;
  display: flex; justify-content: center; align-items: center;
  gap: 10px; flex-wrap: wrap; letter-spacing: 0.02em;
}
footer a { color: var(--dim); border-bottom: 1px solid var(--rule); }
footer a:hover { color: var(--link-h); }
.foot-mark { font-weight: 700; color: var(--ink); letter-spacing: 0.04em; }
.foot-sep { color: var(--rule); }

/* ===================== A.I. Scaruffi chat interface (home) ===================== */
/* Modeled on the Hub prototype Option B (chat-first): a thin left rail with a
   hamburger that opens a slide-out drawer (Pinned + Chats); a center chat pane
   with the name/subtitle at top and the answer canvas below; a skinny
   Claude-Code-style chat bar docked at the bottom. Scoped to body.chat. */
body.chat {
  max-width: none; padding: 0; height: 100vh; height: 100dvh; overflow: hidden;
  --side: #f4f1ec; --side-border: #ebe6df; --faint: #a29b93; --soft: #524f4b;
}
.b-workspace { display: flex; height: 100vh; height: 100dvh; }

/* Thin rail — always visible; shows the hamburger */
.rail {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  width: 3.75rem; padding: 1rem 0.5rem;
  background: var(--side); border-right: 1px solid var(--side-border);
}
.rail-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: 0.85rem;
  background: transparent; color: var(--dim); cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.rail-button:hover { background: rgba(110,104,96,0.1); color: var(--soft); }

/* Slide-out drawer — Pinned + Chats. Overlays the left; content never moves. */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  display: none; flex-direction: column; gap: 0.7rem;
  width: 19rem; padding: 1.15rem 0.9rem;
  background: var(--side); border-right: 1px solid var(--side-border);
  overflow: auto;
}
.b-workspace[data-drawer="open"] .drawer { display: flex; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0.5rem 0.2rem; }
.drawer-head h2 {
  margin: 0; font-family: 'DM Serif Display', serif; font-size: 16px; font-weight: 400;
}
.drawer-close {
  font-size: 20px; line-height: 1; color: var(--dim);
  padding: 0.2rem 0.45rem; border-radius: 0.6rem; border: 0; background: transparent; cursor: pointer;
}
.drawer-close:hover { background: rgba(110,104,96,0.1); }
.nav-item {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  min-height: 1.8rem; padding: 0.32rem 0.5rem; border: 0; background: transparent;
  border-radius: 0.55rem; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer;
  transition: background-color 120ms ease;
}
.nav-item:hover { background: rgba(110,104,96,0.08); }
.nav-item .icon { display: inline-flex; width: 0.95rem; height: 0.95rem; flex: 0 0 auto; }
.drawer svg, .rail svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-section { display: flex; flex-direction: column; gap: 0.1rem; }
.section-heading { padding: 0 0.5rem; margin-bottom: 0.05rem; font-size: 11px; font-weight: 500; color: var(--faint); text-transform: none; }
.list-stack { display: flex; flex-direction: column; gap: 0; }
.sidebar-link {
  display: flex; align-items: center; justify-content: flex-start; gap: 0.55rem;
  width: 100%; min-height: 1.7rem; padding: 0.22rem 0.5rem; border: 0; background: transparent;
  border-radius: 0.55rem; color: var(--soft); font-size: 13px; line-height: 1.25;
  text-align: left; cursor: pointer; transition: background-color 120ms ease;
}
.sidebar-link:hover { background: rgba(110,104,96,0.08); }
.sidebar-link::before {
  content: ""; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%;
  border: 1.5px solid var(--faint);
}
.sidebar-link span { flex: 1 1 auto; }
.sidebar-link small { flex: 0 0 auto; margin-left: 0.4rem; font-size: 11px; color: var(--faint); }
.sidebar-link.active-chat { background: #e7e3de; color: var(--ink); }
.sidebar-link.active-chat::before { border-color: var(--dim); }
.drawer-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.1rem; padding-top: 0.55rem; border-top: 1px solid var(--side-border); }
a.nav-item { text-decoration: none; }
.sidebar-empty { padding: 0.2rem 0.5rem; font-size: 12px; line-height: 1.5; color: var(--faint); margin: 0; }
.sidebar-link .pin-btn { flex: 0 0 auto; margin-left: 0.4rem; font-size: 13px; color: var(--faint); opacity: 0; transition: opacity 120ms ease, color 120ms ease; cursor: pointer; }
.sidebar-link:hover .pin-btn { opacity: 1; }
.sidebar-link .pin-btn:hover { color: var(--hover); }
.account-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; }
.account-email { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--soft); }
.signout-btn { flex: 0 0 auto; border: 1px solid var(--side-border); background: transparent; color: var(--dim); font: inherit; font-size: 11px; padding: 0.25rem 0.55rem; border-radius: 0.5rem; cursor: pointer; }
.signout-btn:hover { color: var(--hover); border-color: #cdc7bd; }

/* Center — chat pane */
.b-main { flex: 1; min-width: 0; display: flex; }
.chat-pane { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chat-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: center;
}
.chat-scroll.convo { justify-content: flex-start; }
.ai-header { padding: 0 24px 2vh; text-align: center; flex: 0 0 auto; }
.ai-name {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400; font-size: clamp(44px, 10vw, 124px);
  line-height: 1.0; letter-spacing: -0.03em; white-space: nowrap;
  margin: 0 0 18px; color: var(--ink);
}
/* bio — landing context, disappears once a chat starts */
.bio { max-width: 33rem; margin: 0 auto; }
.bio-quote {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400; font-style: italic;
  font-size: clamp(19px, 2.3vw, 27px); line-height: 1.22;
  letter-spacing: -0.01em; color: var(--ink); margin: 0 0 20px;
}
.bio-cite {
  display: block; font-style: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Inter', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim); margin-top: 8px;
}
.bio-text { font-size: 14.5px; line-height: 1.62; color: var(--soft); margin: 0 0 14px; }
.bio-text:last-child { margin-bottom: 0; }
.bio-text strong { color: var(--ink); font-weight: 600; }
.bio-text a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.bio-text a:hover { color: var(--hover); }
/* About — a quiet top-right link opens a modal with the press quote + bio */
.about-trigger {
  position: fixed; top: 16px; right: 20px; z-index: 40;
  background: transparent; border: 0; cursor: pointer;
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Inter', sans-serif;
  font-size: 13px; font-weight: 500; line-height: 1;
  color: var(--dim); padding: 6px 8px;
}
.about-trigger:hover { color: var(--ink); }
.about-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(26,24,20,0.45);
}
.about-modal[hidden] { display: none; }
.about-card {
  position: relative; background: var(--bg); max-width: 36rem; width: 100%;
  max-height: 86vh; overflow-y: auto;
  padding: 40px 38px 34px; border-radius: 14px; border: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(26,24,20,0.22);
}
.about-card .bio-quote { margin-top: 6px; }
.about-close {
  position: absolute; top: 12px; right: 16px; background: transparent; border: 0;
  font-size: 26px; line-height: 1; color: var(--faint); cursor: pointer;
}
.about-close:hover { color: var(--ink); }
/* example-question chips (the way-in) — pill style */
.chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin: 26px auto 0; max-width: 38rem;
}
.chip {
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Inter', sans-serif;
  font-size: 13px; font-weight: 500; line-height: 1;
  color: var(--soft); background: transparent;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 7px 15px; cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.chip:hover { color: var(--ink); border-color: #cdc7bd; }
.chip.active { color: var(--bg); background: var(--ink); border-color: var(--ink); }

/* top header — hidden on the landing, pinned to the top once a chat starts.
   The top padding clears the phone status bar / notch (env() is 0 on desktop). */
.chat-topbar { display: none; flex: 0 0 auto; align-items: center; justify-content: center;
  padding: calc(13px + env(safe-area-inset-top)) 24px 13px;
  border-bottom: 1px solid var(--rule); background: var(--bg); }
body.convo .chat-topbar { display: flex; }
.chat-topbar-name {
  font-family: 'DM Serif Display', 'Times New Roman', serif;
  font-weight: 400; font-size: 22px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none; line-height: 1;
}
.chat-topbar-name:hover { color: var(--hover); }

/* conversation thread — replaces the landing once a chip/message starts a chat */
.thread { display: none; }
.chat-scroll.convo .ai-header { display: none; }
.chat-scroll.convo .thread {
  display: flex; flex-direction: column; gap: 14px;
  width: min(100%, 46rem); margin: 0 auto; padding: 6vh 24px 5vh;
}
.msg-scaruffi {
  align-self: stretch; width: 100%;
  background: rgba(0,0,0,0.03); border: 1px solid #efeae4; border-radius: 12px;
  padding: 14px 16px;
}
.msg-scaruffi .msg-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: #7c766f; margin-bottom: 6px;
}
.msg-body p {
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px; line-height: 1.65; color: rgba(0,0,0,0.72); margin: 0 0 0.6em;
}
.msg-body p:last-child { margin-bottom: 0; }
.msg-user {
  align-self: flex-end; max-width: 78%;
  background: #3a3633; border: 1px solid #efeae4; border-radius: 12px; padding: 12px 16px;
}
.msg-user .msg-body p { color: #e8e4dc; margin: 0; }
.msg-scaruffi .msg-body a {
  color: var(--dim); text-decoration: none; border-bottom: 1px solid var(--rule);
  word-break: break-all;
}
.msg-scaruffi .msg-body a:hover { color: var(--hover); border-color: var(--hover); }
.msg-scaruffi.pending .msg-body p.thinking {
  color: var(--dim); animation: scaruffi-pulse 1.4s ease-in-out infinite;
}
@keyframes scaruffi-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* Chat bar — Option B skinny, Claude-Code-style single line + enter glyph. */
.composer-dock {
  flex: 0 0 auto; display: flex; justify-content: center;
  padding: 0.6rem 1.2rem 1.3rem;
  padding-bottom: calc(1.3rem + env(safe-area-inset-bottom));
}
.composer {
  display: flex; align-items: center; gap: 0.5rem;
  width: min(100%, 48rem); margin: 0;
  padding: 0.55rem 0.6rem 0.55rem 1rem;
  border: 1px solid var(--rule); border-radius: 0.85rem;
  background: #ffffff; box-shadow: none;
}
.composer-input {
  flex: 1 1 auto; min-height: 1.4rem; height: 1.4rem; max-height: 9rem;
  border: 0; resize: none; background: transparent; color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, 'Inter', sans-serif;
  font-size: 14px; line-height: 1.4; padding: 0;
}
.composer-input::placeholder { color: #a29b93; }
.composer-input:focus { outline: none; }
.enter-button {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 1.9rem; height: 1.9rem;
  border: 0; border-radius: 0.55rem; background: transparent;
  color: #a29b93; cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.enter-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.enter-button:hover { color: var(--dim); background: rgba(110,104,96,0.08); }
@media (max-width: 640px) {
  /* keep the bottom inset so the composer clears the home indicator */
  .composer-dock { padding: 0.6rem 14px 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .composer { width: 100%; }
  .ai-header { padding: 5vh 18px 0; }
  .ai-name { font-size: clamp(40px, 15vw, 72px); margin-bottom: 14px; }
  .chips { max-width: 92vw; margin-top: 20px; }
  .chip { font-size: 13px; padding: 8px 14px; }
  .about-trigger { top: calc(12px + env(safe-area-inset-top)); right: 14px; }
  .chat-topbar { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .chat-scroll.convo .thread { width: 100%; padding: 4vh 16px 4vh; }
  .msg-user { max-width: 88%; }
}

@media (max-width: 900px) {
  body { padding: 32px 28px 72px; }
  .hero { grid-template-columns: 1fr; gap: 8px; min-height: 0; }
  .hero-preview { min-height: 0; margin-top: 36px; border-top: 1px solid var(--rule); padding-top: 36px; }
  .keywords { margin-top: 32px; }
  .sub-list { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .keywords .portal { font-size: 17px; }
}
