/* Production safety overrides loaded through the Cloudflare Link header. */

@font-face {
  font-family: "OpenDyslexicOverride";
  src: url("https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@latest/latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexicOverride";
  src: url("https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@latest/latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

main {
  width: 100%;
}

.page-shell,
.section-shell,
.project-card,
.detail-panel,
.contact-form-shell,
.profile-card,
.hero-portrait-card {
  overflow-wrap: anywhere;
}

.section-shell + .section-shell {
  margin-top: clamp(0.9rem, 2vw, 1.25rem);
}

.section-header-row {
  align-items: flex-start;
}

.section-header-row .project-links,
.section-header-row > .button {
  margin-top: 0.15rem;
}

.hero-copy,
.page-intro-copy,
.detail-copy,
.section-heading,
.project-card,
.detail-panel,
.contact-form-shell form {
  min-width: 0;
}

.hero-lead,
.project-summary,
.panel-copy,
.footer-copy,
.detail-copy p,
.detail-panel p {
  text-wrap: pretty;
}

.project-card {
  align-content: start;
  min-height: 100%;
}

.project-card h3,
.detail-panel h3,
.section-title {
  text-wrap: balance;
}

.project-card-top {
  align-items: flex-start;
}

.project-category,
.status-badge {
  line-height: 1.35;
}

.project-links {
  margin-top: auto;
  align-items: center;
}

.project-links .button,
.form-actions .button,
.hero-actions .button {
  white-space: nowrap;
}

.project-problem,
.project-details,
.detail-panel,
.timeline-item,
.plain-block {
  min-width: 0;
}

.pill-list,
.detail-list {
  align-items: flex-start;
}

.pill-list li,
.detail-list li {
  line-height: 1.35;
}

body[data-page="project-detail"] .project-detail-shell {
  display: grid;
  gap: clamp(1rem, 2vw, 1.35rem);
}

body[data-page="project-detail"] .page-shell,
body[data-page="project-detail"] .section-shell {
  margin-block: 0;
}

body[data-page="project-detail"] .detail-hero {
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
}

body[data-page="project-detail"] .detail-copy,
body[data-page="project-detail"] .detail-visual,
body[data-page="project-detail"] .diagram-stage,
body[data-page="project-detail"] .detail-panel {
  min-width: 0;
}

body[data-page="project-detail"] .detail-copy,
body[data-page="project-detail"] .detail-visual {
  align-self: start;
}

body[data-page="project-detail"] .detail-layout {
  display: grid;
  gap: clamp(0.85rem, 2vw, 1.1rem);
}

body[data-page="project-detail"] .detail-grid {
  align-items: stretch;
  gap: clamp(0.85rem, 2vw, 1rem);
}

body[data-page="project-detail"] .detail-panel {
  height: auto;
  min-height: 0;
  align-content: start;
}

body[data-page="project-detail"] .story-list {
  display: grid;
  gap: 0.75rem;
}

.line-following-page {
  --line-card-gap: clamp(0.95rem, 2vw, 1.15rem);
}

.line-following-page .section-shell,
.line-following-page .page-shell {
  box-sizing: border-box;
}

.line-following-page .line-hero {
  min-height: 0 !important;
  padding-block: clamp(1.75rem, 3vw, 2.4rem) !important;
}

.line-following-page .line-hero .detail-copy {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding-block: 0 !important;
}

.line-following-page .line-hero .detail-copy > * {
  margin-bottom: 0;
}

.line-following-page .line-hero .detail-actions {
  margin-top: 0.25rem;
}

.line-following-page .line-hero .detail-visual {
  align-self: start;
}

.line-following-page .line-detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--line-card-gap);
  align-items: stretch;
}

.line-following-page .line-detail-layout > .detail-panel:nth-child(1),
.line-following-page .line-detail-layout > .detail-panel:nth-child(2) {
  min-height: 13.5rem;
}

.line-following-page .line-detail-layout > .detail-panel:nth-child(n + 3) {
  min-height: 11rem;
}

.line-following-page .detail-panel p:last-child,
.line-following-page .detail-panel ul:last-child {
  margin-bottom: 0;
}

.line-following-page .detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.line-following-page .detail-list li {
  width: fit-content;
  max-width: 100%;
  padding: 0.42rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.07);
  line-height: 1.25;
}

