/* Peter W Flint, Spring 2023 */
/* Base Styles - Mobile-First Approach */
:root {
  /* Light Mode Colors - WCAG AA Compliant */
  /* Color Palette: Dark green (#16210B), Black, White */
  --primary-color: rgba(22, 33, 11, 1); /* #16210B - Dark green, ~8.5:1 contrast on white (WCAG AA) */
  --secondary-color: rgba(0, 0, 0, 1); /* #000000 - Black, 21:1 contrast on white (WCAG AAA) */
  --hover-color: rgba(22, 33, 11, 0.5); /* 50% dark green for hover states */
  --text-muted: rgba(0, 0, 0, 0.75); /* 75% black, ~5.25:1 contrast on white (WCAG AA) */
  --bg-color: #ffffff; /* White background */
  --text-color: rgba(22, 33, 11, 1); /* #16210B - Dark green text, ~8.5:1 contrast (WCAG AA) */
  
  /* Mobile-First Spacing (optimized for reading) */
  --spacing-xs: 0.75rem;   /* 12px */
  --spacing-sm: 1rem;      /* 16px */
  --spacing-md: 1.5rem;    /* 24px */
  --spacing-lg: 2rem;      /* 32px */
  --spacing-xl: 3rem;      /* 48px */
  --spacing-xxl: 4rem;     /* 64px */
  
  /* Container widths - mobile-first */
  --max-width: 100%;
  --max-width-content: 14rem; /* Smaller container - ~224px */
  --container-padding: var(--spacing-md);
  
  /* Typography - mobile-first base sizes */
  --font-size-base: 1rem;      /* 16px */
  --font-size-small: 0.875rem;  /* 14px */
  --font-size-large: 1.25rem;   /* 20px */
  --font-size-xl: 1.75rem;      /* 28px */
  --font-size-xxl: 2rem;        /* 32px */
  
  /* Touch targets - minimum 44px for accessibility */
  --touch-target-min: 2.75rem;  /* 44px */
  
  /* Line heights for optimal reading */
  --line-height-tight: 1.4;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;
  
  /* Theme transition */
  --transition-theme: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Color Palette - WCAG AA Compliant */
[data-theme="dark"] {
  /* Color Palette: Light green (#B4C8A0), White, Dark gray (#1a1a1a) */
  --primary-color: rgba(180, 200, 160, 1); /* #B4C8A0 - Light green, ~7.2:1 contrast on #1a1a1a (WCAG AA) */
  --secondary-color: rgba(255, 255, 255, 1); /* #FFFFFF - White, ~13.5:1 contrast on #1a1a1a (WCAG AAA) */
  --hover-color: rgba(180, 200, 160, 0.7); /* 70% light green for hover states */
  --text-muted: rgba(255, 255, 255, 0.8); /* 80% white, ~5.4:1 contrast on #1a1a1a (WCAG AA) */
  --bg-color: #1a1a1a; /* Dark gray background */
  --text-color: rgba(255, 255, 255, 0.9); /* 90% white, ~6.1:1 contrast on #1a1a1a (WCAG AA) */
}

/* System preference detection for dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark Mode Colors - WCAG AA Compliant */
    --primary-color: rgba(180, 200, 160, 1); /* #B4C8A0 - Light green, ~7.2:1 contrast (WCAG AA) */
    --secondary-color: rgba(255, 255, 255, 1); /* #FFFFFF - White, ~13.5:1 contrast (WCAG AAA) */
    --hover-color: rgba(180, 200, 160, 0.7); /* 70% light green for hover */
    --text-muted: rgba(255, 255, 255, 0.8); /* 80% white, ~5.4:1 contrast (WCAG AA) */
    --bg-color: #1a1a1a; /* Dark gray background */
    --text-color: rgba(255, 255, 255, 0.9); /* 90% white, ~6.1:1 contrast (WCAG AA) */
  }
}

* {
  box-sizing: border-box;
}

body {
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  /* Smooth theme transitions */
  transition: var(--transition-theme);
  /* Improve text rendering on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
  /* Center content in viewport */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* Header */
header {
  width: 100%;
  text-align: left;
}

/* Theme Toggle Wrapper - Top Left Corner */
.theme-toggle-wrapper {
  position: fixed;
  top: var(--spacing-sm);
  left: var(--spacing-sm);
  z-index: 1000;
  margin: 0;
}

/* Theme Toggle Button - Slider Style */
.theme-toggle {
  position: relative;
  width: 2rem; /* 32px - proportional to social icons */
  height: 1.2rem; /* 19.2px */
  background: var(--text-muted);
  border: 1px solid var(--secondary-color);
  border-radius: 1.2rem;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-theme), border-color 0.3s ease;
  display: flex;
  align-items: center;
  outline: none;
}

