:root {
  --bg: #FBF6EF;
  --bg-alt: #F3E8DA;
  --surface: #FFFFFF;
  --text: #2E2620;
  --text-muted: #6B5F55;
  --accent: #B8674F;
  --accent-dark: #98503C;
  --accent-soft: #EFD9CC;
  --border: #E7D9C6;
  --shadow: 0 20px 40px -24px rgba(46, 38, 32, 0.25);
  --radius-lg: 20px;
  --radius-md: 14px;
  --container: 1120px;
  --font-heading: "Playfair Display", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
  color: var(--text);
}

p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 1000;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 246, 239, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.logo span { color: var(--accent); }

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 32px;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--accent);
}

.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 10px 20px;
  border-radius: 999px;
}
.nav-cta:hover { background: var(--accent-dark); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Hero */
.hero {
  padding: 96px 0 80px;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}

.eyebrow, .section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
}

.lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow .2s ease;
  cursor: pointer;
  min-height: 44px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-2px); }

.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.hero-media {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-blob {
  position: absolute;
  width: 340px;
  height: 340px;
  background: var(--accent-soft);
  border-radius: 42% 58% 65% 35% / 45% 40% 60% 55%;
  z-index: 0;
}

.hero-photo {
  position: relative;
  z-index: 1;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid var(--surface);
  box-shadow: var(--shadow);
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

/* Sections */
.section {
  padding: 88px 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  margin-bottom: 24px;
}
.section-text {
  color: var(--text-muted);
  max-width: 68ch;
  font-size: 1.05rem;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

.education-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.card-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
}
.education-card h3 { margin-bottom: 6px; }
.muted { color: var(--text-muted); margin: 0; }

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 40px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.timeline-date {
  font-weight: 700;
  color: var(--accent);
}
.timeline-location {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.timeline-content h3 { margin-bottom: 4px; }
.timeline-company {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.timeline-content ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.timeline-content li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
}
.timeline-content li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 24px;
  margin-top: 40px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.skill-card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-soft);
}
.skill-card ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-card li {
  font-size: 0.92rem;
  color: var(--text-muted);
  position: relative;
  padding-left: 16px;
}
.skill-card li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.soft-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.soft-skills span {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 999px;
}

/* Case studies */
.case-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-top: 32px;
}
.case-block:first-of-type {
  margin-top: 40px;
}
.case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.case-head h3 {
  margin: 0;
}
.case-tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.case-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.case-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text-muted);
}
.case-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.case-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.case-gallery figure {
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
.case-gallery img {
  width: 100%;
  aspect-ratio: 9 / 12;
  object-fit: cover;
  display: block;
}
.case-gallery figcaption {
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.mini-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 20px 0;
}
.mini-table-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
}
.mini-table-row:nth-child(even) {
  background: var(--bg-alt);
}
.mini-table-head {
  background: var(--accent) !important;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mini-table-row .down {
  color: var(--accent-dark);
  font-weight: 700;
}

/* Stats / case study */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 40px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  color: var(--accent);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-weight: 600;
  font-size: 0.95rem;
}
.stat-row small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Contact */
.contact-section {
  text-align: center;
}
.contact-inner {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 24px;
  margin-bottom: 0;
}
.contact-note a {
  color: var(--accent);
  font-weight: 600;
}

.contact-methods {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.contact-pill svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}
.contact-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.contact-form {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
  margin-top: 8px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.form-row input,
.form-row textarea {
  font: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  resize: vertical;
}
.form-row input:focus-visible,
.form-row textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.contact-form .btn {
  align-self: flex-start;
  border: none;
}

/* Footer */
.site-footer {
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.timeline .reveal:nth-child(2) { transition-delay: 0.1s; }

.skills-grid .reveal:nth-child(1) { transition-delay: 0s; }
.skills-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.skills-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.skills-grid .reveal:nth-child(4) { transition-delay: 0.24s; }

.stats-grid .reveal:nth-child(1) { transition-delay: 0s; }
.stats-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.stats-grid .reveal:nth-child(3) { transition-delay: 0.2s; }

/* Hero entrance */
.hero-anim {
  opacity: 0;
  animation: hero-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-anim-1 { animation-delay: 0.05s; }
.hero-anim-2 { animation-delay: 0.2s; }

@keyframes hero-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.hero-blob {
  animation: blob-float 7s ease-in-out infinite;
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(0, -14px) scale(1.03); }
}

.hero-photo {
  transition: transform 0.4s ease;
}
.hero-media:hover .hero-photo {
  transform: translateY(-4px);
}

/* Card hover lift */
.skill-card,
.stat-card,
.timeline-item,
.education-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.skill-card:hover,
.stat-card:hover,
.timeline-item:hover,
.education-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 28px 48px -24px rgba(46, 38, 32, 0.32);
}

.soft-skills span {
  transition: transform 0.2s ease, background 0.2s ease;
}
.soft-skills span:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

/* Nav underline */
.main-nav ul li a:not(.nav-cta) {
  position: relative;
}
.main-nav ul li a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.main-nav ul li a:not(.nav-cta):hover::after,
.main-nav ul li a:not(.nav-cta):focus-visible::after {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .hero-anim {
    opacity: 1;
    animation: none;
  }
  .hero-blob {
    animation: none;
  }
}

/* Chat widget */
.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 200;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.chat-toggle:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}
.chat-toggle svg {
  width: 26px;
  height: 26px;
}
.chat-icon-close { display: none; }
.chat-toggle.is-open .chat-icon-open { display: none; }
.chat-toggle.is-open .chat-icon-close { display: block; }

.chat-panel[hidden] {
  display: none;
}
.chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(360px, calc(100vw - 48px));
  height: min(480px, calc(100vh - 160px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--accent);
  color: #fff;
}
.chat-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
}
.chat-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  opacity: 0.85;
}
.chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.chat-close svg { width: 20px; height: 20px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-msg-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px;
}
.chat-msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chat-bounce 1.2s infinite ease-in-out;
}
.chat-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input-row input {
  flex: 1;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-height: 40px;
}
.chat-input-row input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chat-input-row button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.chat-input-row button:hover {
  background: var(--accent-dark);
}
.chat-input-row button svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .chat-widget { right: 16px; bottom: 76px; }
  .chat-panel {
    width: calc(100vw - 32px);
    height: min(70vh, 520px);
    bottom: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-msg-typing span { animation: none; }
}

/* Focus states */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Responsive */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .main-nav ul {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .main-nav ul.open { display: flex; }
  .nav-cta { align-self: flex-start; }
}

@media (max-width: 480px) {
  .hero { padding: 64px 0 56px; }
  .section { padding: 64px 0; }
  .hero-photo { width: 220px; height: 220px; }
  .hero-blob { width: 260px; height: 260px; }

  .case-block { padding: 24px 20px; }
  .case-gallery { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mini-table-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 4px;
  }
  .mini-table-row span:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
  }
}
