/* Home page (macroshred.com/) and the free macro calculator.
   Loads after styles.css and uses its color, font and spacing variables. */

/* ---------- Header with section links ---------- */

.site-header--home {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 248, 248, 0.94);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}

.site-header--home .site-header__inner {
  padding-block: 16px;
}

.site-header--home a {
  display: block;
}

.site-nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 32px);
}

.site-nav a {
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-2);
}

.site-nav a:hover {
  color: var(--red-text);
}

.site-nav a:focus-visible,
.site-footer__nav a:focus-visible,
.about__story:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

.site-nav a[aria-current="page"] {
  color: var(--red-text);
}

/* Phones: logo on top, the four page links in a row under it */
@media (max-width: 720px) {
  .site-header--home .site-header__inner {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-block: 12px 10px;
  }

  .site-nav {
    gap: 16px;
    justify-content: center;
  }

  .site-nav a {
    font-size: 15px;
    white-space: nowrap;
  }
}

/* Anchored sections land below the sticky header */
#newsletter,
#cheat-sheet,
#why-macros,
#about {
  scroll-margin-top: 64px;
}

/* ---------- Hero ---------- */

.home-hero {
  background: var(--white);
}

.home-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  padding-block: clamp(40px, 7vw, 104px);
}

.home-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(64px, 10vw, 140px);
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.home-hero__lede {
  margin: 24px 0 0;
  max-width: 28em;
  font-size: clamp(20px, 1.6vw, 23px);
  color: var(--text-2);
}

.home-hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.home-hero__buttons .btn--outline {
  min-height: 60px;
}

.home-hero__plate {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  justify-self: center;
}

@media (max-width: 820px) {
  .home-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
  }

  .home-hero__lede {
    margin-inline: auto;
  }

  .home-hero__buttons {
    justify-content: center;
  }

  .home-hero__plate {
    max-width: 340px;
  }
}

@media (max-width: 420px) {
  .home-hero__buttons .btn {
    width: 100%;
  }
}

/* ---------- Newsletter ---------- */

.newsletter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding-block: var(--section-pad);
}

.newsletter .h2 {
  max-width: 12em;
}

.newsletter__text {
  margin: 20px 0 0;
  max-width: 28em;
  font-size: 20px;
  color: var(--text-2);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 48px;
  margin: 32px 0 0;
}

.stats__item {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-3);
}

.stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 4.4vw, 60px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--red);
}

.newsletter__form {
  padding: clamp(22px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--white);
}

.newsletter__form-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
}

.beehiiv-embed {
  display: block;
  /* Beehiiv's embed.js sets the height to fit the form, and a fixed 560px width: keep it inside the card */
  width: 100% !important;
  max-width: 100%;
  min-height: 62px;
  margin: 0;
  border: 0;
  background: transparent;
}

.newsletter__link {
  margin: 14px 0 0;
  font-size: 17px;
  color: var(--text-3);
}

.newsletter__link a {
  font-weight: 600;
  color: var(--red-text);
  text-underline-offset: 3px;
}

