/* Complete rewrite for newspaper aesthetic with CSS variables and typography */

/* Google Fonts Import */
@import url("https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

/* CSS Variables - Broadsheet Classic Palette */
:root {
  --paper: #fafaf7;
  --ink: #151515;
  --rule: #e2e2dd;
  --accent: #c4322b;
  --smudge: #f3f2ed;
}

/* Alternative Palettes (uncomment to use) */

/* Evening Edition
:root {
  --paper: #F7F6F3;
  --ink: #111418;
  --rule: #DCDAD6;
  --accent: #1F4AA8;
  --smudge: #EEEDE9;
}
*/

/* Sunday Mag
:root {
  --paper: #FFFFFF;
  --ink: #1A1A1A;
  --rule: #E7E7E7;
  --accent: #E29A06;
  --smudge: #F5F5F5;
}
*/

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Source Serif 4", serif;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.01) 2px,
    rgba(0, 0, 0, 0.01) 4px
  );
}

/* Typography */
.font-serif {
  font-family: "Libre Baskerville", serif;
}

.font-sans {
  font-family: "IBM Plex Sans", sans-serif;
}

/* Newspaper Rule (hairline) */
.newspaper-rule {
  height: 1px;
  background-color: var(--rule);
  border: none;
}

/* Cutline (photo caption) */
.cutline {
  margin-top: 0.5rem;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.7);
  font-style: italic;
}

/* Drop Cap */
.drop-cap::first-letter {
  float: left;
  font-size: 4rem;
  line-height: 1;
  margin-right: 0.5rem;
  font-weight: bold;
  color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 480ms ease-out forwards;
}

/* Form Styles */
input:focus,
textarea:focus,
select:focus {
  outline: none;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  font-family: "IBM Plex Sans", sans-serif;
}

/* Error States */
.error-message {
  display: block;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.error-message.hidden {
  display: none;
}

.border-red-500 {
  border-color: var(--accent) !important;
}

/* Details/Summary Styling */
details {
  cursor: pointer;
}

details summary {
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details[open] summary {
  margin-bottom: 1rem;
}

/* Smooth Transitions */
a,
button,
input,
textarea,
details {
  transition: all 0.3s ease;
}

/* Link Hover Effects */
a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  opacity: 0.8;
}

/* Button Styles */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Checkbox Styling */
input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent);
}

/* Mobile Menu Transition */
#mobileMenu {
  transition: all 0.3s ease-in-out;
}

/* Cookie Popup Animation */
#cookiePopup {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scroll Reveal */
section {
  opacity: 0;
  transform: translateY(12px);
}

section.animate-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Image Loading */
img {
  transition: opacity 0.3s ease;
  display: block;
  max-width: 100%;
  height: auto;
}

img:not([src]) {
  opacity: 0;
}

/* Placeholder Image Animation */
img[src*="placeholder"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Text Selection */
::selection {
  background-color: var(--accent);
  color: white;
}

::-moz-selection {
  background-color: var(--accent);
  color: white;
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--smudge);
}

::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Print Styles */
@media print {
  header,
  footer,
  #cookiePopup,
  button {
    display: none;
  }

  section {
    page-break-inside: avoid;
  }

  body {
    background: white;
  }
}

/* Responsive Typography */
@media (max-width: 640px) {
  h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.75rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.5rem;
    line-height: 1.4;
  }
}

/* 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;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  button,
  a {
    text-decoration: underline;
  }

  .border {
    border-width: 2px;
  }
}

/* Newspaper-specific utilities */
.masthead-title {
  font-family: "Libre Baskerville", serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editorial-label {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.byline {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Card hover effects for cases */
article {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Iframe responsive */
iframe {
  display: block;
  width: 100%;
}
