/* ==========================================================
   Letters from the DEAD - Homepage styles
   Palette: Red #6c1313, Gray #525050, Black #000000
   Font: IM Fell DW Pica
   Desktop design frame: 1440px wide (used as max width)
   Breakpoints: 1200px, 1024px, 768px, 480px
   ========================================================== */

:root {
  --red: #6c1313;
  --gray: #525050;
  --black: #000000;
  --white: #ffffff;
  --light-gray: #d9d9d9;

  --font-main: "IM Fell DW Pica", Georgia, "Times New Roman", serif;
  /* Century Gothic is not a web font: these are similar geometric fonts */
  --font-gothic: "Century Gothic", "URW Gothic", "Avant Garde", "Questrial",
    "Futura", "Trebuchet MS", sans-serif;

  /* Type sizes: they shrink smoothly between phone and 1440px desktop */
  --h1: clamp(3rem, 1.5rem + 5vw, 6rem); /* 96px */
  --h2: clamp(2rem, 1.4rem + 2vw, 3rem); /* 48px */
  --h3: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem); /* 36px */
  --body: clamp(1.25rem, 1rem + 1vw, 2rem); /* 32px */

  --max-width: 1440px;
  --radius: 20px;
  /* How far the header/hero edge slants (74px at 1440px wide).
     Using vw keeps the angle the same (2.94deg) at every screen width */
  --slant: 5.14vw;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--body);
  color: var(--black);
  background-color: var(--white);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1,
h2,
p {
  margin: 0;
  font-weight: normal;
}

h2 {
  font-size: var(--h2);
  color: var(--white);
  text-align: center;
  margin-bottom: 1.5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Hidden on screen but still read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* text or elements that only show on mobile (turned on at 768px) */
.mobile-only,
.footer-nav {
  display: none;
}

/* ---------- SECTION 1: Header / Navigation ---------- */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 0.75rem 2rem 0;
}

.logo {
  flex: 0 1 clamp(180px, 20vw, 300px);
  font-size: var(--h1);
  margin-bottom: 0.5rem;
}

.main-nav {
  /* tilt the tabs to match the slant, and lift them up so
     they sit on top of the slanted edge instead of inside it */
  transform: rotate(-2.94deg);
  transform-origin: right bottom;
  margin-bottom: calc(var(--slant) - 2px);
}

.main-nav ul {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 1rem;
}

.main-nav a {
  display: block;
  padding: 0.5rem 1.5rem 0.4rem;
  font-size: var(--body);
  color: var(--white);
  background-color: var(--gray);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background-color 0.2s;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  background-color: var(--red);
}

/* Hamburger menu: hidden on desktop, turned on at the 768px breakpoint.
   The checkbox is invisible but still reachable with the keyboard */
.menu-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background-color: var(--gray);
  border-radius: 10px;
  cursor: pointer;
}

.menu-toggle:focus-visible + .menu-button {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* three white bars: the middle span plus ::before and ::after */
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 28px;
  height: 3px;
  background-color: var(--white);
  border-radius: 2px;
  transition: transform 0.2s, background-color 0.2s;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -9px;
}

.menu-icon::after {
  top: 9px;
}

/* when open, the bars turn into an X */
.menu-toggle:checked + .menu-button .menu-icon {
  background-color: transparent;
}

