/* Progressive enhancements shared by the public site and administration. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
}
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, textarea, select { max-width: 100%; }
button, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea {
  -webkit-appearance: none;
  appearance: none;
}
.form-field input, .form-field select, .form-field textarea { font-size: 16px; }
.form-field input[type="file"] { font-size: 16px; overflow: hidden; }
.form-field input[type="file"]::-webkit-file-upload-button {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 5px 10px;
  margin-inline-end: 12px;
  font: inherit;
}
.form-field input, .form-field select, .form-field textarea {
  scroll-margin-top: 130px;
  scroll-margin-bottom: 32px;
}
.form-field input[type="checkbox"] { flex-shrink: 0; }
.checkbox-field label { padding-block: 8px; }
.brand { min-width: 0; }
.brand-symbol, .header-actions, .menu-toggle { flex-shrink: 0; }
.brand-name, .hero-copy, .hero-caption > span:last-child { min-width: 0; }
.brand-name strong, .brand-name small, .hero-copy, .section-copy,
.project-info, .service-detail-copy, .contact-strip h2, .control-row-text,
.lead-card, .content-card-body, .page-heading h1 {
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}
.about-grid > *, .safety-grid > *, .footer-grid > *, .contact-layout > *,
.project-detail-grid > *, .service-grid > *, .principles-grid > *,
.service-detail > *, .stats-grid > *, .control-columns > *, .email-layout > * { min-width: 0; }
.hero-photo, .hero-shade { z-index: 0; }
.hero-shade { z-index: 1; }
.hero-content { z-index: 2; }
.login-layout, .control-shell { min-height: 100vh; min-height: 100svh; }
.control-sidebar { height: 100vh; height: 100dvh; overflow-y: auto; }
.control-sidebar > * { flex-shrink: 0; }
.control-sidebar .brand { white-space: normal; }
.language-switch { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.menu-toggle { width: 44px; height: 44px; }
.hero-caption { align-items: flex-start; }
.caption-line { flex-shrink: 0; margin-top: .7em; }

/* Keyboard focus remains visible on browsers predating :focus-visible. */
@supports not selector(:focus-visible) {
  a:focus, button:focus, input:focus, textarea:focus, select:focus {
    outline: 3px solid #71a9ed;
    outline-offset: 4px;
  }
  .project-card:focus .project-view { opacity: 1; transform: none; }
}

/* Preserve image geometry on Safari versions without aspect-ratio. */
@supports not (aspect-ratio: 1 / 1) {
  .project-image { height: 0; padding-bottom: 69.93%; }
  .project-image img { position: absolute; top: 0; left: 0; }
  .project-detail-hero img { height: auto; }
  .project-image.missing-photo { height: auto; min-height: 240px; padding: 36px; }
  @media (min-width: 481px) and (max-width: 760px) {
    .projects-section .project-card:first-child .project-image { padding-bottom: 57.14%; }
    .projects-section .project-card:first-child .missing-photo { padding: 36px; }
  }
}

@media (max-width: 960px) {
  .site-header .brand { flex: 1 1 auto; }
  .header-actions { margin-inline-start: 0; }
  .header-inner { height: auto; min-height: 80px; padding-block: 12px; }
  .mobile-menu {
    max-height: calc(100vh - 110px);
    max-height: calc(var(--menu-viewport, 100vh) - var(--menu-top, 110px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  /* Navigation remains usable when JavaScript is disabled or fails to load. */
  .no-script-menu { max-height: none; }
}
@media (min-width: 961px) {
  .no-script-menu { display: none; }
}
@media (max-width: 760px) {
  .control-sidebar { height: auto; overflow: visible; }
}
@media (max-width: 480px) {
  .header-inner { min-height: 76px; }
  .header-actions { gap: 8px; }
  .brand { gap: 8px; }
  .brand-symbol { width: 32px; height: 38px; }
  .language-switch { min-width: 40px; }
  .hero-caption { max-width: 100%; }
}
@media (max-width: 359px) {
  .footer-grid { grid-template-columns: 1fr; }
  .hero-actions .button { width: 100%; }
  .hero h1 { font-size: 2.35rem; }
  .contact-form-panel { padding-inline: 16px; }
  .safety-points { grid-template-columns: 1fr; }
}
@media (hover: none), (pointer: coarse) {
  .project-view { opacity: 1; transform: none; }
  .project-card:hover img { transform: none; }
  .service-card > a, .control-sidebar-bottom a, .logout-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
