/* CSS by Ariel Strother */

/* Imported Fonts */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,opsz,wdth,wght@0,18..144,87..112,300..900;1,18..144,87..112,300..900&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap');

/* CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
input, button, textarea, select {
  font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
ul {
  list-style: none;
}


/* Root Variables */
:root {
  --blue-bulletin: #1D3557;
  --news-flash: #E63946;
  --watchdog-white: #F1FAEE;
  --truth-text: #333;
  --story-subtitle: #457B9D;
  --font-body: "Source Sans 3", sans-serif;
  --font-heading: 'Merriweather', serif;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s ease;
}


/* Manual Light/Dark Mode Styles */
body.light-mode {
  background-color: var(--watchdog-white);
  color: var(--truth-text);
}
body.dark-mode {
  background-color: var(--truth-text);
  color: var(--watchdog-white);
}
body.dark-mode h2 {
  color: var(--watchdog-white);
}
body.dark-mode .intro p {
  color: var(--watchdog-white);
}
body.dark-mode blockquote.tagline {
  color: var(--watchdog-white);
}
body.dark-mode #featured-articles article {
  background-color: #3a3a3a;
  border-color: #555;
}
body.dark-mode #featured-articles article h3,
body.dark-mode #featured-articles article p {
  color: var(--watchdog-white);
}

#theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: var(--watchdog-white);
  border: 1px solid var(--blue-bulletin);
  border-radius: 1.5rem;
  cursor: pointer;
  z-index: 10;
  padding: 0.25rem;
}


/* Skip Link Styles */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background-color: var(--blue-bulletin);
  color: var(--watchdog-white);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
}


/* Navigation Styles */
header {
  background-color: var(--blue-bulletin);
  color: var(--watchdog-white);
  padding: 1.25rem 1.25rem 0;
  position: relative;
}

.site-identity {
  padding-right: 3rem;
  margin-bottom: 1rem;
}

nav {
  position: relative;
}

.menu-button {
  display: inline-block;
  cursor: pointer;
  padding: 0.4rem 1.5rem;
  background-color: var(--news-flash);
  color: var(--watchdog-white);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2rem;
  margin-bottom: 0.75rem;
  user-select: none;
}

.menu {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
}

.menu li a {
  display: inline-block;
  padding: 0.4rem 1rem;
  color: var(--watchdog-white);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: var(--news-flash);
  border-radius: 2rem;
  transition: background-color var(--transition);
}

.menu li a:hover,
.menu li a:focus {
  background-color: #bf1e2b;
  outline: 2px solid var(--watchdog-white);
  outline-offset: 2px;
}

/* Fallback checkbox toggle for nav (all browsers) */
#menu-toggle:checked ~ .menu {
  display: flex;
}


/* Global Layout Styles */
body {
  font-family: var(--font-body);
  line-height: 1.6;
  background-color: var(--watchdog-white);
  color: var(--truth-text);
}

main {
  padding: 2rem 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
}

section {
  margin-bottom: 3rem;
}

footer {
  background-color: var(--blue-bulletin);
  color: var(--watchdog-white);
  padding: 2rem 1.25rem;
  text-align: center;
}

footer h2 {
  color: var(--watchdog-white);
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1rem 0;
}

footer ul li a {
  display: inline-block;
  padding: 0.4rem 1rem;
  background-color: var(--news-flash);
  color: var(--watchdog-white);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2rem;
  transition: background-color var(--transition);
}

footer ul li a:hover,
footer ul li a:focus {
  background-color: #bf1e2b;
  outline: 2px solid var(--watchdog-white);
  outline-offset: 2px;
}

footer > p {
  font-size: 0.875rem;
  opacity: 0.75;
  margin-top: 0.5rem;
}


/* Global Text Styles */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
}

h1 {
  font-size: 2.25rem;
  color: var(--watchdog-white);
  margin-bottom: 0.2rem;
}

h2 {
  font-size: 1.5rem;
  color: var(--blue-bulletin);
  border-bottom: 2px solid var(--news-flash);
  padding-bottom: 0.35rem;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.05rem;
  color: var(--blue-bulletin);
}

p {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

.tagline {
  font-style: italic;
  color: var(--watchdog-white);
  font-size: 0.95rem;
  opacity: 0.9;
}

blockquote.tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.1rem;
  text-align: center;
  color: var(--truth-text);
  padding: 0.75rem 1.5rem;
  margin: 0.75rem 0;
}


/* Intro Section */
.intro p,
.intro blockquote {
  color: var(--truth-text);
}


/* Breaking News Articles */
#breaking-news article {
  background-color: var(--news-flash);
  padding: 0;
  border-left: none;
  box-shadow: var(--shadow);
  color: var(--watchdog-white);
  margin-bottom: 1.25rem;
}

#breaking-news article h3 {
  color: var(--watchdog-white);
  padding: 0.875rem 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  text-decoration: underline;
  margin-bottom: 0;
}

