/**
 * Main Stylesheet
 * Responsive, modern design for akordeons.lv
 */

/* NOTE: colors.css and player.css are intentionally NOT @import-ed here.
   An @import URL cannot carry the ?v= cache-busting parameter that
   version.js appends to <link>/<script> tags, so the imported copy is
   permanently cacheable - and because an @import resolves after the
   page's own <link>, that stale copy would override the fresh one and
   silently mask every colour change. Each page links these directly
   instead: colors.css on all pages, player.css only where a player
   actually exists (index.html, music.html). */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

:root {
  /* Serif display face for headings, drawn from fonts already present on
     the system - gives the site an editorial/classical voice against the
     sans body text without downloading a webfont. */
  --font-heading: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

h1 { font-size: 3rem; letter-spacing: -0.025em; }
h2 { font-size: 2.125rem; }
h3 { font-size: 1.625rem; }
h4 { font-size: 1.375rem; }
h5 { font-size: 1.15rem; }
h6 { font-size: 1rem; }

/* Accent rule under each page's main title - applied via ::after so no
   markup change is needed on any page. */
main > h1 {
  margin-bottom: 0.4rem;
}

main > h1::after {
  content: '';
  display: block;
  width: 52px;
  height: 3px;
  margin-top: 0.85rem;
  border-radius: 2px;
  background-color: var(--color-accent-primary);
}

/* The intro paragraph directly after a page title reads as a lede. */
main > h1 + p {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 65ch;
  margin-top: 1.25rem;
  margin-bottom: 2rem;
}

p {
  margin-bottom: 1rem;
}

/* Visible keyboard focus - previously missing entirely. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
  border-radius: 3px;
}

a {
  text-decoration: none;
  color: var(--color-link);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
}

/* Header */
header {
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Recolorable logo: the source PNG is a white silhouette, used here as a
   CSS mask so it can be tinted per-theme via --logo-color instead of
   shipping separate colored image files. */
.logo-icon {
  display: inline-block;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background-color: var(--logo-color);
  -webkit-mask-image: url('../images/akordeons_logo_white.png');
  mask-image: url('../images/akordeons_logo_white.png');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: background-color 0.3s ease;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--color-text-primary);
}

.contact-info {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.contact-info a {
  color: var(--color-text-secondary);
}

/* Shared layout for any link with a leading icon (header/footer contact
   info, contact page cards) - keeps the icon aligned with the text
   regardless of the surrounding context's own display type. */
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-phone,
.icon-mail {
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Navigation */
nav {
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0;
  flex-wrap: wrap;
}

.nav-menu li {
  margin: 0;
}

.nav-menu a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, color 0.2s ease;
  border-bottom: 2px solid transparent;
}

.nav-menu a:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-link);
}

.nav-menu a.active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
  font-weight: 600;
}

/* Language Switcher */
.language-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.language-switcher button {
  background: none;
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-text-primary);
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.language-switcher button:hover {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-accent-primary);
}

.language-switcher button.active {
  background-color: var(--color-accent-primary);
  color: white;
  border-color: var(--color-accent-primary);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
  background: none;
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-text-primary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.dark-mode-toggle:hover {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-accent-primary);
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: calc(100vh - 300px);
}

/* About page photo */
.about-photo {
  max-width: 500px;
  margin: 1.5rem 0 2rem;
}

.about-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.about-photo figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
  text-align: right;
}

/* Footer */
footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 2rem 1rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-contact {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-contact a {
  color: var(--color-text-secondary);
}

.footer-copyright {
  color: var(--color-text-tertiary);
  font-size: 0.875rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-text-primary);
  font-size: 1rem; /* Base size for hamburger icon */
  align-items: center;
  justify-content: center;
  /* Reset any inherited constraints */
  margin: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

.mobile-menu-toggle:hover {
  background-color: var(--color-bg-tertiary);
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  /* Ensure nav container doesn't constrain button */
  .nav-container {
    padding: 0.5rem 1rem; /* Add vertical padding for button */
    display: flex;
    align-items: center;
  }
  
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .contact-info {
    font-size: 1.1rem; /* Larger in compact mode */
  }
  
  .contact-info a {
    font-size: 1.1rem; /* Larger in compact mode */
  }
  
  /* Force hamburger button to be 64x64px - use most specific selector */
  .nav-container .mobile-menu-toggle,
  nav .mobile-menu-toggle,
  .mobile-menu-toggle,
  button.mobile-menu-toggle {
    display: flex !important;
    /* Force exact size - twice as large */
    padding: 0 !important;
    margin: 0 !important;
    font-size: 2rem !important;
    min-width: 64px !important;
    min-height: 64px !important;
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    line-height: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    border-width: 2px !important;
    overflow: visible !important;
    /* Override any inherited sizing */
    aspect-ratio: 1 / 1 !important;
  }
  
  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-menu a {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
  }
  
  .nav-menu a.active {
    border-bottom: 1px solid var(--color-border);
    border-left: 3px solid var(--color-link);
  }
  
  main {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .language-switcher {
    flex-wrap: wrap;
  }
  
  .contact-info {
    flex-direction: column;
    gap: 0.5rem;
    font-size: 1.2rem; /* Even larger on very small screens */
  }
  
  .contact-info a {
    font-size: 1.2rem; /* Even larger on very small screens */
  }
  
  .mobile-menu-toggle {
    /* Keep it large on very small screens too */
    display: flex !important;
    padding: 0 !important; /* Remove padding, use fixed size */
    margin: 0 !important;
    font-size: 2rem !important;
    min-width: 64px !important;
    min-height: 64px !important;
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    line-height: 1 !important; /* Remove line-height constraints */
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    border-width: 2px !important; /* Slightly thicker border for visibility */
  }
}

/* Utility Classes */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

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

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

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