.menu-toggle:checked + .menu-button .menu-icon::before {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle:checked + .menu-button .menu-icon::after {
  transform: translateY(-9px) rotate(-45deg);
}

/* ---------- SECTION 2: Hero / Value Statement ---------- */

.hero {
  display: flex;
  /* full browser width */
  margin-top: calc(var(--slant) * -1);
  background-color: var(--black);
  /* slanted top edge: lower on the left (700px), higher on the right (774px) */
  clip-path: polygon(0 var(--slant), 100% 0, 100% 100%, 0 100%);
  height: min(53.75vw, 774px);
}

.hero-image {
  flex: 0 0 54%;
  border: 23px solid var(--red);
  border-top-width: calc(23px + var(--slant));
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.value-statement {
  flex: 1;
  display: flex;
  align-items: center;
  padding: var(--slant) 1.5rem 0 0;
  color: var(--white);
}

/* the right side of the image is empty black, so the text overlaps it */
.value-statement picture {
  flex: 0 0 72%;
}

.value-statement p {
  position: relative;
  margin-left: -14%;
  font-size: var(--h2);
  line-height: 1.15;
  text-align: center;
}

/* ---------- SECTION 3: Links to Articles ---------- */

.articles {
  background-color: var(--gray);
  padding: 2rem 2rem 3rem;
}

.article-cards {
  display: flex;
  justify-content: center;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.article-cards li {
  flex: 0 1 321px;
}

.article-cards a {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-height: 480px;
  padding: 1.25rem;
  background-color: var(--red);
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: transform 0.2s;
}

.article-cards a:hover,
.article-cards a:focus-visible {
  transform: translateY(-6px);
}

.article-cards img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background-color: var(--white);
}

.card-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 1rem;
  font-size: var(--h2);
  line-height: 1.1;
  text-align: center;
}

/* the small "in the" / "the" between the big words */
.card-title small {
  font-size: 0.6em;
}

/* ---------- SECTION 4: Categories (Explore Moods) ---------- */

.moods {
  background: var(--black) url("../../images/backgroundtexturedoor.jpg")
    center / cover no-repeat;
  padding: 2rem 2rem 3rem;
}

.mood-list {
  display: flex;
  justify-content: space-evenly;
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.mood-list li {
  flex: 0 1 267px;
}

/* each mood sits on the red sword shape (267 x 637) */
.mood-list a {
  position: relative;
  display: block;
  aspect-ratio: 267 / 637;
  background: url("../../images/redsword.png") center top / 100% 100%
    no-repeat;
  color: var(--white);
}

.mood-title {
  position: absolute;
  top: 7.5%;
  left: 0;
  right: 0;
  height: 13.7%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--h2);
}

/* font sample image (282 x 246) centered under the title */
.mood-list img {
  position: absolute;
  top: 26%;
  left: 50%;
  width: 105%;
  aspect-ratio: 282 / 246;
  object-fit: cover;
  transform: translateX(-50%);
  transition: transform 0.2s;
}

.mood-list a:hover img,
.mood-list a:focus-visible img {
  transform: translateX(-50%) scale(1.05);
}

/* ---------- SECTION 5: Sign up form ---------- */

.signup {
  background-color: var(--gray);
  padding: 3rem 2rem 4rem;
}

.signup-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  max-width: 952px;
  margin: 0 auto;
}

.signup-form input {
  width: 100%;
  height: 74px;
  padding: 0 1.5rem;
  font-family: var(--font-main);
  font-size: var(--body);
  color: var(--black);
  background-color: var(--light-gray);
  border: 2px solid transparent;
  border-radius: var(--radius);
}

.signup-form input:focus {
  outline: none;
  border-color: var(--red);
}

.signup-form button {
  width: 100%;
  max-width: 483px;
  min-height: 100px;
  padding: 1rem;
  font-family: var(--font-main);
  font-size: var(--body);
  color: var(--white);
  background-color: var(--red);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s;
}

.signup-form button:hover,
.signup-form button:focus-visible {
  background-color: var(--black);
}

/* ---------- SECTION 6: Footer ---------- */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 338px;
  padding: 2.5rem 1rem 1.5rem;
  background-color: var(--white);
  text-align: center;
}

.social {
  display: flex;
  gap: 0.75rem;
}

.social img {
  width: 72px;
  height: 66px;
  object-fit: contain;
  transition: transform 0.2s;
}

.social a:hover img,
.social a:focus-visible img {
  transform: scale(1.1);
}

.follow {
  margin-top: 0.5rem;
  font-size: var(--body);
}

.copyright {
  margin-top: auto;
  padding-top: 2rem;
  font-family: var(--font-gothic);
  font-size: clamp(1rem, 0.8rem + 0.6vw, 1.5rem); /* 24px */
}

/* ==========================================================
   Responsive breakpoints
   ========================================================== */

/* Small laptops */
@media (max-width: 1200px) {
  .article-cards,
  .mood-list {
    gap: 1rem;
  }

  .article-cards a {
    min-height: 0;
  }

  .card-title {
    font-size: var(--h3);
  }

  .mood-title {
    font-size: var(--h3);
  }

  .value-statement p {
    font-size: var(--h3);
  }
}

/* Tablets: 2 columns */
@media (max-width: 1024px) {
  .site-header {
    padding: 0.75rem 1rem 0;
  }

  .main-nav ul {
    gap: 0.5rem;
  }

  .main-nav a {
    padding: 0.4rem 1rem 0.3rem;
  }

  .article-cards,
  .mood-list {
    flex-wrap: wrap;
  }

  .article-cards li {
    flex-basis: calc(50% - 1rem);
    max-width: 321px;
  }

  .mood-list {
    justify-content: center;
    column-gap: 4rem;
  }

  .mood-list li {
    flex-basis: 240px;
  }
}

