/**
 * Modern WordWeb Software Website Styles
 * Responsive design with dark/light theme support
 * Updated: Fixed MIME type upload to CDN
 */

/* CSS Custom Properties for theming */
:root {
  /* Light theme colors */
  --color-primary: #1976d2;
  --color-primary-dark: #0d47a1;
  --color-primary-light: #42a5f5;
  --color-secondary: #37474f;
  --color-accent: #1565c0;

  /* Light theme backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-overlay: rgba(255, 255, 255, 0.95);

  /* Light theme text */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Borders and shadows */
  --border-color: #cbd5e1;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.2);

  /* Typography - optimized system font stack */
  --font-family-base:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 1rem;
  --line-height-base: 1.6;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 3rem;

  /* Breakpoints */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-base: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
}

/* Dark theme colors */
[data-theme="dark"] {
  --color-primary: #4f8cc9;
  --color-primary-dark: #1976d2;
  --color-primary-light: #64b5f6;
  --color-secondary: #1e293b;
  --color-accent: #42a5f5;

  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --bg-overlay: rgba(15, 23, 42, 0.95);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border-color: #334155;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.8);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition:
    background-color var(--transition-base),
    color var(--transition-base);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--spacing-md) 0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.25rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-primary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Layout components */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

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

/* Header and Navigation */
.header {
  background: var(--color-secondary);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color var(--transition-base);
}

.navbar {
  padding: var(--spacing-md) 0;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
}

.brand-logo {
  color: rgba(255, 255, 255, 0.95) !important;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.95) !important;
}

.brand-tagline {
  font-size: 0.875rem;
  opacity: 0.8;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8) !important;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.theme-toggle,
.mobile-menu-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  padding: var(--spacing-sm);
  border-radius: 50%;
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover,
.mobile-menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle:focus {
  outline: none;
}

.theme-icon {
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.9);
  transition: color var(--transition-fast);
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: var(--spacing-sm);
}

.hamburger {
  width: 20px;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.9);
  transition: var(--transition-fast);
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--spacing-lg);
  /* Prevent flash on load */
  transition: none;
}

.nav-menu li {
  margin: 0;
}

.nav-menu a {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.nav-menu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1) !important;
  text-decoration: none;
}

/* Mobile navigation */
@media (max-width: 767px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-secondary);
    flex-direction: column;
    gap: 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition:
      transform var(--transition-fast),
      opacity var(--transition-fast),
      visibility var(--transition-fast);
    z-index: 1000;
    /* Ensure menu is hidden on initial load */
    display: none;
  }

  .nav-menu.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-menu a {
    display: block;
    padding: var(--spacing-md);
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9) !important;
  }

  .brand-text {
    font-size: 1.25rem;
  }

  .brand-tagline {
    font-size: 0.75rem;
  }
}

/* Main content */
.main-content {
  min-height: calc(100vh - 200px);
}

/* Home page styles */
.home-products {
  padding: var(--spacing-xl) 0;
  background: var(--bg-secondary);
}

.products {
  display: grid;
  gap: var(--spacing-xl);
}

.row {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Single column for very wide content */
  .row.single {
    grid-template-columns: 1fr;
  }
}

/* Card styles */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
  border: 1px solid var(--border-color);
  /* Remove fixed max-width to allow flexible sizing */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-content {
  padding: var(--spacing-xl);
  text-align: center;
}

.card-content h5 {
  margin-bottom: var(--spacing-md);
}

.card-content h5 a {
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* Reference apps title should match other card titles */
.card.reference-apps .card-content h5 {
  color: var(--color-primary-dark);
  font-weight: 600;
}

.card-content .desc {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: var(--spacing-lg) 0;
}

.card-content img {
  max-width: 100%;
  height: auto;
  margin-bottom: var(--spacing-md);
  display: block;
}

/* Ensure main program icons are properly sized and visible */
.card-content .center a {
  display: inline-block;
  line-height: 0;
}

.card-content .center img {
  max-width: 128px;
  max-height: 128px;
  width: 128px;
  height: 128px;
  object-fit: contain;
  display: block;
}

.card-action {
  padding: var(--spacing-lg) var(--spacing-xl);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

/* Button styles */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  margin: var(--spacing-xs);
  background: var(--color-primary);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none !important;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  line-height: 1.5;
  min-width: 100px;
  text-align: center;
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none !important;
}

/* Home page button improvements */
.home-products .card-action {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-lg) var(--spacing-xl);
}