.theme-toggle:hover {
  border-color: var(--primary-color);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Slider Track */
.theme-toggle-slider {
  position: absolute;
  width: 0.9rem; /* 14.4px */
  height: 0.9rem; /* 14.4px */
  background: var(--bg-color);
  border: 1px solid var(--secondary-color);
  border-radius: 50%;
  transition: transform 0.3s ease, var(--transition-theme);
  display: flex;
  align-items: center;
  justify-content: center;
  left: 0.15rem; /* 2.4px from left */
}

/* Dark mode - slider moves right */
[data-theme="dark"] .theme-toggle-slider {
  transform: translateX(0.8rem); /* Move to right */
}

/* Icon inside slider */
.theme-icon {
  font-size: 0.5rem; /* 8px - smaller to fit in slider */
  color: var(--secondary-color);
  transition: var(--transition-theme);
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Show sun in light mode, moon in dark mode */
.theme-icon-moon {
  display: none;
}

.theme-icon-sun {
  display: flex;
}

[data-theme="dark"] .theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: flex;
}

/* Typography - Mobile-First */
h1 {
  font-family: 'Yantramanav', sans-serif;
  /* Responsive font size that scales down on smaller viewports */
  font-size: clamp(1.8rem, 5vw, calc(var(--font-size-xxl) * 1.3));
  font-weight: 100;
  margin: 0 0 var(--spacing-md) 0; /* Reduced margin to fit content */
  letter-spacing: -0.02em;
  line-height: var(--line-height-tight);
  text-align: left; /* Explicitly left-align */
  width: 100%;
  white-space: nowrap; /* Prevent H1 from wrapping */
}

h2 {
  font-family: 'Yantramanav', sans-serif;
  font-size: var(--font-size-large);
  font-weight: 100;
  margin: 0;
  line-height: var(--line-height-tight);
}

/* Links */
a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease, var(--transition-theme);
}

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

/* Focus styles for keyboard navigation */
a:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 2px;
}

a:focus:not(:focus-visible) {
  outline: none;
}

/* Skip Link - Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

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

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

/* Layout - Mobile-First */
#main-content,
#landing {
  max-width: var(--max-width-content);
  min-width: 15rem; /* Ensure container is wide enough for H1 text (~240px) */
  width: auto; /* Let container size to content, not 100% width */
  margin: 0;
  padding: var(--spacing-md) var(--container-padding); /* Reduced padding to fit content */
  /* Body handles centering, so we just need flex column */
  display: flex;
  flex-direction: column;
  /* Content inside is left-aligned, but container is centered by body */
  align-items: flex-start;
  box-sizing: border-box;
}

/* Navigation */
nav {
  width: 100%;
}

/* Navigation Links - Mobile-First with Touch Targets */
ul#links {
  list-style-type: none;
  padding: 0;
  margin: 0 0 var(--spacing-md) 0; /* Reduced gap between nav and social icons */
  display: flex;
  flex-direction: column; /* Always single column, never wrap to rows */
  gap: 0.125rem; /* Even tighter spacing between nav items (2px) */
  width: 100%;
  align-items: flex-start; /* Left-align all items */
}

ul#links li {
  font-family: 'Amatic SC', cursive;
  font-size: calc(var(--font-size-xl) * 1.1); /* Slightly bigger nav items */
  font-weight: 400;
}

ul#links li a {
  display: inline-block;
  /* Ensure minimum touch target size (44px) */
  min-height: var(--touch-target-min);
  padding: var(--spacing-xs) var(--spacing-sm);
  /* Improve tap target area - left align */
  margin: calc((var(--touch-target-min) - 1em) / 2) 0;
  margin-left: 0;
  line-height: 1.2;
  /* Better touch feedback */
  -webkit-tap-highlight-color: rgba(22, 33, 11, 0.1);
}

ul#links li a:hover,
ul#links li a:focus {
  text-decoration: underline;
  color: var(--secondary-color);
  /* Remove transform to prevent spacing issues */
  outline: none;
}

/* Contact Section - Mobile-First */
#contact {
  font-family: 'Yantramanav', sans-serif;
  font-size: var(--font-size-large);
  font-weight: 100;
  margin-top: 0; /* No extra spacing - tight layout */
  padding-top: 0;
  width: 100%;
}

