@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #eef3f5;
  --bg-soft: #f7fafb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #10202b;
  --ink-soft: #3f5463;
  --accent: #0d8aa8;
  --accent-strong: #0b6f87;
  --accent-soft: #d7eff4;
  --line: #d4e1e7;
  --success: #19795a;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 8px 20px rgba(16, 32, 43, 0.08);
  --shadow-md: 0 16px 40px rgba(16, 32, 43, 0.12);
  --max-width: 1120px;
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at 15% -5%, #d6f0f4 0, transparent 28%),
    radial-gradient(circle at 90% 8%, #dbe7ee 0, transparent 32%),
    linear-gradient(180deg, #f8fbfc 0%, var(--bg) 100%);
  min-height: 100vh;
}

a {
  color: inherit;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  border-bottom: 1px solid rgba(16, 32, 43, 0.08);
  background: rgba(248, 251, 252, 0.86);
  backdrop-filter: blur(10px);
}

.logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.logo img {
  display: block;
  width: auto;
  height: 30px;
  max-width: 100%;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
}

nav a {
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.85rem;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

nav a:hover,
nav a:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
  outline: none;
}

nav a.active {
  color: #ffffff;
  border-color: var(--accent-strong);
  background: linear-gradient(135deg, var(--accent) 0%, #0a6178 100%);
  box-shadow: var(--shadow-sm);
}

main {
  display: block;
}

.section {
  width: min(calc(100% - 2.5rem), var(--max-width));
  margin: 0 auto;
}

.hero {
  padding: clamp(3rem, 5vw, 5.5rem) 0 2.2rem;
}

.hero-kicker {
  display: inline-flex;
  margin: 0;
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #0b5d71;
  background: var(--accent-soft);
}

.hero h1 {
  margin: 1rem 0 0;
  max-width: 900px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4.8vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.02em;
}

.hero-lead {
  max-width: 760px;
  margin: 1.15rem 0 0;
  font-size: clamp(1rem, 2vw, 1.22rem);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.18rem;
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 700;
  transition: transform 180ms var(--easing), box-shadow 180ms var(--easing), border-color 160ms ease, background-color 160ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #0b8aa9 0%, #0b6f87 100%);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.btn-secondary:hover {
  background: #ffffff;
  border-color: #bfd0d8;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  padding-bottom: 1rem;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.05rem;
}

.metric-card h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.42rem;
  line-height: 1.1;
}

.metric-card p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.05rem, 2.2vw, 1.45rem);
}

.panel h2,
.panel h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.2rem, 2.1vw, 1.6rem);
  line-height: 1.2;
}

.panel p {
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
}

.bullet-list {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
}

.bullet-list li {
  margin: 0.5rem 0;
  color: #2f4554;
}

.section-head {
  margin: 2rem 0 1rem;
}

.section-head h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  line-height: 1.14;
}

.section-head p {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  max-width: 700px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.filter-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-soft);
  padding: 0.48rem 0.82rem;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms ease;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  color: var(--ink);
  border-color: #b5c9d3;
  outline: none;
}

.filter-btn.is-active {
  color: #ffffff;
  border-color: var(--accent-strong);
  background: linear-gradient(140deg, var(--accent) 0%, #0f6a82 100%);
}

.experience-grid,
.portfolio-grid,
.white-paper-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.95rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.experience-card,
.case-card,
.paper-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}

.experience-track,
.card-kicker,
.paper-kicker {
  display: inline-flex;
  margin: 0;
  padding: 0.26rem 0.62rem;
  border-radius: 999px;
  border: 1px solid #c6dae2;
  background: #f7fcff;
  color: #0f6176;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 700;
}

.experience-card h3,
.case-card h3,
.paper-card h3 {
  margin: 0.62rem 0 0;
  font-size: 1.06rem;
  line-height: 1.28;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.experience-card p,
.case-card p,
.paper-card p {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.experience-card p strong,
.case-card p strong,
.paper-card p strong {
  color: #1a2f3e;
}

.case-block {
  margin-top: 0.66rem;
}

.case-block h4 {
  margin: 0;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #315466;
}

.case-block p {
  margin: 0.34rem 0 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #c6d9e1;
  background: #f8fcff;
  color: #2d4c5d;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.23rem 0.57rem;
}

.result-callout {
  margin-top: 0.75rem;
  border-left: 3px solid var(--accent);
  background: #f3fafc;
  padding: 0.56rem 0.62rem;
  border-radius: 0 10px 10px 0;
  color: #20485b;
  font-size: 0.9rem;
}

.card-link-row {
  margin-top: 0.9rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: none;
  background: transparent;
  padding: 0;
  text-decoration: none;
  color: #0d6f87;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
}

.text-link::after {
  content: "\2192";
}

.text-link:hover,
.text-link:focus-visible {
  color: #095d73;
  text-decoration: underline;
  outline: none;
}

body.modal-open {
  overflow: hidden;
}

.portfolio-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.portfolio-modal[hidden] {
  display: none;
}

.portfolio-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 26, 34, 0.58);
  backdrop-filter: blur(2px);
}