@media (max-width: 820px) {
  .newsletter {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Cheat sheet offer ---------- */

.sheet-offer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
  align-items: start;
  gap: clamp(32px, 5vw, 72px);
  padding-block: var(--section-pad);
}

.sheet-offer .h2 {
  max-width: 12em;
}

.sheet-offer__lede {
  margin: 18px 0 0;
  font-size: clamp(20px, 1.6vw, 23px);
  font-weight: 600;
  color: var(--text-2);
}

.sheet-offer__tablet {
  width: min(100%, 300px);
  margin: 40px 0 0 4px;
}

.benefits--light {
  margin-top: 48px;
}

.benefits--light svg {
  background: var(--charcoal);
  stroke: var(--white);
}

.sheet-offer__form {
  margin-top: 0;
  position: sticky;
  top: 88px;
}

@media (max-width: 900px) {
  .sheet-offer {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }

  .sheet-offer .h2 {
    margin-inline: auto;
  }

  .sheet-offer__copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .sheet-offer__tablet {
    margin-inline: auto;
  }

  .sheet-offer__form {
    position: static;
  }
}

/* ---------- Why macros ---------- */

.why-macros {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(36px, 5vw, 72px);
  padding-block: var(--section-pad);
}

.why-macros .h2 {
  max-width: 11em;
}

.why-macros__copy p {
  margin: 20px 0 0;
  max-width: 30em;
  font-size: 20px;
  color: var(--ink-text);
}

.macro-tiles {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.macro-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 18px;
  border-radius: 18px;
  color: var(--ink);
}

.macro-tile--protein { background: var(--red); color: var(--white); }
.macro-tile--carbs { background: var(--amber); }
.macro-tile--fats { background: var(--orange); }

.macro-tile__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.macro-tile__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(64px, 7vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.macro-tile__unit {
  font-size: 16px;
  font-weight: 600;
}

@media (max-width: 820px) {
  .why-macros {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .macro-tile {
    padding: 16px 12px;
  }

  .macro-tile__name {
    font-size: 18px;
  }

  .macro-tile__unit {
    font-size: 14px;
  }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
  padding-block: var(--section-pad);
}

.about__photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
}

.about__copy p {
  margin: 20px 0 0;
  max-width: 34em;
  font-size: 19px;
  color: var(--text-2);
}

.about__facts {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.about__facts li {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.about__facts strong {
  font-family: var(--font-display);
  font-size: 22px;
}

.about__facts span {
  font-size: 16px;
  color: var(--text-3);
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 32px;
}

.about__story {
  font-weight: 600;
  color: var(--red-text);
  text-underline-offset: 3px;
}

@media (max-width: 820px) {
  .about {
    grid-template-columns: minmax(0, 1fr);
  }

  .about__photo {
    max-width: 440px;
    margin-inline: auto;
  }
}

@media (max-width: 420px) {
  .about__links .btn {
    width: 100%;
  }
}

/* ---------- Footer links ---------- */

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.site-footer__nav a {
  font-size: 17px;
  font-weight: 600;
  color: var(--paper);
  text-underline-offset: 3px;
}

.site-footer__nav a:hover {
  color: var(--amber);
}

/* ---------- Macro calculator ---------- */

.calc-page {
  padding-block: clamp(32px, 5vw, 72px) var(--section-pad);
}

.calc-page__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(42px, 5.6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.calc-page__lede {
  margin: 16px 0 0;
  max-width: 34em;
  font-size: 20px;
  color: var(--text-2);
}

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
  margin-top: clamp(28px, 4vw, 48px);
}

.calc__form,
.calc__result {
  padding: clamp(20px, 3vw, 32px);
  border-radius: 22px;
}

.calc__form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border: 1px solid var(--line);
  background: var(--white);
}

.calc__group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.calc__label,
.calc__group legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
}

.calc__row {
  display: flex;
  gap: 10px;
}

.calc__row > * {
  flex: 1 1 0;
  min-width: 0;
}

/* Segmented buttons (sex, units, goal) */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg label {
  flex: 1 1 0;
  min-width: 0;
}

.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
  font-size: 17px;
  text-align: center;
  cursor: pointer;
}

.seg input:checked + span {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
}

.seg input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

.calc__input {
  position: relative;
}

.calc__input input,
.calc__select {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--charcoal);
  font: inherit;
  font-size: 18px;
  font-weight: 500;
}

.calc__input input {
  padding-right: 44px;
}

.calc__input input:focus,
.calc__select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: var(--focus-ring);
}

.calc__unit {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-4);
  pointer-events: none;
}

.calc__error {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--red-text);
}

.calc__result {
  position: sticky;
  top: 88px;
  background: var(--ink);
  box-shadow: var(--shadow-dark);
  color: var(--white);
}

.calc__result-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
}

.calc__calories {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(56px, 6vw, 80px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.calc__calories small {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-text);
}

.calc__bar {
  display: flex;
  height: 14px;
  margin: 22px 0 0;
  overflow: hidden;
  border-radius: 7px;
  background: #333;
}

.calc__bar span {
  display: block;
  height: 100%;
  transition: width 0.3s ease;
}

.calc__bar .is-protein { background: var(--red); }
.calc__bar .is-carbs { background: var(--amber); }
.calc__bar .is-fats { background: var(--orange); }

.calc__macros {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calc__macros li {
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  border-radius: 14px;
  background: #262626;
  border-top: 4px solid;
}

.calc__macros .is-protein { border-color: var(--red); }
.calc__macros .is-carbs { border-color: var(--amber); }
.calc__macros .is-fats { border-color: var(--orange); }

.calc__macro-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-text);
}

.calc__macro-grams {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.1;
}

.calc__macro-kcal {
  font-size: 15px;
  color: #A8A8A8;
}

.calc__note {
  margin: 18px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: #A8A8A8;
}

.calc__cta {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--ink-line);
}

.calc__cta p {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--ink-text);
}

.calc-how {
  max-width: 46em;
  margin-top: clamp(40px, 5vw, 72px);
}

.calc-how h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.02em;
}

.calc-how p,
.calc-how li {
  font-size: 18px;
  color: var(--text-2);
}

.calc-how ul {
  padding-left: 22px;
}

@media (max-width: 820px) {
  .calc {
    grid-template-columns: minmax(0, 1fr);
  }

  .calc__result {
    position: static;
  }
}

@media (max-width: 420px) {
  .calc__macros {
    gap: 6px;
  }

  .calc__macros li {
    padding: 12px 8px;
  }
}