.line-following-page .evidence-section {
  display: grid;
  gap: 1rem;
}

.line-following-page .evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0;
  align-items: center;
}

.line-following-page .evidence-links .button {
  width: auto;
  white-space: nowrap;
}

.line-following-visual {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  width: 100%;
}

.webots-real-media-card {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.webots-video-card {
  position: relative;
  max-width: 34rem;
  justify-self: center;
  width: 100%;
  padding: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 22px;
  background:
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.12), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.08), transparent 34%),
    rgba(15, 23, 42, 0.24);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.webots-video-card::before {
  content: "Webots simulation";
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.5rem;
  padding: 0.26rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  color: var(--text-secondary, #64748b);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.webots-real-media-card img,
.webots-real-media-card video {
  display: block;
  width: min(100%, 31rem);
  margin-inline: auto;
  max-height: 17rem;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 15px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  background: rgba(15, 23, 42, 0.92);
}

.webots-video-card video {
  aspect-ratio: 16 / 9;
}

.webots-real-media-card figcaption {
  max-width: 31rem;
  margin-inline: auto;
  color: var(--text-secondary, #64748b);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.visual-video-link {
  justify-self: start;
  width: auto;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.05rem;
}

.metric-strip span {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
  padding: 0.72rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 15px;
  background: rgba(148, 163, 184, 0.08);
}

.metric-strip strong {
  font-size: clamp(0.92rem, 2vw, 1.08rem);
  line-height: 1.1;
}

.metric-strip small {
  color: var(--text-secondary, #64748b);
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

html.readable-mode,
html.readable-mode body {
  letter-spacing: 0.012em;
  word-spacing: 0.05em;
  line-height: 1.85;
}

html.readable-mode body,
html.readable-mode button,
html.readable-mode input,
html.readable-mode textarea,
html.readable-mode select,
html.readable-mode h1,
html.readable-mode h2,
html.readable-mode h3,
html.readable-mode h4,
html.readable-mode h5,
html.readable-mode h6,
html.readable-mode p,
html.readable-mode li,
html.readable-mode a,
html.readable-mode span,
html.readable-mode label,
html.readable-mode .button,
html.readable-mode .control-button,
html.readable-mode .project-toggle,
html.readable-mode .project-summary,
html.readable-mode .panel-copy,
html.readable-mode .hero-lead,
html.readable-mode .footer-copy {
  font-family: "OpenDyslexicOverride", "OpenDyslexic", "Comic Sans MS", "Trebuchet MS", sans-serif !important;
}

html.readable-mode p,
html.readable-mode li,
html.readable-mode .hero-lead,
html.readable-mode .project-summary,
html.readable-mode .panel-copy,
html.readable-mode .footer-copy {
  line-height: 1.9;
}

html.readable-mode .control-button[aria-pressed="true"],
html.readable-mode #readableToggle {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

html.readable-mode .project-card,
html.readable-mode .detail-panel,
html.readable-mode .contact-form-shell,
html.readable-mode .profile-card {
  gap: 0.9rem;
}

#projectsGrid.project-grid {
  grid-template-columns: 1fr;
  align-items: start;
  gap: clamp(1rem, 2vw, 1.45rem);
}

.project-ecosystem-section {
  display: grid;
  gap: 0.85rem;
  align-content: start;
  margin: 0;
}

.project-ecosystem-section + .project-ecosystem-section {
  margin-top: 0.6rem;
}

.project-ecosystem-heading {
  max-width: 58rem;
}

.project-grid-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

.project-grid-section .project-card {
  min-height: 100%;
  align-content: start;
}

.project-grid-section .project-links {
  margin-top: auto;
}

.contact-form-shell {
  align-self: start;
}

.field textarea {
  line-height: 1.6;
}

.form-note {
  margin: 0;
}

.footer-inner {
  gap: 1rem;
}

.footer-meta,
.footer-nav {
  min-width: 0;
}

@media (max-width: 900px) {
  .header-inner {
    gap: 0.75rem;
  }

  .brand-copy {
    min-width: 0;
  }

  .brand-role {
    max-width: 20ch;
  }

  .project-grid,
  .project-grid-section,
  .overview-grid,
  .detail-grid,
  .contact-grid,
  .split-layout,
  .hero-layout,
  .page-intro.has-lottie,
  .footer-inner {
    grid-template-columns: 1fr !important;
  }

  body[data-page="project-detail"] .detail-hero,
  body[data-page="project-detail"] .detail-grid,
  .line-following-page .line-detail-layout {
    grid-template-columns: 1fr !important;
  }

  .line-following-page .line-hero .detail-copy {
    gap: 0.8rem;
  }

  .page-lottie-wrap {
    max-width: 520px;
    justify-self: center;
  }
}

@media (max-width: 760px) {
  main {
    padding-inline: 0.85rem;
  }

  .site-header {
    padding-inline: 0.85rem;
  }

  .page-shell,
  .section-shell {
    border-radius: 16px;
  }

  body[data-page="project-detail"] .project-detail-shell {
    gap: 0.85rem;
  }

  body[data-page="project-detail"] .page-shell,
  body[data-page="project-detail"] .section-shell {
    padding: 1rem;
  }

  body[data-page="project-detail"] .detail-hero {
    gap: 1rem;
  }

  body[data-page="project-detail"] .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  body[data-page="project-detail"] .detail-actions .button,
  .line-following-page .evidence-links .button,
  .visual-video-link {
    width: 100%;
  }

  .line-following-page .line-detail-layout > .detail-panel {
    min-height: 0 !important;
  }

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

  .webots-video-card {
    max-width: 100%;
    padding: 0.55rem;
    border-radius: 18px;
  }

  .webots-real-media-card img,
  .webots-real-media-card video {
    width: 100%;
    max-height: 13.5rem;
    border-radius: 14px;
  }

  .webots-real-media-card figcaption {
    text-align: left;
    font-size: 0.78rem;
  }

  body[data-page="projects"] .section-shell {
    padding: 1rem;
  }

  body[data-page="projects"] .project-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: start;
  }

  body[data-page="projects"] .search-field {
    flex: 0 0 auto;
    width: 100%;
  }

  body[data-page="projects"] .search-field input {
    min-height: 3.2rem;
    font-size: 1rem;
  }

  body[data-page="projects"] .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    margin: 0;
  }

  body[data-page="projects"] .filter-chip {
    flex: 0 0 auto;
    min-height: 2.8rem;
  }

  body[data-page="projects"] #projectsGrid.project-grid {
    margin-top: 1rem;
    gap: 1.15rem;
  }

  body[data-page="projects"] .project-ecosystem-section {
    gap: 0.75rem;
  }

  body[data-page="projects"] .project-ecosystem-heading p {
    margin-bottom: 0;
  }

  .project-card,
  .detail-panel,
  .contact-form-shell,
  .profile-card {
    min-width: 0;
  }

  .project-links .button,
  .form-actions .button,
  .hero-actions .button {
    white-space: normal;
  }

  .hero-actions,
  .form-actions,
  .project-links {
    align-items: stretch;
  }

  .hero-actions .button,
  .form-actions .button {
    width: 100%;
  }

  .project-card .project-links .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .header-controls {
    gap: 0.35rem;
  }

  .control-button,
  .control-button-icon,
  #langToggle {
    width: 2.45rem;
    min-width: 2.45rem;
    height: 2.45rem;
    min-height: 2.45rem;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.1rem, 12vw, 2.85rem);
  }
}