.portfolio-modal-dialog {
  position: relative;
  width: min(860px, calc(100% - 0.6rem));
  max-height: min(88vh, 980px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  padding: 1rem 1.05rem 1.2rem;
}

.portfolio-modal-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.portfolio-modal-head .paper-kicker {
  margin-right: auto;
}

.portfolio-modal-close {
  border: 1px solid #c4d7df;
  border-radius: 999px;
  background: #f3fafc;
  color: #2f4b59;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.portfolio-modal-close:hover,
.portfolio-modal-close:focus-visible {
  background: #e7f4f8;
  border-color: #9fc7d4;
  outline: none;
}

.portfolio-modal-dialog h3 {
  margin: 0.8rem 0 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  line-height: 1.2;
}

.portfolio-modal-body p {
  margin: 0.72rem 0 0;
}

.portfolio-modal-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.profile-layout,
.contact-layout {
  width: min(calc(100% - 2.5rem), var(--max-width));
  margin: 0 auto;
  padding: clamp(2.4rem, 4.2vw, 4rem) 0 2.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.contact-layout--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
}

.paper-layout {
  width: min(calc(100% - 2.5rem), var(--max-width));
  margin: 0 auto;
  padding: clamp(2.3rem, 4vw, 4rem) 0 2.5rem;
}

.paper-article {
  max-width: 920px;
  margin: 0 auto;
}

.paper-article h1 {
  margin: 0.7rem 0 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.85rem, 3.5vw, 2.65rem);
  line-height: 1.12;
}

.paper-meta-grid {
  margin-top: 1.15rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.paper-meta-grid > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfd;
  padding: 0.8rem;
}

.paper-meta-grid h2 {
  margin: 0;
  font-size: 0.95rem;
}

.paper-meta-grid p {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
}

.paper-section {
  margin-top: 1.2rem;
}

.paper-section h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.2rem;
}

.paper-section p {
  margin-top: 0.55rem;
  color: var(--ink-soft);
}

.paper-toolbar {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.paper-download-note {
  margin: 0;
  font-size: 0.86rem;
  color: #4c6676;
}

.paper-nav {
  margin-top: 1.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.profile-layout h1,
.contact-layout h1 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.9rem, 3.8vw, 2.7rem);
  line-height: 1.12;
}

.profile-layout h2,
.contact-layout h2 {
  margin: 1rem 0 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.3rem;
}

.profile-layout p,
.contact-layout p {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
}

.contact-layout form {
  margin-top: 1rem;
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.34rem;
}

.field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #2a4251;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #c4d5de;
  border-radius: 12px;
  padding: 0.72rem 0.82rem;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(13, 138, 168, 0.2);
  outline-offset: 1px;
  border-color: #7abed0;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.form-status {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success);
}

.form-error {
  color: #9c3040;
}

.form-error a {
  text-decoration: underline;
}

.error-hero {
  padding-bottom: 1.4rem;
}

.error-path {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c0d6df;
  border-radius: 999px;
  background: #f7fcff;
  color: #214658;
  font-size: 0.93rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
}

.error-panel {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.error-beaker-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 24px;
  border: 1px solid #bdd7e0;
  background: radial-gradient(circle at 20% 20%, #e1f5fa 0, #f8fcfd 52%, #edf5f8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.error-beaker-wrap::before,
.error-beaker-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(13, 138, 168, 0.3);
}

.error-beaker-wrap::before {
  width: 13px;
  height: 13px;
  top: 12px;
  right: 16px;
}

.error-beaker-wrap::after {
  width: 8px;
  height: 8px;
  top: 28px;
  right: 38px;
}

.error-beaker-wrap img {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

footer {
  width: min(calc(100% - 2.5rem), var(--max-width));
  margin: 0 auto;
  padding: 2rem 0 2.6rem;
  color: #557080;
  font-size: 0.86rem;
}

[data-reveal],
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 520ms var(--easing), transform 520ms var(--easing);
}

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

#lab-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  z-index: 90;
}