/* ---------- "Read more" links to the full pages ---------- */

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--red-text);
  text-decoration: none;
}

.read-more:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.read-more::after {
  content: "\2192";
}

.read-more:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

.read-more--light {
  margin-top: 24px;
  color: var(--white);
}

.newsletter > .read-more {
  grid-column: 1 / -1;
  justify-self: start;
}

.sheet-offer__copy .read-more {
  margin-top: 32px;
}

/* ---------- Site pages: newsletter, why macros, about ---------- */

.page-hero {
  background: var(--white);
  border-bottom: 1px solid var(--line-soft);
}

.page-hero__inner {
  padding-block: clamp(48px, 7vw, 104px);
}

.page-hero__title {
  margin: 0;
  max-width: 14em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.page-hero__lede {
  margin: 22px 0 0;
  max-width: 34em;
  font-size: clamp(20px, 1.6vw, 23px);
  color: var(--text-2);
}

.page-section {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 56px);
  padding-block: var(--section-pad);
}

.page-section__lede {
  margin: 0;
  max-width: 34em;
  font-size: 20px;
  color: var(--text-2);
}

.page-split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: clamp(28px, 5vw, 80px);
}

.page-split .page-section__lede {
  margin-top: 20px;
}

.page-copy p {
  margin: 0 0 18px;
  font-size: 20px;
  color: var(--text-2);
}

@media (max-width: 820px) {
  .page-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.issues {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.issues a {
  display: grid;
  grid-template-columns: 9em minmax(0, 1fr);
  gap: 6px 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.issues time {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-4);
  padding-top: 3px;
}

.issues span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.3;
}

.issues a:hover span {
  color: var(--red-text);
}

.issues a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .issues a {
    grid-template-columns: minmax(0, 1fr);
  }
}

.topic-list,
.story {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topic-list li,
.story li {
  font-size: 19px;
  color: var(--text-2);
}

.topic-list strong,
.story strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--charcoal);
}

.story {
  counter-reset: story;
  gap: 0;
}

.story li {
  position: relative;
  padding: 0 0 26px 44px;
  border-left: 2px solid var(--line);
  margin-left: 13px;
  padding-left: 30px;
}

.story li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.story li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px var(--white);
}

.macro-roles {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.macro-role {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-top: 8px solid;
}

.macro-role--protein { border-top-color: var(--red); }
.macro-role--carbs { border-top-color: var(--amber); }
.macro-role--fats { border-top-color: var(--orange); }

.macro-role__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.macro-role__unit {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-3);
}

.macro-role h3 {
  margin: 18px 0 6px;
  font-family: var(--font-display);
  font-size: 26px;
}

.macro-role p {
  margin: 0;
  font-size: 18px;
  color: var(--text-2);
}

@media (max-width: 820px) {
  .macro-roles {
    grid-template-columns: minmax(0, 1fr);
  }
}

.math {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  font-size: 20px;
}

.math th,
.math td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.math th {
  font-family: var(--font-display);
  font-weight: 700;
}

.math th .dot {
  margin-right: 10px;
}

.math td {
  color: var(--text-2);
}

.math td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--charcoal);
}

.math tfoot th,
.math tfoot td,
.math tfoot td:last-child {
  border-bottom: 0;
  background: var(--charcoal);
  color: var(--white);
}

@media (max-width: 420px) {
  .math {
    font-size: 17px;
  }

  .math th,
  .math td {
    padding: 14px 12px;
  }
}

.page-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-block: var(--section-pad);
  text-align: center;
}

.page-cta p {
  margin: 0;
  font-size: 20px;
  color: var(--ink-text);
}

/* ---------- Newsletter page ---------- */

.nl-hero {
  background: var(--white);
  border-bottom: 1px solid var(--line-soft);
}

.nl-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(56px, 8vw, 112px);
  text-align: center;
}

.nl-hero .page-hero__title,
.nl-hero .page-hero__lede {
  margin-inline: auto;
}

.nl-hero__form {
  width: 100%;
  max-width: 560px;
  margin-top: 32px;
}

.nl-hero__cover {
  display: block;
  width: 100%;
  max-width: 980px;
  height: auto;
  margin-top: clamp(48px, 6vw, 72px);
  border-radius: 24px;
}

.post-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(40px, 4vw, 56px) clamp(20px, 2.4vw, 32px);
}

.post-card a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.post-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  background: var(--line-soft);
}

.post-card time {
  margin-top: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-4);
}

.post-card h3 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.post-card p {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-3);
}

.post-card a:hover h3 {
  color: var(--red-text);
}

.post-card a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 6px;
  border-radius: 16px;
}

.page-section__more {
  align-self: center;
}

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .post-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Photo at the top of the home page's "Join free" card */
.newsletter__photo {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 24px;
  border-radius: 14px;
}
