/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg:           #F5F3EE;
  --bg-alt:       #EFECE5;
  --text:         #1F1F1F;
  --text-muted:   #6B6B6B;
  --accent:       #A0714A;
  --accent-light: #C49268;
  --border:       #DDD8CF;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --max-width:    860px;
  --section-gap:  5.5rem;
  --nav-h:        64px;
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-light);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 2rem;
}

.section {
  padding-block: var(--section-gap);
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-heading {
  font-size: clamp(1.6rem, 3vw, 2rem);
  color: var(--text);
  margin-bottom: 2.5rem;
  position: relative;
  padding-bottom: 0.75rem;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background-color: var(--accent);
}

.section-intro {
  color: var(--text-muted);
  margin-top: -1.5rem;
  margin-bottom: 2.5rem;
  max-width: 60ch;
}

/* ============================================================
   Fade-in animation
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Navigation
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}

.nav {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-name:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text);
  background-color: var(--bg-alt);
}

.nav-chat-link {
  color: var(--accent) !important;
  border: 1px solid var(--border);
}

.nav-chat-link:hover {
  background-color: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text);
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after  { top:  7px; }

.nav-open .hamburger          { background-color: transparent; }
.nav-open .hamburger::before  { transform: translateY(7px) rotate(45deg); }
.nav-open .hamburger::after   { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding-top: calc(var(--section-gap) + 1rem);
  padding-bottom: var(--section-gap);
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero-name {
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.hero-rule {
  border: none;
  border-top: 1px solid var(--border);
  width: 4rem;
  margin: 0 0 1.75rem;
}

.hero-tagline {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 55ch;
  line-height: 1.65;
}

.hero-cta {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.85rem 2rem;
  background-color: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.hero-cta:hover {
  background-color: var(--accent-light);
  color: #fff;
}

/* ============================================================
   About
   ============================================================ */
.about-body p {
  color: var(--text);
  margin-bottom: 1.25rem;
  max-width: 68ch;
  font-size: 1.0625rem;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Experience / Timeline
   ============================================================ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.timeline-entry:first-child {
  padding-top: 0;
  border-top: none;
}

.timeline-meta {
  padding-top: 0.2rem;
}

.timeline-company {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.timeline-acquired {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: block;
}

.timeline-dates {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.timeline-title {
  font-family: var(--font-heading);
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
}

.timeline-highlights {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-highlights li {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding-left: 1.1rem;
  position: relative;
}

.timeline-highlights li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ============================================================
   Achievements
   ============================================================ */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.achievement-item {
  padding: 1.75rem 2rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  margin: -1px 0 0 -1px;
}

.achievement-item h3 {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.achievement-item p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem;
}

.skill-category h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.skill-category ul {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.skill-category li {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ============================================================
   Thought Leadership
   ============================================================ */
.tl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.tl-card {
  padding: 1.75rem;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.tl-card h3 {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.tl-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.tl-cta {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* ============================================================
   Reading
   ============================================================ */
.reading-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  align-items: start;
}

.reading-group h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.reading-current {
  font-size: 1rem;
  color: var(--text-muted);
}

.reading-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.reading-list li {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.reading-list em {
  color: var(--text);
  font-style: italic;
}

.reading-author {
  color: var(--text-muted);
}

/* ============================================================
   Certifications & Education
   ============================================================ */
.cert-edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.cert-edu-grid h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.cert-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cert-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cert-list strong {
  font-size: 0.9375rem;
  color: var(--text);
  font-weight: 500;
}

.cert-list span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================================
   Hobbies
   ============================================================ */
.hobbies-body p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 65ch;
  line-height: 1.7;
}

.hobbies-body p + p {
  margin-top: 0.75rem;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  padding: 1.1rem 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 300;
  line-height: 1;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 0 1.25rem;
}

.faq-answer p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 65ch;
  line-height: 1.65;
}

/* ============================================================
   AI Chat section
   ============================================================ */
.section-chat {
  background-color: var(--bg-alt);
}

.chat-inline {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 680px;
}

/* ============================================================
   Shared chat widget styles
   ============================================================ */
.chat-messages {
  padding: 1.25rem 1.5rem;
  min-height: 260px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 85%;
}

.chat-message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-message.ai {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 0.65rem 1rem;
  border-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.chat-message.user .chat-bubble {
  background-color: var(--accent);
  color: #fff;
}

.chat-bubble a {
  color: var(--accent);
  text-decoration: underline;
}

.chat-message.user .chat-bubble a {
  color: #fff;
}

.chat-message.ai .chat-bubble {
  background-color: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.chat-input-area {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  padding: 0.9rem 1.25rem;
  border: none;
  background-color: var(--bg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  padding: 0 1.25rem;
  background-color: var(--accent);
  border: none;
  cursor: pointer;
  color: #fff;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
}

.chat-send:hover {
  background-color: var(--accent-light);
}

.chat-disclaimer {
  padding: 0.6rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background-color: var(--bg-alt);
}

/* Suggested questions */
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.chat-suggestion {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.55rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chat-suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.65rem 1rem;
  align-items: center;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: fit-content;
}

.chat-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: typing-dot 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%            { opacity: 1;   transform: translateY(-3px); }
}

/* ============================================================
   Chat modal
   ============================================================ */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chat-modal-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}

.chat-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 301;
  width: min(580px, calc(100vw - 2rem));
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-modal[aria-hidden="false"] {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

body.chat-modal-open {
  overflow: hidden;
}

.chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-alt);
  flex-shrink: 0;
}

.chat-modal-title {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.chat-modal .chat-messages {
  min-height: 280px;
  max-height: 380px;
}

/* ============================================================
   Floating chat widget (unused — kept for reference)
   ============================================================ */
.chat-fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.chat-fab:hover {
  background-color: var(--accent-light);
  transform: scale(1.05);
}

.chat-panel {
  position: fixed;
  bottom: 5.75rem;
  right: 1.75rem;
  z-index: 200;
  width: 360px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: bottom right;
}

.chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-alt);
}

.chat-panel-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}

.chat-close:hover {
  color: var(--text);
}

.chat-panel .chat-messages {
  min-height: 200px;
  max-height: 280px;
}

/* ============================================================
   Contact
   ============================================================ */
.section-contact {
  border-top: 1px solid var(--border);
}

.contact-body p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 60ch;
}

/* ============================================================
   Footer spacer
   ============================================================ */
.section-contact {
  padding-bottom: calc(var(--section-gap) + 2rem);
}

/* ============================================================
   Responsive — 768px breakpoint
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --section-gap: 3.75rem;
    --nav-h: 56px;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.75rem 0;
    display: none;
  }

  .nav-open .nav-links {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 0.75rem 2rem;
    border-radius: 0;
  }

  .nav-chat-link {
    border: none !important;
    border-top: 1px solid var(--border) !important;
    margin-top: 0.5rem;
    border-radius: 0 !important;
  }

  .hero-name {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
  }

  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .timeline-meta {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .tl-grid {
    grid-template-columns: 1fr;
  }

  .reading-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .cert-edu-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .chat-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
    bottom: 5.25rem;
  }
}

@media (max-width: 480px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding-inline: 1.25rem;
  }
}