#lab-beaker-btn {
  width: 66px;
  height: 66px;
  border: none;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(150deg, #0d8aa8 0%, #095e74 100%);
  box-shadow: 0 14px 30px rgba(5, 67, 84, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#lab-beaker-btn img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

#lab-chat-window {
  width: 360px;
  max-width: calc(100vw - 1rem);
  border: 1px solid #c4d5de;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#lab-chat-window.hidden {
  display: none;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem;
  border-bottom: 1px solid #d7e3e9;
  background: #f2f9fc;
}

.chat-header img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.chat-header span {
  font-size: 0.88rem;
}

#lab-close-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #425969;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.chat-log {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
  background: #fbfdfe;
}

.user-message,
.bot-message {
  border-radius: 10px;
  padding: 0.55rem 0.62rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.user-message {
  margin-left: auto;
  max-width: 85%;
  background: #e2f2f7;
  border: 1px solid #c0dde7;
}

.bot-message {
  margin-right: auto;
  max-width: 92%;
  background: #f0f4f6;
  border: 1px solid #d6e1e6;
}

.bot-message.bot-mode-grounded {
  background: #eef7fb;
  border-color: #bfdcea;
}

.bot-message.bot-mode-clarify {
  background: #f7fbfd;
  border-color: #cfdee5;
}

.bot-message.bot-mode-fallback {
  background: #f6f8f9;
  border-color: #d7e0e4;
}

.bot-message.bot-mode-johnny5 {
  background: #e7f7fb;
  border-color: #9ed2e0;
}

.bot-suggestions {
  margin: 0.35rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bot-suggestion-btn {
  border: 1px solid #bdd4de;
  border-radius: 999px;
  background: #ffffff;
  color: #244759;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.32rem 0.62rem;
  cursor: pointer;
}

.bot-suggestion-btn:hover,
.bot-suggestion-btn:focus-visible {
  border-color: #88bbcc;
  color: #153f52;
  background: #f4fbfe;
  outline: none;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #d7e3e9;
  background: #ffffff;
}

#lab-chat-input {
  flex: 1;
  border: 1px solid #c6d8e0;
  border-radius: 10px;
  padding: 0.55rem 0.62rem;
  font: inherit;
  font-size: 0.88rem;
}

#lab-chat-input:focus {
  outline: 2px solid rgba(13, 138, 168, 0.2);
  border-color: #79bdcf;
}

#lab-send-btn {
  border: none;
  border-radius: 10px;
  padding: 0.52rem 0.82rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(140deg, #0d8aa8 0%, #0b6f87 100%);
  cursor: pointer;
}

#lab-send-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .split-grid,
  .experience-grid,
  .portfolio-grid,
  .white-paper-grid,
  .profile-layout,
  .contact-layout,
  .paper-meta-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    padding-top: 2.5rem;
  }

  #lab-chat-root {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 680px) {
  header {
    padding: 0.8rem;
    align-items: flex-start;
  }

  .logo {
    flex: 0 0 auto;
  }

  .logo img {
    height: 26px;
  }

  nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
  }

  nav a {
    font-size: 0.84rem;
    padding: 0.4rem 0.62rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .section,
  .profile-layout,
  .contact-layout,
  .paper-layout,
  footer {
    width: min(calc(100% - 1.35rem), var(--max-width));
  }

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

  .white-paper-list {
    grid-template-columns: 1fr;
  }

  .paper-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .portfolio-modal {
    padding: 0.7rem;
  }

  .portfolio-modal-dialog {
    width: min(100%, calc(100vw - 0.4rem));
    max-height: calc(100vh - 1rem);
    border-radius: 16px;
  }

  .error-panel {
    grid-template-columns: 1fr;
  }

  .error-beaker-wrap {
    width: 98px;
    height: 98px;
  }

  .error-beaker-wrap img {
    width: 64px;
    height: 64px;
  }

  #lab-chat-window {
    width: min(340px, calc(100vw - 0.8rem));
  }

  #lab-beaker-btn {
    width: 58px;
    height: 58px;
  }

  #lab-beaker-btn img {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
