/* Modern CSS for Dr. Jay Gattis Website
 * Preserves exact visual appearance while using modern layout techniques
 */

/* CSS Variables for easy maintenance */
:root {
  --color-beige: #e2d59b;
  --color-beige-light: #eedd98;
  --color-dark-brown: #444422;
  --color-navy: #0c2c45;
  --color-menu-bg: #555555;
  --color-menu-border: #000000;
  --color-menu-lite: #FFFFFF;
  --color-menu-hilite: #E1D59B;
  --container-width: 770px;
  --sidebar-width: 30%;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  background-color: var(--color-beige); /* Use solid color instead of missing bg.gif */
  margin: 0;
  padding: 0;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-navy);
  color: var(--color-beige-light);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10001;
  font-weight: bold;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-beige-light);
  outline-offset: 2px;
}

/* Focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
area:focus {
  outline: 3px solid var(--color-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Focus indicator for image map areas */
area:focus {
  outline: 3px solid var(--color-navy);
  outline-offset: 2px;
}

/* Focus indicator for dropdown menu items */
.dropdown-menu a:focus {
  outline: 2px solid var(--color-beige-light);
  outline-offset: -2px;
  background-color: var(--color-menu-hilite);
  color: var(--color-dark-brown);
}

/* Site container - replaces table with width="770" */
.site-container {
  max-width: var(--container-width);
  width: 100%;
  margin: 0 auto;
  background-color: var(--color-beige);
  /* Smooth scaling for smaller windows */
  transition: max-width 0.3s ease;
}

/* Header - replaces first table row */
.site-header {
  width: 100%;
  overflow: hidden; /* Prevent horizontal scroll */
}

.site-header picture,
.site-header img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  max-width: 100%; /* Ensure it never exceeds container */
  /* Optimize image rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* Prevent layout shift with explicit dimensions */
  aspect-ratio: 770 / 242;
}

.site-header picture img {
  width: 100%;
  height: auto;
}

/* Content area - replaces nested table structure */
.site-content {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  background-color: var(--color-beige-light);
  min-height: 400px; /* Ensure minimum height */
  gap: 0; /* No gap to match original table layout */
}

/* Left sidebar - replaces td width="30%" */
.sidebar-left {
  background-color: var(--color-navy);
  padding: 5px;
  min-width: 0; /* Allow sidebar to shrink */
}

.sidebar-left picture,
.sidebar-left img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.sidebar-left picture img {
  width: 100%;
  height: auto;
}

/* Main content area - replaces td rowspan="2" */
.main-content {
  padding: 15px;
  min-width: 0; /* Prevent grid overflow */
  overflow-wrap: break-word; /* Handle long words */
  font-size: 16px; /* Increased from default 12px for better readability */
  line-height: 1.6; /* Better line spacing for readability */
}

.content-wrapper {
  width: 100%;
  max-width: 100%;
  font-size: 16px; /* Ensure content wrapper has larger font */
  line-height: 1.6;
}

/* Override small text sizes in main content for better readability */
.content-wrapper .text,
.content-wrapper p.text,
.content-wrapper ul.text {
  font-size: 16px !important; /* Override stylesheet.css 12px */
  line-height: 1.6;
  color: #333322 !important; /* Dark color for better contrast against beige background */
}

/* Ensure list items inside .text have proper color */
.content-wrapper ul.text li {
  color: #333322 !important;
}

