/* ==========================================================================
   Manny Orozco — SEO Specialist
   ========================================================================== */

:root {
  --color-primary: #333333;
  --color-secondary: #F3F5F4;
  --color-background: #FFFFFF;
  --color-text: #333333;
  --color-rule: #E7E7E7;

  --font-base: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-image: 0 1px 1px 0 rgba(0, 0, 0, 0.1), 0 0 5px 1px rgba(0, 0, 0, 0.03);
  --radius: 0.5rem;

  --max-width: 1024px;
  --gutter: 1.5rem;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, p, ul {
  margin: 0;
}

ul {
  list-style: none;
  padding: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease);
}

a:hover {
  text-decoration: none;
}

/* Respect reduced motion preferences */
@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;
  }
}

html {
  scroll-behavior: smooth;
  /* --header-offset is set from script.js to the sticky breadcrumb
     header's actual rendered height (plus a small buffer), so anchor
     jumps and smooth-scrolls land consistently instead of over/under
     shooting when the header's height changes across breakpoints. */
  scroll-padding-top: var(--header-offset, 7rem);
}

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

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.rule {
  border: none;
  border-top: 1px solid var(--color-rule);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.desktop-break {
  display: none;
}

@media (min-width: 768px) {
  .desktop-break {
    display: block;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: static; /* index page header bar is not sticky */
  background-color: var(--color-background);
  padding-block: 1.75rem;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.75rem;
  font-weight: 500; /* index page only — case study pages keep their own weight */
  margin: 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-block: 2.5rem 4rem;
  text-align: center;
}

.hero__wrap {
  max-width: 45rem;
}

.hero p {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
}

.hero__actions {
  margin-top: 2rem;
}

/* ==========================================================================
   Button
   ========================================================================== */

.btn {
  display: inline-block;
  background-color: var(--color-primary);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  padding: 0.9rem 1.5rem;
  text-decoration: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--color-secondary);
  color: var(--color-primary);
  text-decoration: none;
}

/* ==========================================================================
   Case studies
   ========================================================================== */

.case-studies {
  padding-block: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 4.5rem;
}

.case-study {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  align-items: center;
}

.case-study__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow-image);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.case-study__media a {
  display: block;
  width: 100%;
  height: 100%;
}

.case-study__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center; /* same as 50% 50% */
}

.case-study__media:hover,
.case-study__media:has(a:focus-visible) {
  transform: scale(1.04);
  box-shadow: var(--shadow-image);
}

.case-study__body {
  width: 100%;
}

.case-study__title {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
}

.case-study__desc {
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--color-text);
}

@media (min-width: 768px) {
  .case-study {
    flex-direction: row;
    align-items: center;
    gap: 3.5rem;
  }

  .case-study__media,
  .case-study__body {
    width: 50%;
    flex: 1 1 50%;
  }

  /* Alternate media side: odd studies show text left / image right */
  .case-study:nth-child(odd) {
    flex-direction: row-reverse;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding-block: 3.5rem 2.5rem;
}

.footer-groups {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-bottom: 3.5rem;
}

.footer-group {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.footer-group h2,
.footer-group__title {
  font-size: 1.75rem;
  font-weight: 500;
  flex: 0 0 auto;
}

.footer-group p {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--color-text);
}

.footer-group ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 1.75rem;
  font-weight: 500;
}

@media (min-width: 640px) {
  .footer-group {
    flex-direction: row;
    align-items: baseline;
    gap: 2.5rem;
  }

  .footer-group h2,
  .footer-group__title {
    width: 30%;
    flex: 0 0 30%;
  }

  .footer-group p:not(.footer-group__title),
  .footer-group ul {
    flex: 1 1 auto;
    max-width: none;
    text-align: left;
  }
}

.copyright {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--color-text);
  margin-top: 2.5rem;
}


/* ==========================================================================
   Mobile type scale
   ========================================================================== */

@media (max-width: 640px) {
  .site-title,
  .hero p,
  .case-study__title,
  .footer-group h2,
  .footer-group__title,
  .footer-group ul {
    font-size: 1.375rem;
  }

  .case-study__desc,
  .footer-group p:not(.footer-group__title) {
    font-size: 1.1rem;
  }
}
