:root {
  /* Parchment theme */
  --bg: #fcf8f2;
  --text: #2f4858;
  --muted: #4d6a70;
  --muted-light: #758d89;
  --accent: #4d6a70;
  --border: #d1d3c9;
  --surface: #ffffff;
  --outside-bg: #d1d3c9;
  --outside-border: #a3afa5;
  --hatch-a: #fcf8f2;
  --hatch-b: #d1d3c9;

  --serif: 'Source Serif 4', serif;
  --sans: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: 0;
}

/* Header + quick facts */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.header-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.header-links a {
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
}

.header-links .cv-link {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.header-links .linkedin-link {
  color: var(--accent);
  text-decoration: underline;
}

.quick-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

.fact {
  padding: 11px 22px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fact:first-child {
  border-left: none;
  padding-left: 40px;
}

.fact:last-child {
  padding-right: 40px;
}

.fact .label {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-light);
}

.fact .value {
  font-weight: 700;
  font-size: 13px;
}

/* Hero + About */

.hero {
  padding: 56px 40px 28px;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 34px;
  line-height: 1.2;
  max-width: 800px;
}

.band {
  padding: 0 40px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted-light);
  margin: 0 0 0.5rem;
}

.band p:not(.eyebrow) {
  font-size: 14px;
  line-height: 1.7;
  max-width: 760px;
}

/* Two-column layout */

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  padding: 0 40px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.rail {
  border-right: 1px solid var(--border);
  padding-right: 28px;
  align-self: start;
}

.rail section {
  margin-bottom: 2rem;
}

.rail h2 {
  font-size: 15px;
  margin-bottom: 0.75rem;
}

.rail-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.rail-timeline li {
  position: relative;
  padding: 0 0 0.85rem 14px;
}

.rail-timeline li::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-light);
}

.rail-timeline.achievements li::before {
  background: var(--accent);
}

.rail-timeline.achievements li {
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.6;
}

.rail-timeline.achievements li strong {
  font-weight: 700;
}

.rail-timeline.quals li {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.rail-list.experience {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-list.experience li {
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.rail-list.experience li:last-child {
  border-bottom: none;
}

.rail-list.experience .date {
  display: block;
  font-size: 11px;
  color: var(--muted-light);
}

.company-logos {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
}

.company-logo {
  height: 16px;
  width: auto;
  filter: grayscale(1);
  opacity: 0.7;
}

.rail-list.experience .role-line {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  margin: 2px 0 4px;
}

.rail-list.experience p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.main-col {
  padding-left: 40px;
  min-width: 0;
}

/* Featured AI system card */

.featured-card {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 26px 28px;
  background: var(--surface);
  margin-bottom: 2.5rem;
}

.featured-card .eyebrow {
  color: var(--accent);
}

.featured-card h2 {
  font-size: 20px;
  margin-bottom: 0.6rem;
}

.pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}

.featured-card p:not(.eyebrow):not(.pull-quote) {
  font-size: 13.5px;
  line-height: 1.7;
  margin: 0 0 0.75rem;
}

.featured-card p.muted {
  font-size: 13px;
  color: var(--muted);
}

/* Projects */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-head h2 {
  font-size: 22px;
}

.section-head .meta {
  font-size: 12px;
  color: var(--muted-light);
  margin: 0;
}

.group-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  margin: 1.5rem 0 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.project-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.thumb {
  height: 120px;
  flex-shrink: 0;
  background-image: repeating-linear-gradient(135deg, var(--hatch-a), var(--hatch-a) 10px, var(--hatch-b) 10px, var(--hatch-b) 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: inherit;
}

.thumb span {
  font-family: monospace;
  font-size: 10px;
  color: var(--muted-light);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: none;
}

.card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.card-body h3 {
  font-size: 15.5px;
  font-weight: 700;
}

.project-card .tags {
  font-size: 10px;
  color: var(--muted-light);
  margin: auto 0 0;
  padding-top: 8px;
}

.project-card .one-liner {
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.project-card .details {
  margin-top: 0.6rem;
}

.project-card .details ul {
  margin: 0;
  padding-left: 1.1rem;
}

.project-card .details li {
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 0.4rem;
}

.view-live {
  display: inline-block;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.2rem;
}

.toggle-details {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0;
  margin-top: 0.5rem;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  cursor: pointer;
}

.toggle-details .toggle-icon {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.2s ease;
}

.toggle-details[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

/* Outside of work */

.outside-band {
  background: var(--outside-bg);
  border: 1px solid var(--outside-border);
  border-radius: 10px;
  padding: 30px 32px;
  margin-top: 2.5rem;
}

.outside-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 1.5rem;
  align-items: center;
}

.outside-text h2 {
  font-size: 16px;
  margin-bottom: 0.5rem;
}

.outside-text p {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

.outside-photo {
  width: 200px;
  height: 120px;
  border-radius: 6px;
}

/* Agent footer */

.agent-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 40px 3rem;
}

.agent-footer p {
  font-size: 11.5px;
  color: var(--muted-light);
}

.agent-footer a {
  color: var(--accent);
}

/* Chat widget */

.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 270px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(47, 72, 88, 0.15);
  overflow: hidden;
  z-index: 30;
  transition: width 0.2s ease;
}

.chat-widget.expanded {
  width: 420px;
}

.chat-header {
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fcf6f;
  flex-shrink: 0;
}

.chat-title {
  flex: 1;
}

.chat-expand {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.85;
}

.chat-toggle {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.chat-panel {
  padding: 12px;
}

.chat-widget.minimized .chat-expand {
  display: none;
}

.chat-widget.minimized .chat-panel {
  display: none;
}

.chat-log {
  height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 0.6rem;
}

.chat-widget.expanded .chat-log {
  height: min(1020px, calc(100vh - 160px));
}

.bubble {
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  max-width: 90%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bubble.assistant {
  background: var(--bg);
  border-bottom-left-radius: 2px;
}

.bubble.user {
  background: var(--accent);
  color: #ffffff;
  margin-left: auto;
  border-bottom-right-radius: 2px;
}

.bubble a {
  color: inherit;
  text-decoration: underline;
  overflow-wrap: break-word;
  word-break: break-word;
}

#chat-form {
  display: flex;
  gap: 0.4rem;
}

#chat-input {
  flex: 1;
  padding: 0.5rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Responsive */

@media (max-width: 900px) {
  .quick-facts {
    grid-template-columns: repeat(2, 1fr);
  }
  .layout {
    grid-template-columns: 1fr;
    padding: 0 20px 40px;
  }
  .rail {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 1.5rem;
    position: static;
    margin-bottom: 1.5rem;
  }
  .main-col {
    padding-left: 0;
  }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-row, .hero, .band {
    padding-left: 20px;
    padding-right: 20px;
  }
  .agent-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .outside-grid {
    grid-template-columns: 1fr;
  }
  .outside-photo {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .quick-facts {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .chat-widget {
    width: calc(100% - 24px);
    right: 12px;
    left: 12px;
  }
}