/* Mobile: single column (follows the iPhone mockup) */
@media (max-width: 768px) {
  :root {
    --slant: 6vw;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline;
  }

  /* logo on the left, hamburger on the right.
     Extra bottom padding leaves room for the slanted edge */
  .site-header {
    align-items: center;
    padding: 0.75rem 1rem calc(var(--slant) + 0.5rem);
  }

  .logo {
    flex: 0 1 150px;
    margin-bottom: 0;
  }

  .main-nav {
    transform: none;
    margin-bottom: 0;
  }

  /* show the hamburger: plain black bars, no box */
  .menu-button {
    display: flex;
    width: 44px;
    height: 44px;
    background-color: transparent;
  }

  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    background-color: var(--black);
  }

  /* the menu drops down over the hero, hidden until the button is clicked */
  .main-nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    flex-direction: column;
    gap: 0;
    background-color: var(--gray);
    border-top: 4px solid var(--red);
  }

  .menu-toggle:checked ~ ul {
    display: flex;
  }

  .main-nav a {
    padding: 1rem 1.5rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* hero stacks: image on top, value statement below, slant kept */
  .hero {
    flex-direction: column;
    height: auto;
  }

  .hero-image {
    border-width: 12px;
    border-top-width: calc(12px + var(--slant));
  }

  .hero-image img {
    aspect-ratio: 4 / 3;
  }

  .value-statement {
    flex-direction: column;
    padding: 1.5rem 1rem 2rem;
  }

  .value-statement picture {
    flex: none;
    width: 100%;
    max-width: 420px;
  }

  /* crop off the empty black area at the bottom of the mobile image */
  .value-statement img {
    width: 100%;
    aspect-ratio: 645 / 270;
    object-fit: cover;
    object-position: top;
  }

  .value-statement p {
    max-width: 6em;
    margin: 0.5rem 0 0;
  }

  /* article cards: full width, image on top, red title bar below */
  .articles {
    padding: 1.5rem 0 2rem;
  }

  .article-cards {
    flex-direction: column;
    gap: 1.5rem;
  }

  .article-cards li {
    flex-basis: auto;
    width: 100%;
    max-width: none;
  }

  .article-cards a {
    min-height: 0;
    padding: 0;
    border-radius: 0;
  }

  /* wide, short image area like the mockup; photos fill it */
  .article-cards img {
    aspect-ratio: 16 / 10;
    border-radius: 0;
  }

  /* drawings on white are shown whole (not cropped), centered on white */
  .article-cards img.show-whole {
    object-fit: contain;
    padding-top: 0.5rem;
  }

  .card-title {
    display: block;
    padding: 1rem;
    font-size: 1.25rem;
  }

  .card-title small {
    font-size: 0.8em;
  }

  /* moods: plain black background, smaller swords */
  .moods {
    background: var(--black);
    padding: 2rem 1rem 3rem;
  }

  .moods h2 {
    text-transform: uppercase;
    max-width: 10em;
    margin: 0 auto 2rem;
  }

  .mood-list {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }

  .mood-list li {
    flex-basis: auto;
    width: 190px;
  }

  .mood-title {
    font-size: 1.15rem;
  }

  /* sign up: smaller button that wraps to two lines */
  .signup {
    padding: 2rem 1.5rem 3rem;
  }

  .signup h2 {
    max-width: 10em;
    margin: 0 auto 1.5rem;
  }

  .signup-form {
    gap: 1.25rem;
  }

  .signup-form input {
    height: 50px;
    font-size: 1.15rem;
  }

  .signup-form button {
    max-width: 220px;
    min-height: 0;
    padding: 0.6rem 1rem;
    font-size: 1.15rem;
  }

  /* footer: icons, Follow us, then the page links */
  .site-footer {
    min-height: 0;
    padding: 1.5rem 1rem 1.25rem;
  }

  .follow {
    font-size: 1.25rem;
  }

  .footer-nav {
    display: block;
    margin-top: 0.5rem;
    font-size: 1.25rem;
  }

  .footer-nav a:hover,
  .footer-nav a:focus-visible {
    color: var(--red);
  }

  .copyright {
    padding-top: 1rem;
    font-size: 1rem;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .logo {
    flex-basis: 130px;
  }

  .social img {
    width: 44px;
    height: 40px;
  }
}