.home-products .card-action .btn {
  flex: 1;
  min-width: 115px;
  max-width: 145px;
  margin: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reference apps card - wider and centered when on second row */
@media (min-width: 768px) and (max-width: 1099px) {
  /* In 2-column layout, reference apps card spans both columns and centers */
  .home-products .card.reference-apps {
    grid-column: 1 / -1; /* Span both columns */
    max-width: 600px;
    margin: 0 auto;
    justify-self: center;
  }

  .home-products .card.reference-apps .card-action .btn {
    min-width: 120px;
    max-width: 150px;
  }
}

/* Larger screens - reference apps card can be wider when all 3 fit */
@media (min-width: 1100px) {
  .home-products .card.reference-apps .card-action .btn {
    min-width: 115px;
    max-width: 140px;
  }
}

/* Ensure buttons wrap nicely on smaller screens */
@media (max-width: 480px) {
  .home-products .card-action .btn {
    flex: 1 1 calc(50% - var(--spacing-xs));
    min-width: 90px;
    max-width: none;
  }
}

/* Page content styles */
.page {
  background: var(--bg-secondary);
  min-height: 600px;
  padding: var(--spacing-xl) 0;
}

.content {
  background: var(--bg-card);
  padding: var(--spacing-xl);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

/* Reduce content padding on narrow screens to save space */
@media (max-width: 480px) {
  .content {
    padding: var(--spacing-lg);
  }
}

@media (max-width: 360px) {
  .content {
    padding: var(--spacing-md);
  }
}

.content.article h3 {
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  font-size: 1.75rem;
}

.content.article h4 {
  font-size: 1.25rem;
  margin-top: var(--spacing-lg);
}

.content.article ul {
  list-style-type: disc;
  margin: 0 0 var(--spacing-md) var(--spacing-lg);
  padding-left: var(--spacing-md);
  text-align: left;
}

.content.article ul li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
  text-align: left;
}

/* Reduce bullet list indentation on narrow screens */
@media (max-width: 480px) {
  .content.article ul {
    margin-left: var(--spacing-md);
    padding-left: var(--spacing-sm);
  }
}

/* Further reduce on very narrow screens */
@media (max-width: 360px) {
  .content.article ul {
    margin-left: var(--spacing-sm);
    padding-left: var(--spacing-xs);
  }
}

blockquote {
  border-left: 4px solid var(--color-accent);
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-tertiary);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

/* Footer */
.footer {
  background: var(--color-secondary);
  padding: var(--spacing-xl) 0;
  margin-top: auto;
}

.footer-content {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

.footer-nav {
  margin-bottom: var(--spacing-md);
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.9) !important;
  margin: 0 var(--spacing-md);
  font-weight: 500;
}

.footer-nav a:hover {
  color: rgba(255, 255, 255, 1) !important;
}

.footer-copyright {
  font-size: 0.9rem;
  opacity: 0.8;
  color: rgba(255, 255, 255, 0.8);
}

/* Screenshots and media */
.screenshots {
  margin: var(--spacing-xl) 0;
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.screenshots .card {
  display: block;
  margin: 0;
}

.screenshots .card .card-image img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* iPad screenshots - wider layout */
.screenshots.ipad {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.screenshots.ipad .card .card-image img {
  max-width: 600px;
}

@media (min-width: 768px) {
  .screenshots.ipad {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet screenshots - larger than phone screenshots */
.screenshots.tablet {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.screenshots.tablet .card .card-image img {
  max-width: 500px;
  width: 100%;
}

@media (min-width: 768px) {
  .screenshots.tablet {
    grid-template-columns: repeat(2, 1fr);
  }

  .screenshots.tablet .card .card-image img {
    max-width: 600px;
  }
}

/* Modern grid layouts */
.row {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
  margin-bottom: var(--spacing-lg);
}

/* Products layout - basic setup, specific layouts handled by page-specific rules */
.products {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
}

/* Keep row structure for pages that need it, but make it flexible */
.products .row {
  display: contents;
}

/* Page-specific layout overrides */

/* Default: All .page .products use modern grid system */
@media (min-width: 670px) {
  .page .products {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(2, 1fr); /* Default to 2-column */
  }

  .page .products .row {
    display: contents;
  }

  /* Android, Mac index, and WordWeb iPhone all start 2-column at 670px */
  .page .products[data-layout="android-index"],
  .page .products[data-layout="mac-index"],
  .page .products[data-layout="wordweb-iphone"] {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Android Windows card spans both columns and is compact */
  .page .products[data-layout="android-index"] .row:last-child .card:last-child {
    grid-column: 1 / -1; /* Span both columns */
    max-width: 600px;
    margin: 0 auto;
    align-self: start;
  }

  /* Make the Android Windows card content compact */
  .page .products[data-layout="android-index"] .row:last-child .card:last-child .card-content {
    padding: var(--spacing-md) var(--spacing-xl);
    min-height: auto;
  }

  .page .products[data-layout="android-index"] .row:last-child .card:last-child .card-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

/* Large screens: 3-column for pages with many cards (but not Android/Mac index) */
@media (min-width: 992px) {
  .page .products {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Android, Mac index, and WordWeb iPhone: Keep 2-column even at very large sizes */
  .page .products[data-layout="android-index"],
  .page .products[data-layout="mac-index"],
  .page .products[data-layout="wordweb-iphone"] {
    grid-template-columns: repeat(2, 1fr); /* Force 2-column for these layouts */
  }
}

/* iPhone page specific styling - ensure proper 2-2 layout and compact Windows card */
@media (min-width: 670px) {
  /* iPhone page should use 2-column grid at medium sizes */
  .page .products:not([data-layout]) {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(2, 1fr);
  }

  .page .products:not([data-layout]) .row {
    display: contents;
  }

  /* Make the Windows versions card span both columns and be compact */
  .page .products:not([data-layout]) .row:last-child .card:last-child {
    grid-column: 1 / -1;
    max-width: 600px;
    margin: 0 auto;
    align-self: start;
  }

  /* Make the card content much more compact */
  .page .products:not([data-layout]) .row:last-child .card:last-child .card-content {
    padding: var(--spacing-md) var(--spacing-xl);
    min-height: auto;
  }

  /* Style the text to be more like a bottom panel */
  .page .products:not([data-layout]) .row:last-child .card:last-child .card-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

/* At larger sizes, iPhone page can use 3-column if needed */
@media (min-width: 992px) {
  .page .products:not([data-layout]) {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Compact layout for side-by-side cards */
.row.compact {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-md);
}

/* Two column layout */
.row.two-col {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* App showcase layout - icon with text beside */
.app-showcase {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.app-showcase .app-icon {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
}

.app-showcase .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-showcase .app-info {
  flex: 1;
  min-width: 0; /* Allow text to wrap properly */
}

.app-showcase .app-info h5 {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 1.1rem;
}

.app-showcase .app-info p {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
}

/* Make app-showcase stack vertically on narrow screens */
@media (max-width: 600px) {
  .app-showcase {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--spacing-md);
  }

  .app-showcase .app-info {
    text-align: center;
  }

  .app-showcase .app-info p {
    text-align: center;
  }
}

/* Fix text wrapping issues */
.card-content .desc {
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  hyphens: auto;
  word-wrap: break-word;
}

/* Home page specific layout adjustments - use modern grid system */

/* Override general products grid for home page */
.home-products .products {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
}

/* Small to medium screens - 2 cards per row */
@media (min-width: 768px) and (max-width: 1099px) {
  .home-products .products {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium-large screens - 3 cards per row */
@media (min-width: 1100px) {
  .home-products .products {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* Make row elements invisible to grid layout */
.home-products .products .row {
  display: contents;
}

/* Reference apps card - ensure icons fit properly and match other cards */
.card.reference-apps .card-content .center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: nowrap; /* Never wrap by default */
  /* Match height of other cards' icon areas */
  min-height: 128px;
  margin-bottom: var(--spacing-md);
}

.card.reference-apps .card-content .center img {
  flex-shrink: 0;
  /* Override general image rules for reference apps */
  margin-bottom: 0;
  max-width: 80px;
  max-height: 80px;
  width: auto;
  height: 80px;
  object-fit: contain;
  display: block;
}

/* Very small mobile screens - allow wrapping only when absolutely necessary */
@media (max-width: 480px) {
  .card.reference-apps .card-content .center {
    gap: var(--spacing-xs);
    flex-wrap: wrap;
  }

  .card.reference-apps .card-content .center img {
    max-width: 60px;
    max-height: 60px;
    height: 60px;
  }
}

/* Small to medium screens - smaller icons but no wrapping */
@media (min-width: 481px) and (max-width: 1199px) {
  .card.reference-apps .card-content .center {
    gap: var(--spacing-xs);
    flex-wrap: nowrap; /* Never wrap */
  }

  .card.reference-apps .card-content .center img {
    max-width: 65px;
    max-height: 65px;
    height: 65px;
  }
}

/* Large screens - full size icons with generous spacing */
@media (min-width: 1200px) {
  .card.reference-apps .card-content .center {
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
  }

  .card.reference-apps .card-content .center img {
    max-width: 80px;
    max-height: 80px;
    height: 80px;
  }
}

/* Wide card for content that needs more space */
.card.wide {
  max-width: 600px;
}

/* Full width card for notices */
.card.full-width {
  max-width: none;
  width: 100%;
}

/* Content cards should be full width for better readability */
.content.article .card {
  max-width: none;
  width: 100%;
}

/* Product cards in content areas should use responsive grid */
.content.article .products .card {
  max-width: 400px;
  width: 100%;
}

@media (min-width: 768px) {
  .content.article .products .card {
    max-width: none;
  }
}

/* Less prominent styling for Windows notices */
blockquote {
  opacity: 0.8;
}

/* Duplicate rule removed - already defined above */

/* Legacy column classes */
.col {
  display: block;
}

/* Center class compatibility */
.center {
  text-align: center;
}

/* Specific center layouts for icon containers only */
.card-content .center:not(p):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-md);
  min-height: 120px; /* Ensure consistent height for proper vertical centering */
}

/* Text elements with center class should just be centered text */
.card-content p.center,
.card-content h1.center,
.card-content h2.center,
.card-content h3.center,
.card-content h4.center,
.card-content h5.center,
.card-content h6.center {
  text-align: center;
  display: block;
}

/* For pages that need vertical centering */
.center.vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Valign wrapper compatibility */
.valign-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.valign {
  flex: 1;
}

/* Fix app icon and download button layout */
.row .col.m6 .card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
}

.row .col.m6 .card-content .col {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Specific fix for iPhone page layout - nested columns */
.content.article .row .col.m6 {
  display: block;
  text-align: center;
  padding: var(--spacing-lg);
}

.content.article .row .col.m6 h4 {
  margin-bottom: var(--spacing-md);
  text-align: center;
}

/* App icon and download button container */
.content.article .row .col.m6 .col.m3 {
  display: inline-block;
  vertical-align: middle;
  margin-right: var(--spacing-md);
}

.content.article .row .col.m6 .col.m8 {
  display: inline-block;
  vertical-align: middle;
}

.content.article .row .col.m6 .col.m3 img {
  display: block;
  margin: 0 auto;
}

.content.article .row .col.m6 .col.m8 img {
  display: block;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .content.article .row .col.m6 .col.m3,
  .content.article .row .col.m6 .col.m8 {
    display: block;
    margin: var(--spacing-sm) auto;
  }
}

/* App store button images */
.card-action img,
.col img[src*="app-store"],
.col img[src*="mac-app-store"],
.col img[src*="google-play"] {
  max-width: 150px;
  height: auto;
}

/* Google Play buttons in app-showcase layout should be smaller */
.app-showcase img[src*="google-play"] {
  max-width: 120px;
  height: auto;
}

/* Ensure download buttons are centered in bottom sections */
.card.cyan .card-content {
  text-align: center;
}

.card.cyan .card-content img {
  display: block;
  margin: 0 auto;
}

/* Reduce excessive vertical spacing on Mac index page cards */
.products .card .card-content {
  padding: var(--spacing-lg) var(--spacing-xl) var(--spacing-md) var(--spacing-xl);
}

.products .card .card-content .desc {
  margin: var(--spacing-sm) 0 var(--spacing-md) 0;
}

.products .card .card-action {
  padding: var(--spacing-md) var(--spacing-xl);
}

/* Single-card layouts (like Chambers.html, ChamThes.html) - more compact */
.products .row:only-child .card:only-child .card-content {
  padding: var(--spacing-md) var(--spacing-xl);
}

/* Single-card layouts with only icons and buttons - even more compact */
.products .row:only-child .card:only-child .card-content .center:first-child:last-child {
  margin-bottom: 0;
}

.products .row:only-child .card:only-child .card-content:only-child {
  padding: var(--spacing-sm) var(--spacing-xl);
}

/* Add more space below cards to separate from following content */
.products {
  margin-bottom: var(--spacing-xl);
}

/* WordWeb iPhone cards - reduce padding when side by side */
.products[data-layout="wordweb-iphone"] .card .card-content {
  padding: var(--spacing-md) var(--spacing-lg);
}

/* Specific fixes for single app pages (Chambers, ChamThes) */
.content.article .products .row:only-child .card:only-child .card-content {
  padding: var(--spacing-lg) var(--spacing-xl);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.content.article .products .row:only-child .card:only-child .card-content .center {
  min-height: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
}

/* App icon sizing */
img[src*="ios/"],
img[src*="mac/"][width],
img[src*="icons/"] {
  max-width: 80px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Screenshot sizing - prevent huge images */
img[src*="iPhone"],
img[src*="android"],
img[src*="WordWeb"][src*=".png"],
img.materialboxed {
  max-width: 400px;
  width: 100%;
  height: auto;
}

/* Mac app screenshots - larger but reasonable size */
img[src*="mac/ODE/"],
img[src*="mac/NOAD/"],
img[src*="mac/SOED/"] {
  max-width: 500px;
  width: 100%;
  height: auto;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Utility classes */

.hidden {
  display: none;
}

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

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus,
a:focus {
  outline-color: var(--color-primary-light);
}

/* Smooth transitions for theme changes */
* {
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base);
}

/* Cookie banner CSS removed - no longer needed */

/* Print styles */
@media print {
  .header,
  .footer,
  .theme-toggle,
  .mobile-menu-toggle {
    display: none;
  }

  .main-content {
    margin: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.7);
  }

  .card {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
