/*
 * =========================================
 * CSS RESET & GLOBAL DEFAULTS
 * =========================================
 */
* {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  box-sizing: border-box;
}

:root {
  --clr-bg: hsl(0, 0%, 100%);
  --clr-text: hsl(0, 0%, 10%);
  --clr-border: hsl(0, 0%, 85%);
  --clr-accent: hsl(210, 100%, 50%);
  --clr-error: hsl(0, 84%, 60%);
  --clr-btn-bg: var(--clr-text);
  --clr-btn-text: var(--clr-bg);

  --fs-base: 1rem;
  --fs-s: 0.875rem;
  --fs-m: 1rem;
  --fs-l: 1.125rem;

  /* Scaled-down fluid typography */
  --fs-h6: 1.125rem;
  --fs-h5: 1.25rem;
  --fs-h4: 1.5rem;
  --fs-h3: clamp(1.75rem, 1.52rem + 1.14vw, 2.25rem);
  --fs-h2: clamp(1.85rem, 1.6rem + 1.2vw, 2.5rem);
  --fs-h1: clamp(2rem, 1.65rem + 1.74vw, 2.75rem);

  --space-xs: 0.25rem;
  --space-s: 0.5rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: calc(var(--space-xl) * 2);

  --container-max-width: 900px;
  --container-padding: var(--space-l);
  --header-height: 4.5rem;

  --border-width: 1px;
  --radius-small: 0.25rem;
  --radius-medium: 0.5rem;
  --radius-large: 0.75rem;

  /* Animation Timings */
  --transition-speed: 0.3s;
  --transition-ease: ease-in-out;
  --transition-ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  background-color: var(--clr-bg);
  color: var(--clr-text);
  overflow-y: scroll;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/*
 * =========================================
 * ANIMATIONS
 * =========================================
 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/*
 * =========================================
 * LAYOUT (Header, Main, Footer)
 * =========================================
 */
main,
footer {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  height: var(--header-height);
  border-bottom: var(--border-width) solid var(--clr-border);
  position: relative;
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

footer {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  margin-top: var(--space-xxl);
  border-top: var(--border-width) solid var(--clr-border);
  text-align: center;
  font-size: var(--fs-s);
}

main > section {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

/*
 * =========================================
 * TYPOGRAPHY
 * =========================================
 */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  max-width: 65ch;
  line-height: 1.2;
}

h1,
h2,
h3 {
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-h5); }
h6 { font-size: var(--fs-h6); }

p {
  max-width: 75ch;
  line-height: 1.7;
}

p,
ul,
ol,
form {
  margin-bottom: var(--space-m);
}

a {
  color: var(--clr-accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease-in-out;
}

a:hover {
  opacity: 0.8;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: var(--radius-small);
}

/*
 * =========================================
 * NAVIGATION (MOBILE-FIRST)
 * =========================================
 */
.hamburger-menu {
  display: block;
  background: none;
  color: var(--clr-btn-bg);
  border: none;
  cursor: pointer;
  padding: var(--space-s);
  border-radius: var(--radius-small);
  z-index: 1001;
}

.hamburger-menu .icon-close { display: none; }
.hamburger-menu .icon-hamburger { display: block; }

.hamburger-menu[aria-expanded="true"] .icon-close { display: block; }
.hamburger-menu[aria-expanded="true"] .icon-hamburger { display: none; }

.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.5);
  z-index: 999;
}

header.nav-open .menu-overlay {
  display: block;
  animation: fadeIn var(--transition-speed) var(--transition-ease-out);
}

nav {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 70vw;
  max-width: 300px;
  background-color: var(--clr-bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  z-index: 1000;
  padding: var(--space-l);
  transform: translateX(-100%);
  transition: transform var(--transition-speed) var(--transition-ease-out);
}

header.nav-open nav {
  transform: translateX(0);
}

body.nav-open {
  overflow: hidden;
}

nav a {
  display: block;
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius-medium);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-h5);
  color: var(--clr-text);
  transition: background-color 0.2s ease-in-out;
}

/*
 * =========================================
 * LISTS
 * =========================================
 */
ul,
ol {
  padding-left: var(--space-l);
}

li {
  margin-bottom: var(--space-s);
}

/*
 * =========================================
 * FORMS
 * =========================================
 */
form {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  /* Example of an outer "card" container */
  border: var(--border-width) solid var(--clr-border);
  border-radius: var(--radius-large);
  padding: var(--space-l);
}

form div {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

label {
  display: block;
  font-weight: 600;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--space-s) var(--space-m);
  font-size: var(--fs-m);
  border: var(--border-width) solid var(--clr-border);
  border-radius: var(--radius-medium);
  background-color: var(--clr-bg);
  color: var(--clr-text);
}

textarea {
  font-family: inherit;
  min-height: 150px;
  resize: vertical;
}

button {
  cursor: pointer;
  padding: var(--space-s) var(--space-l);
  font-size: var(--fs-m);
  font-weight: 700;
  color: var(--clr-btn-text);
  background-color: var(--clr-btn-bg);
  border: none;
  border-radius: var(--radius-medium);
  transition: opacity 0.2s ease-in-out;
  height: 2.5rem;
}

button:hover {
  opacity: 0.8;
}

.error,
span.error {
  display: block;
  color: var(--clr-error);
  font-size: var(--fs-s);
  font-weight: 600;
}

/*
 * =========================================
 * COMPONENTS (Logo, etc.)
 * =========================================
 */
.logo-link {
  text-decoration: none;
  display: block;
  z-index: 1001;
}

.logo {
  width: 32px;
  height: auto;
}

/*
 * =========================================
 * HERO SECTION
 * =========================================
 */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  text-align: center;
}

.hero__title {
  line-height: 1.1;
  font-weight: 700;
}

.hero__description {
  font-size: var(--fs-l);
  line-height: 1.6;
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
}

.hero__image-wrapper {
  display: flex;
  justify-content: center;
  order: -1;
}

.hero__image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: var(--radius-large);
}

/*
 * =========================================
 * ACCESSIBILITY & UTILITIES
 * =========================================
 */
.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;
}

/*
 * =========================================
 * DESKTOP & WIDER SCREENS
 * =========================================
 */
@media (min-width: 768px) {
  .hamburger-menu {
    display: none;
  }

  nav {
    display: flex;
    position: static;
    flex-direction: row;
    background-color: transparent;
    width: auto;
    gap: var(--space-s);
    padding: 0;
    /* FIX: Reset mobile slide-out styles */
    transform: none;
    transition: none;
  }

  nav a {
    font-size: var(--fs-m);
    padding: var(--space-s) var(--space-m);
  }

  nav a:hover,
  nav a[aria-current="page"] {
    background-color: hsl(0, 0%, 95%);
  }

  .hero {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .hero__content {
    text-align: left;
  }

  .hero__description {
    margin-left: 0;
    margin-right: 0;
  }

  .hero__image-wrapper {
    order: 0;
  }
}