#breaking-news article p {
  padding: 0.875rem 1rem;
  color: var(--watchdog-white);
  margin-bottom: 0;
}

#breaking-news article video {
  width: 100%;
  margin-top: 0;
  border-radius: 0;
  box-shadow: none;
}


/* Featured Articles */
#featured-articles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

#featured-articles h2 {
  grid-column: 1 / -1;
}

#featured-articles article {
  border: 2px solid #ccc;
  background-color: #fff;
  padding: 1rem;
  box-shadow: none;
  margin-bottom: 0;
}

#featured-articles article h3 {
  font-size: 1rem;
  color: var(--blue-bulletin);
  border-bottom: 1px solid var(--story-subtitle);
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

#featured-articles article p {
  font-size: 0.9rem;
  color: var(--truth-text);
  margin-bottom: 0;
}


/* Alerts / Form Section */
#alerts > h2 {
  color: var(--blue-bulletin);
}

#alerts > p {
  margin-bottom: 1rem;
}

#alerts form {
  background-color: var(--news-flash);
  padding: 1.25rem;
  border-radius: 0.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  color: var(--watchdog-white);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

#alerts input[type="text"],
#alerts input[type="tel"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.2rem;
  font-size: 1rem;
  background-color: #fff;
  color: var(--truth-text);
}

#alerts input[type="text"]:focus,
#alerts input[type="tel"]:focus {
  outline: 2px solid var(--blue-bulletin);
  outline-offset: 2px;
}

fieldset {
  border: 1px solid var(--blue-bulletin);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

legend {
  color: var(--watchdog-white);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 0.5rem;
  grid-column: 1 / -1;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--watchdog-white);
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
}

#alerts button[type="submit"] {
  display: block;
  width: 100%;
  background-color: var(--blue-bulletin);
  color: var(--watchdog-white);
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 0.2rem;
  cursor: pointer;
  transition: background-color var(--transition);
}

#alerts button[type="submit"]:hover,
#alerts button[type="submit"]:focus {
  background-color: #152740;
  outline: 2px solid var(--watchdog-white);
  outline-offset: 2px;
}


/* medium styles 620px */
@media (min-width: 620px) {
  h1 { font-size: 2.75rem; }
  h2 { font-size: 1.75rem; }

  header {
    padding: 1.5rem 2rem 0;
  }

  .menu-button {
    display: none;
  }

  .menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.875rem;
  }

  main {
    padding: 2rem 2rem;
  }

  #breaking-news {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  #breaking-news h2 {
    grid-column: 1 / -1;
  }

  #breaking-news article {
    margin-bottom: 0;
  }

  #featured-articles {
    grid-template-columns: repeat(2, 1fr);
  }

  #alerts form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  #alerts fieldset {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  #alerts button[type="submit"] {
    grid-column: 1 / -1;
  }
}


/* large styles 920px */
@media (min-width: 920px) {
  h1 { font-size: 3.25rem; }
  h2 { font-size: 2rem; }

  header {
    padding: 1.75rem 3rem 0;
  }

  main {
    padding: 2.5rem 3rem;
  }

  #featured-articles {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* x-large styles 1024px */
@media (min-width: 1024px) {
  h1 { font-size: 3.75rem; }

  header {
    padding: 2rem 4rem 0;
  }

  main {
    padding: 3rem 4rem;
  }
}


/* Interaction Queries for color scheme light and dark and motion preference */
@media (prefers-color-scheme: light) {
  body:not(.dark-mode) {
    background-color: var(--watchdog-white);
    color: var(--truth-text);
  }

  body:not(.dark-mode) h2 {
    color: var(--blue-bulletin);
  body:not(.dark-mode) #featured-articles article {
    background-color: #fff;
    border-color: #ccc;
  }

  body:not(.dark-mode) #featured-articles article h3,
  body:not(.dark-mode) #featured-articles article p {
    color: var(--truth-text);
  }

  body:not(.dark-mode) #featured-articles article h3 {
    color: var(--watchdog-white);
  }
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) {
    background-color: var(--truth-text);
    color: var(--watchdog-white);
  }

  body:not(.light-mode) h2 {
    color: var(--watchdog-white);
  }

  body:not(.light-mode) .intro p {
    color: var(--watchdog-white);
  }

  body:not(.light-mode) blockquote.tagline {
    color: var(--watchdog-white);
  }

  body:not(.light-mode) #featured-articles article {
    background-color: #3a3a3a;
    border-color: var(--story-subtitle);
  }

  body:not(.light-mode) #featured-articles article h3,
  body:not(.light-mode) #featured-articles article p {
    color: var(--watchdog-white);
  }
}

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


/* Feature Query for :has() that checks if the #menu-toggle is checked */
@supports (selector(:has(*))) {
  nav:has(#menu-toggle:checked) .menu {
    display: flex;
    flex-direction: column;
  }

  @media (min-width: 620px) {
    nav .menu {
      display: flex;
      flex-direction: row;
    }
  }
}