.contact-links {
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-start; /* Left-align social icons */
  align-items: center;
  flex-wrap: nowrap; /* Keep icons in single row, never wrap */
  width: 100%;
}

.contact-details {
  /* Smaller than nav items - nav is primary focus */
  font-size: calc(var(--font-size-xl) * 0.7);
  transition: transform 0.3s ease-out, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Scale size proportionally, but ensure minimum touch target */
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  width: calc(var(--font-size-xl) * 0.9);
  height: calc(var(--font-size-xl) * 0.9);
  border-radius: 0; /* Remove circular shape */
  background-color: transparent;
  /* Better touch feedback */
  -webkit-tap-highlight-color: rgba(22, 33, 11, 0.1);
}

.contact-details:hover,
.contact-details:focus {
  transform: translateY(-4px); /* Reduced transform to prevent spacing issues */
  color: var(--hover-color);
  outline: none; /* Remove box outline */
  background-color: transparent; /* Ensure no background appears */
}

/* Navigation Bar */
.nav {
  max-width: var(--max-width);
  margin: var(--spacing-sm) auto var(--spacing-lg) auto;
  padding: 0 var(--spacing-sm);
  line-height: 24px;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  transition: font-weight 0.2s ease;
}

.nav a:hover {
  font-weight: bold;
  color: var(--secondary-color);
}

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

.nav ul li {
  display: inline;
  margin-right: 10px;
  line-height: 1.5em;
}

/* Responsive Design - Mobile-First (base styles above are for mobile) */

/* Tablet and up (768px+) */
@media (min-width: 48rem) {
  :root {
    --max-width: 32rem;        /* 512px - smaller container */
    --max-width-content: 32rem;
    --container-padding: var(--spacing-lg);
    --font-size-base: 1.125rem;  /* 18px */
    --font-size-large: 1.5rem;   /* 24px */
    --font-size-xl: 2.25rem;     /* 36px */
    --font-size-xxl: 3rem;       /* 48px */
    --spacing-lg: 2.5rem;        /* 40px */
    --spacing-xl: 4rem;          /* 64px */
    --spacing-xxl: 6rem;         /* 96px */
  }
  
  #landing {
    max-width: var(--max-width-content);
    width: auto; /* Let container size to content for proper centering */
    margin: 0;
    padding: var(--spacing-md) var(--container-padding); /* Consistent padding */
  }
  
  /* Keep nav links in single column on all screen sizes */
  ul#links {
    flex-direction: column; /* Always single column */
    gap: 0.125rem; /* Even tighter spacing between nav items (2px) */
  }
  
  ul#links li a {
    margin-left: 0; /* Keep left-aligned */
  }
  
  /* Social icons stay left-aligned and in single row */
  .contact-links {
    justify-content: flex-start;
    flex-wrap: nowrap; /* Never wrap */
  }
}

/* Desktop and up (1024px+) */
@media (min-width: 64rem) {
  :root {
    --max-width: 32rem;      /* 512px - smaller container, same as tablet */
    --max-width-content: 32rem;
    --spacing-xxl: 7.5rem;      /* 120px */
  }
  
  #landing {
    max-width: var(--max-width-content);
    width: auto; /* Let container size to content for proper centering */
    margin: 0;
    padding: var(--spacing-md) var(--container-padding); /* Consistent padding */
  }
}

/* Secondary pages (Coming soon, 404) — slightly wider measure for short prose */
main#main-content.secondary-main {
  max-width: min(92vw, 22rem);
}

main#main-content.secondary-main header h1 {
  white-space: normal;
}

.coming-soon-lede,
.error-lede {
  font-family: 'Yantramanav', sans-serif;
  font-size: var(--font-size-base);
  font-weight: 400;
  line-height: var(--line-height-relaxed);
  color: var(--text-muted);
  margin: 0 0 var(--spacing-md) 0;
}

.error-code {
  font-family: 'Yantramanav', sans-serif;
  font-size: var(--font-size-small);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--spacing-sm) 0;
}

.back-home {
  font-family: 'Amatic SC', cursive;
  font-size: calc(var(--font-size-xl) * 0.95);
  font-weight: 400;
  display: inline-block;
  min-height: var(--touch-target-min);
  padding: var(--spacing-xs) 0;
  line-height: 1.2;
}

/* Print Styles */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .contact-details:hover {
    transform: none;
  }
  
  a {
    color: var(--secondary-color);
  }
} 