/* Heading styles with better contrast */
.content-wrapper h1,
.content-wrapper .heading {
  font-size: 20px !important; /* Slightly larger headings */
  line-height: 1.4;
  color: #222211 !important; /* Darker color for better contrast against beige background */
  font-weight: bold !important;
  letter-spacing: 0.02em !important; /* Normal letter spacing for better readability */
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.content-wrapper h2,
.content-wrapper .subheading {
  font-size: 18px !important; /* Larger subheadings */
  line-height: 1.4;
  color: #333322 !important; /* Darker color for better contrast */
  font-weight: bold !important;
  letter-spacing: 0.01em !important; /* Normal letter spacing for better readability */
  margin-top: 0.75em;
  margin-bottom: 0.5em;
}

.content-wrapper h3 {
  font-size: 16px !important;
  line-height: 1.4;
  color: #333322 !important; /* Darker color for better contrast */
  font-weight: bold !important;
  letter-spacing: 0.01em !important; /* Normal letter spacing */
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.content-wrapper h4 {
  font-size: 15px !important;
  line-height: 1.4;
  color: #333322 !important; /* Dark color for better contrast against beige background */
  font-weight: bold !important;
  letter-spacing: 0.01em !important; /* Normal letter spacing */
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Sidebar navigation - preserves original sidebar styling */
.sidebar-nav {
  padding: 5px;
  font-size: 14px; /* Increased from default 12px for better readability */
}

.sidebar-nav a {
  font-size: 14px; /* Ensure links are readable */
}

.sidebar-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: normal;
}

.sidebar-nav li {
  margin: 0;
  padding: 0;
}

.sidebar-nav li ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-nav li li {
  padding: 6px 0 6px 10px;
  background: url(images/img08.gif) no-repeat 0 12px;
  border-bottom: 1px solid var(--color-beige);
}

.sidebar-nav li li a {
  text-decoration: none;
  color: var(--color-beige);
}

.sidebar-nav li li a:hover {
  color: var(--color-beige);
}

.sidebar-nav li h2 {
  padding-top: 20px;
  color: var(--color-beige);
  font-size: 16px; /* Larger headings in sidebar */
}

.sidebar-nav li h2 a {
  color: var(--color-beige);
  text-decoration: none;
}

/* Dropdown menus - modern replacement for mm_menu.js */
.dropdown-menu {
  position: fixed; /* Changed from absolute to fixed for better positioning */
  visibility: hidden;
  opacity: 0;
  background-color: var(--color-menu-bg);
  border: 1px solid var(--color-menu-border);
  min-width: 129px;
  z-index: 10000; /* Increased z-index to ensure menus appear above everything */
  transition: opacity 0.2s, visibility 0.2s;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
  pointer-events: none; /* Prevent interaction when hidden */
}

.dropdown-menu.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto; /* Enable interaction when visible */
}

.dropdown-menu a {
  display: block;
  padding: 10px;
  color: var(--color-beige-light);
  text-decoration: none;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  border-bottom: 1px solid var(--color-menu-border);
  background-color: var(--color-menu-bg);
  outline: none; /* Remove default outline, we add custom one */
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
  background-color: var(--color-menu-hilite);
  color: var(--color-dark-brown);
}

.dropdown-menu a:last-child {
  border-bottom: none;
}

/* Responsive design - adapts smoothly to different window sizes */

/* Large screens (desktop) - scale up from original 770px layout */
@media (min-width: 771px) {
  .site-container {
    max-width: 1200px; /* Allow growth on larger screens */
    width: 90%; /* Use 90% of viewport width, up to max-width */
    min-width: var(--container-width); /* Never smaller than original */
  }
  
  .site-content {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  
  /* Scale header image proportionally on larger screens */
  .site-header img {
    width: 100%;
    height: auto;
  }
}

/* Extra large screens - maximize space usage */
@media (min-width: 1400px) {
  .site-container {
    max-width: 1400px;
    width: 85%;
  }
}

/* Medium screens (tablets in landscape, smaller desktops) */
@media (max-width: 770px) and (min-width: 601px) {
  .site-container {
    max-width: 100%;
    padding: 0 10px; /* Add small padding on sides */
  }
  
  .site-content {
    grid-template-columns: 25% 1fr; /* Slightly smaller sidebar */
  }
  
  .main-content {
    padding: 12px;
  }
  
  .sidebar-left {
    padding: 4px;
  }
}

/* Small tablets and large phones (portrait) */
@media (max-width: 600px) and (min-width: 481px) {
  .site-container {
    max-width: 100%;
    padding: 0 8px;
  }
  
  .site-content {
    grid-template-columns: 1fr; /* Stack vertically */
    grid-template-rows: auto 1fr;
  }
  
  .sidebar-left {
    grid-row: 1;
    display: flex;
    justify-content: center;
    padding: 10px;
    background-color: var(--color-navy);
  }
  
  .sidebar-left picture,
  .sidebar-left img {
    max-width: 200px; /* Limit sidebar image size */
    height: auto;
  }
  
  .sidebar-left picture img {
    max-width: 200px;
    height: auto;
  }
  
  .main-content {
    grid-row: 2;
    padding: 15px 10px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .site-container {
    max-width: 100%;
    padding: 0 5px;
  }
  
  .site-content {
    grid-template-columns: 1fr;
  }
  
  .sidebar-left {
    display: none; /* Hide sidebar on small mobile */
  }
  
  .main-content {
    padding: 12px 8px;
  }
  
  /* Improve text readability on mobile */
  .content-wrapper {
    font-size: 16px; /* Maintain readable size on mobile */
    line-height: 1.6;
  }
  
  .content-wrapper .text {
    font-size: 16px !important; /* Keep text readable on mobile */
  }
  
  .sidebar-nav {
    font-size: 14px; /* Keep sidebar readable on mobile */
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .main-content {
    padding: 10px 5px;
  }
  
  .content-wrapper {
    font-size: 15px; /* Slightly smaller but still readable on very small screens */
  }
  
  .content-wrapper .text {
    font-size: 15px !important;
  }
}

/* Contact form - modern CSS replacement for table layout */
.contact-form {
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 97px 326px;
  gap: 3px;
  margin-bottom: 3px;
  align-items: start;
}

.form-label {
  padding: 3px;
  width: 97px;
}

.form-label.text,
.form-label .text {
  display: block;
}

.form-input {
  padding: 3px;
  width: 326px;
}

.form-row-top .form-label {
  align-self: start;
  padding-top: 3px;
}

.form-row-top .form-input {
  align-self: start;
}

/* Form inputs styling to match original */
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form select,
.contact-form textarea {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  color: var(--color-dark-brown);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"] {
  width: 100%;
  max-width: 326px;
}

.contact-form select {
  width: 100%;
  max-width: 326px;
}

.contact-form textarea {
  width: 100%;
  max-width: 326px;
  resize: vertical;
}

.contact-form input[type="submit"] {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
}

/* Responsive form layout */
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .form-label {
    width: 100%;
    padding: 0;
  }
  
  .form-input {
    width: 100%;
    padding: 0;
  }
  
  .contact-form input[type="text"],
  .contact-form input[type="email"],
  .contact-form input[type="tel"],
  .contact-form select,
  .contact-form textarea {
    max-width: 100%;
    width: 100%;
  }
}

/* Ensure images and content scale properly on all sizes */
@media (max-width: 770px) {
  .site-header img {
    width: 100%;
    height: auto;
  }
  
  /* Make dropdown menus responsive */
  .dropdown-menu {
    max-width: calc(100vw - 20px);
    min-width: 150px;
  }
}

