html {
  text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  position: relative;
}

:root {
  --vh-full: 100vh;
  --vh-small: 100svh;
  --vh-large: 100lvh;
  --vh-dynamic: 100dvh;
}

@supports (height: 100dvh) {
  :root {
    --vh-full: 100dvh;
  }
}

.hero-title,
.section-title,
.btn,
.card,
.nav-drawer,
.site-header {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }

  .scrollable,
  .nav-drawer,
  .modal {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

@supports (padding: max(0px)) {
  body {
    padding-left: max(env(safe-area-inset-left), 0px);
    padding-right: max(env(safe-area-inset-right), 0px);
    padding-top: max(env(safe-area-inset-top), 0px);
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
  }
}

.site-header {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-top: max(0.5rem, env(safe-area-inset-top));
}

.nav-drawer {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.ts-footer {
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.sticky-header,
.fixed-cta,
.floating-action {
  bottom: max(1rem, env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  a,
  button,
  [role='button'],
  input[type='button'],
  input[type='submit'],
  input[type='checkbox'],
  input[type='radio'],
  .btn,
  .nav-link {
    min-height: 48px;
    min-width: 48px;
    position: relative;
  }

  a::before,
  button::before,
  [role='button']::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    z-index: -1;
  }

  button,
  .btn,
  [role='button'] {
    touch-action: manipulation;
  }

  a {
    -webkit-touch-callout: none;
    touch-action: manipulation;
  }
}

@media (max-width: 768px) {
  body {
    text-size-adjust: 100%;
  }

  input[type='text'],
  input[type='email'],
  input[type='tel'],
  input[type='number'],
  input[type='search'],
  textarea,
  select {
    font-size: 16px;
    appearance: none;
  }

  body,
  .hero-title,
  .section-title,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizelegibility;
  }
}

@supports (height: 100dvh) {
  .hero-section,
  .full-screen-section {
    min-height: 100dvh;
  }
}

@supports not (height: 100dvh) {
  .hero-section,
  .full-screen-section {
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
}

html,
body {
  overflow-x: clip;
  max-width: 100vw;
  position: relative;
}

* {
  max-width: 100%;
}

img,
video,
iframe,
embed {
  max-width: 100%;
  height: auto;
}

img[loading='lazy'] {
  content-visibility: auto;
}

img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.video-container,
.embed-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.video-container iframe,
.video-container object,
.video-container embed,
.embed-container iframe,
.embed-container object,
.embed-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  :focus-visible {
    outline: 4px solid var(--tiller-color-emerald, #10b981);
    outline-offset: 4px;
    border-radius: 4px;
  }

  button:focus-visible,
  .btn:focus-visible {
    outline: 4px solid var(--tiller-color-gold, #c9a227);
    outline-offset: 4px;
    box-shadow: 0 0 0 8px rgb(201 162 39 / 20%);
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .site-header {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .hero-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.9375rem;
  }
}

@media (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: subpixel-antialiased;
  }

  .card,
  .btn,
  input,
  textarea {
    border-width: 0.5px;
  }
}

@media (max-width: 768px) {
  button:active,
  .btn:active,
  a.btn:active {
    transform: scale(0.97);
    opacity: 90%;
    transition:
      transform 0.1s ease,
      opacity 0.1s ease;
  }

  .card:active {
    transform: scale(0.99);
    transition: transform 0.15s ease;
  }
}

@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;
  }

  .hero-title,
  .section-title,
  .btn,
  .card,
  .nav-drawer,
  .site-header {
    will-change: auto;
    transform: none;
  }
}

@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  * {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    width: 100%;
    max-width: 100vw;
  }

  .full-bleed {
    width: 100vw;
    margin-left: calc(-1 * max(1rem, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(1rem, env(safe-area-inset-right)));
  }
}

.above-fold,
.hero-section,
.hero-title,
.hero-image {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

.below-fold,
.footer-section {
  content-visibility: auto;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

@media print {
  .nav-drawer,
  .site-header,
  .nav-toggle,
  .btn,
  .cta-section {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }

  a {
    text-decoration: underline;
    color: #000000 !important;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 10pt;
    color: #666666;
  }
}

@media (prefers-contrast: high) {
  body {
    background: #000000;
    color: #ffffff;
  }

  .btn {
    border: 2px solid currentcolor;
  }

  :focus-visible {
    outline-width: 4px;
    outline-offset: 4px;
  }
}

@media (prefers-reduced-data: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .hero-pattern,
  .bg-pattern {
    background-image: none !important;
  }
}

@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: max(16px, 1rem);
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 8px;
    appearance: none;
  }

  textarea {
    resize: vertical;
    min-height: 120px;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
  }
}

@media (max-width: 768px) {
  .btn {
    min-height: 48px;
    padding: 12px 24px;
    user-select: none;
    touch-action: manipulation;
    transition:
      transform 0.15s ease,
      background-color 0.15s ease;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .card-grid,
  .service-grid,
  .feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }

  .card {
    contain: layout style paint;
    content-visibility: auto;
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }
}

@media (max-width: 768px) {
  .hero-section {
    min-height: clamp(500px, 100vh, 800px);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
  }

  .hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    line-height: 1.5;
  }
}

@media (max-width: 768px) {
  .nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-100%);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-drawer.open {
    transform: translateX(0);
  }
}
