/**
 * RO SACHY LTD - Global Styles
 * Reset, typography, shared components
 */

/* ============================================================
   CSS RESET & BASE STYLES
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-base);
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition-base);
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: var(--space-xs) var(--space-sm);
  transition: border-color var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-secondary);
}

/* Focus Visible Styles for Keyboard Navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

h1 {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-4xl);
}

h3 {
  font-size: var(--text-3xl);
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.text-light {
  color: var(--color-text-light);
}

.text-white {
  color: var(--color-white);
}

.text-center {
  text-align: center;
}

.text-large {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* ============================================================
   CONTAINER & LAYOUT UTILITIES
   ============================================================ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
  width: 100%;
}

.section {
  padding: var(--space-xl) 0;
  overflow-x: hidden;
}

.section-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-white);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6 {
  color: var(--color-white);
}

.section-light {
  background-color: var(--color-white);
}

.section-accent {
  background-color: var(--color-accent);
  color: var(--color-white);
}

/* ============================================================
   CTA BANNER
   ============================================================ */
.cta-banner {
  background-color: var(--color-bg-dark);
  padding: var(--space-xl) 0;
  text-align: center;
}

.cta-banner h2 {
  color: var(--color-white);
  margin-bottom: var(--space-md);
  font-size: var(--text-4xl);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-align: center;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--color-secondary);
  color: var(--color-primary);
  border-color: var(--color-secondary);
}

.btn-primary:hover {
  background-color: #D4B55E;
  border-color: #D4B55E;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline-white {
  background-color: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}

.btn-outline-white:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline-primary:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background-color: var(--color-white);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: var(--space-md);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-secondary);
}

.card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-sm);
  color: var(--color-secondary);
  stroke-width: 1.5;
}

.service-icon svg {
  width: 56px;
  height: 56px;
  stroke: var(--color-secondary);
  stroke-width: 1.5;
  margin-bottom: var(--space-sm);
}

.card-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
}

.card-description {
  font-size: var(--text-base);
  color: var(--color-text-light);
  line-height: var(--leading-relaxed);
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.section-tag {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

.section-title {
  font-size: var(--text-4xl);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-light);
  max-width: 700px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

/* ============================================================
   LINKS
   ============================================================ */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-secondary);
  font-weight: var(--weight-medium);
  transition: gap var(--transition-base);
}

.link-arrow:hover {
  gap: 0.75rem;
}

.link-arrow::after {
  content: '→';
  font-size: 1.2em;
}

/* ============================================================
   GRID SYSTEMS
   ============================================================ */
.grid {
  display: grid;
  gap: var(--space-md);
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ============================================================
   ANIMATIONS (classes applied by animations.js)
   ============================================================ */

/* Shared timing */
.fade-in,
.fade-in-left,
.fade-in-right,
.scale-in {
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Fade up */
.fade-in {
  opacity: 0;
  transform: translateY(50px);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade from left */
.fade-in-left {
  opacity: 0;
  transform: translateX(-60px);
}
.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Fade from right */
.fade-in-right {
  opacity: 0;
  transform: translateX(60px);
}
.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up */
.scale-in {
  opacity: 0;
  transform: scale(0.88) translateY(16px);
}
.scale-in.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ============================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================ */
@media (max-width: 767px) {
  html,
  body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .container {
    padding: 0 1rem;
    max-width: 100%;
  }

  .section {
    max-width: 100vw;
  }

  h1 {
    font-size: var(--text-4xl);
  }

  h2 {
    font-size: var(--text-3xl);
  }

  h3 {
    font-size: var(--text-2xl);
  }

  .section-title {
    font-size: var(--text-3xl);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   REDUCED MOTION SUPPORT (Accessibility)
   ============================================================ */
@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;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  /* Hide non-essential elements */
  .nav,
  .nav-toggle,
  .nav-overlay,
  .footer,
  .modal,
  .btn,
  button,
  .cta-banner {
    display: none !important;
  }

  /* Optimize for print */
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Ensure proper page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  /* Show link URLs */
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Don't show internal anchor links */
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }

  .container {
    max-width: 100%;
    padding: 0;
  }
}

/* ============================================================
   SKIP LINK (Accessibility)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-white);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}
