<?php
/*
Theme Name: Schedule Calculator Child Theme
Description: Enhanced WordPress child theme with mobile responsiveness, performance optimizations, and blog post mobile improvements. Includes comprehensive solutions for mobile-first design, page speed optimization, and advanced functionality.
Author: Your Name
Version: 1.0.0
Template: generatepress
Text Domain: schdcalc-child
Domain Path: /languages
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

This theme is a child theme of GeneratePress and includes:
- Mobile-first responsive design
- Performance optimizations
- Blog post mobile enhancements
- Advanced CSS and JavaScript optimizations
- Service Worker implementation
- Image optimization features
- Touch-friendly interactions
*/

/* Import parent theme styles */
@import url("../generatepress/style.css");

/* Enhanced Mobile Responsive Styles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-weight: 400;
  background-color: #ffffff;
  color: #333333;
  overflow-x: hidden;
}

/* Mobile-First Container System */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 576px) {
  .container { padding: 0 24px; }
}

@media (min-width: 768px) {
  .container { padding: 0 32px; }
}

@media (min-width: 1024px) {
  .container { padding: 0 40px; }
}

/* Enhanced Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}

.col {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
}

.col-12 { flex: 0 0 100%; }
.col-6 { flex: 0 0 50%; }
.col-4 { flex: 0 0 33.333333%; }
.col-3 { flex: 0 0 25%; }

@media (max-width: 767px) {
  .col-sm-12 { flex: 0 0 100%; }
  .col-sm-6 { flex: 0 0 50%; }
}

/* Enhanced Header Styles */
.site-header {
  position: relative;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 8px 16px;
}

@media (min-width: 768px) {
  .header-container {
    min-height: 80px;
    padding: 12px 32px;
  }
}

/* Logo Optimization */
.site-logo {
  flex-shrink: 0;
  max-width: 180px;
  height: auto;
}

.site-logo img {
  width: 100%;
  height: auto;
  max-height: 40px;
  object-fit: contain;
}

@media (min-width: 768px) {
  .site-logo img {
    max-height: 60px;
  }
}

/* Enhanced Mobile Navigation */
.main-navigation {
  position: relative;
}

.nav-toggle {
  display: block;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.nav-toggle:hover,
.nav-toggle:focus {
  background-color: rgba(0,0,0,0.05);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: #333;
  margin: 4px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

.nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-radius: 8px;
  margin: 8px 16px;
  padding: 16px 0;
  z-index: 999;
}

.nav-menu.active {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu li {
  border-bottom: 1px solid #f0f0f0;
}

.nav-menu li:last-child {
  border-bottom: none;
}

.nav-menu a {
  display: block;
  padding: 12px 24px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: all 0.3s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-menu a:hover,
.nav-menu a:focus {
  background-color: #f8f9fa;
  color: #007cba;
}

/* Desktop Navigation */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  
  .nav-menu {
    display: flex !important;
    position: static;
    background: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
    animation: none;
  }
  
  .nav-menu ul {
    display: flex;
    align-items: center;
  }
  
  .nav-menu li {
    border-bottom: none;
    margin: 0 8px;
  }
  
  .nav-menu a {
    padding: 8px 16px;
    border-radius: 4px;
    min-height: auto;
  }
}

/* Enhanced Content Areas */
.main-content {
  padding: 24px 0;
  min-height: calc(100vh - 200px);
}

@media (min-width: 768px) {
  .main-content {
    padding: 40px 0;
  }
}

/* Blog Post Enhancements */
.blog-post {
  margin-bottom: 32px;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-post:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.blog-post-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.blog-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.blog-post:hover .blog-post-image img {
  transform: scale(1.05);
}

.blog-post-content {
  padding: 20px;
}

@media (min-width: 768px) {
  .blog-post-content {
    padding: 32px;
  }
}

.blog-post-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 12px 0;
  color: #1a1a1a;
}

@media (min-width: 768px) {
  .blog-post-title {
    font-size: 1.5rem;
  }
}

.blog-post-excerpt {
  color: #666;
  line-height: 1.6;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

@media (min-width: 768px) {
  .blog-post-excerpt {
    font-size: 1rem;
  }
}

.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: #888;
  margin-bottom: 16px;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #007cba;
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  min-height: 44px;
  font-size: 0.95rem;
}

.read-more-btn:hover,
.read-more-btn:focus {
  background: #005a87;
  transform: translateY(-1px);
  color: #ffffff;
}

/* Mobile Blog Optimizations */
@media (max-width: 767px) {
  .blog-archive {
    padding: 12px 0;
  }
  
  .blog-post {
    margin-bottom: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.1);
  }
  
  .blog-post-image {
    aspect-ratio: 16/10;
    margin-bottom: 0;
  }
  
  .blog-post-content {
    padding: 16px;
  }
  
  .blog-post-title {
    font-size: 1.125rem;
    line-height: 1.4;
    margin-bottom: 8px;
  }
  
  .blog-post-excerpt {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .blog-post-meta {
    font-size: 0.8rem;
    gap: 12px;
    margin-bottom: 12px;
  }
  
  .read-more-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* Enhanced Forms */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  min-height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

button,
input[type="submit"],
input[type="button"] {
  background: #007cba;
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 44px;
  min-width: 44px;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
button:focus,
input[type="submit"]:focus,
input[type="button"]:focus {
  background: #005a87;
  transform: translateY(-1px);
}

/* Enhanced Footer */
.site-footer {
  background: #1a1a1a;
  color: #ffffff;
  padding: 40px 0 20px 0;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  gap: 32px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .footer-content {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
  }
}

.footer-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #ffffff;
}

.footer-section p,
.footer-section li {
  color: #cccccc;
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section a {
  color: #cccccc;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section a:hover,
.footer-section a:focus {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid #333;
  padding-top: 20px;
  text-align: center;
  color: #888;
  font-size: 0.875rem;
}

/* Accessibility Enhancements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 9999;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* Performance Optimizations */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Touch-friendly improvements */
@media (max-width: 767px) {
  /* Increase touch targets */
  a, button, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better spacing for touch */
  .blog-post-title a {
    display: block;
    padding: 4px 0;
  }
  
  /* Improved scrolling */
  .single-post-content {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Better text selection */
  .single-post-content {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #e0e0e0;
  }
  
  .site-header {
    background: #1f1f1f;
    border-bottom: 1px solid #333;
  }
  
  .blog-post {
    background: #1f1f1f;
    border: 1px solid #333;
  }
  
  .nav-menu {
    background: #1f1f1f;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  textarea,
  select {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .nav-toggle,
  .nav-menu,
  .site-footer {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}