:root {
  --sand: #7a6a5a;
  --white: #fff;
  --cream: #f1e6d6;
  --gold: #c9a98a;

  --font-logo: "League Spartan", system-ui, sans-serif;
  --font-sub: "Nunito Sans", system-ui, sans-serif;
  --font-body: var(--font-sub);
  --font-serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;

  --shadow-text: 0 1px 12px rgb(40 28 18 / 0.35);
  --shadow-body: 0 1px 3px rgb(40 28 18 / 0.45), 0 0 16px rgb(40 28 18 / 0.3);
  --overlay: rgb(70 48 30 / 0.32);

  --space-s: 0.5rem;
  --space-m: 1rem;
  --space-l: 2rem;
  --space-xl: 4rem;

  --text-measure: 34rem;
}

html,
body {
  margin: 0;
}

/* Each scroll lands on the start of a section. Sections taller than the screen
   (section 2 on phones) can still be scrolled through before snapping on. */
html {
  scroll-snap-type: y mandatory;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.hero,
.about {
  box-sizing: border-box;
  scroll-snap-align: start;
}

/* ---------- Section 1: hero ---------- */

/*
  Keeping the text off the socks
  ------------------------------
  The photo fills the screen (background-size: cover), so how far down the socks
  appear depends on the screen's shape. We calculate it:

    --photo-h   height the photo is drawn at (cover scales it to fill the screen)
    --sock-top  where the sock cuffs start in the photo, as a fraction of its
                height (measured, minus a small safety margin)
    --socks-y   where the sock cuffs land on screen, for a vertically centred photo:
                screen centre - (photo centre - sock line) * photo height

  The text sits just above --socks-y (--gap above the cuffs) and scales with the
  space above them, so it can never reach the socks.
*/
.hero {
  --vh: 100vh;
  --photo-h: max(var(--vh), 100vw * 1672 / 941); /* portrait photo: 941 x 1672 */
  --sock-top: 0.59;                              /* sock cuffs at 61% */
  --socks-y: calc(var(--vh) / 2 - (0.5 - var(--sock-top)) * var(--photo-h));
  --gap: 1.5rem;                                 /* breathing room above the socks */
  --text-area: calc(var(--socks-y) - var(--gap) - var(--space-m));

  height: var(--vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  /* the bottom padding covers the socks, so the text sits just above them */
  padding: var(--space-m) var(--space-m) calc(var(--vh) - var(--socks-y) + var(--gap));
  background: var(--sand) url(../assets/images/blurry-main-pic-vertical.webp) center / cover no-repeat;
  text-align: center;
  text-shadow: var(--shadow-text);
}

@supports (height: 100dvh) {
  /* phones: follow the visible height as the address bar shows and hides */
  .hero {
    --vh: 100dvh;
  }
}

.hero__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  color: var(--white);
  font-weight: 700;
}

.hero__wordmark {
  font-family: var(--font-logo);
  /* scales with the screen width and with the space above the socks */
  font-size: clamp(2.5rem, min(24vw, 0.42 * var(--text-area)), 11rem);
  line-height: 0.75;
  letter-spacing: -0.02em;
}

.hero__sub {
  font-family: var(--font-sub);
  font-size: clamp(0.8rem, 2.4vw, 1.1rem);
  letter-spacing: -0.01em;
  margin-top: 0;
}

.hero__tagline {
  margin: clamp(0.75rem, 0.15 * var(--text-area), 9rem) 0 0;
  color: var(--cream);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(0.85rem, 2.6vw, 1.5rem);
  text-transform: uppercase;
  letter-spacing: 0.25em;
}

@media (min-width: 40rem) {
  .hero__tagline {
    letter-spacing: 0.4em;
  }
}

/* Wider-than-tall screens (desktop, tablets held sideways) get the landscape photo */
@media (orientation: landscape) {
  .hero {
    --photo-h: max(var(--vh), 100vw * 941 / 1672); /* landscape photo: 1672 x 941 */
    --sock-top: 0.49;                              /* sock cuffs at 51% */
    background-image: url(../assets/images/blurry-main-logo-landscape.webp);
  }
}

/* ---------- Section 2: our story ---------- */

.about {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: var(--space-l) var(--space-m);
  /* The tint keeps white text readable on the pale photo */
  background:
    linear-gradient(var(--overlay), var(--overlay)),
    var(--gold) url(../assets/images/blurry-logo-gold-vertical.webp) center / cover no-repeat;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  text-shadow: var(--shadow-body);
}

/* Phones: a big, stepped statement that fills the width */
.about__tagline {
  margin: 0;
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 0.85;
  text-transform: uppercase;
}

.about__tagline span {
  display: block;
}

.about__tagline span:nth-child(2) { padding-left: 0.6em; }
.about__tagline span:nth-child(3) { padding-left: 1.2em; }

.about__block {
  max-width: var(--text-measure);
}

.about h2 {
  margin: 0 0 var(--space-m);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.about p {
  margin: 0 0 var(--space-m);
}

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

/*
  Phones: Our Story and Our Mission sit side by side and are swiped through
  sideways. Each card is the full width of the page (same side margins as the
  rest of the text) and snaps to the centre. The dots below show which card
  is showing. Cards + dots are centred vertically in the space below the tagline.
*/
.about__slides {
  display: flex;
  align-items: flex-start;
  /* gap = both side margins, so one swipe moves exactly one screen width */
  gap: calc(2 * var(--space-m));
  margin: auto calc(-1 * var(--space-m)) 0;
  padding-inline: var(--space-m);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.about__slides::-webkit-scrollbar {
  display: none;
}

.about__slides > * {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.about__slides:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: -2px;
}

.about__dots {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  /* with the auto top margin on .about__slides, this centres cards + dots
     vertically between the tagline and the contact links */
  margin-top: -0.75rem;
  margin-bottom: auto;
}

.about__dot {
  /* the button is a 24px tap target; the visible dot is drawn inside it */
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.about__dot::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border: 1px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(40 28 18 / 0.45);
}

.about__dot[aria-current="true"]::before {
  background: var(--white);
}

.about__dot:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 0;
  border-radius: 50%;
}

.about__contact address {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-style: normal;
}

/* Social links: Instagram + TikTok icons on one line, then the shared handle */
.about__socials {
  display: flex;
  align-items: center;
}

.about__contact .about__social {
  display: inline-flex;
  /* padding keeps a ~24px tap target around the small icon; it also sets the
     ~5px spacing between the icons and before the handle */
  padding: 0.2rem 0.15rem;
}

.about__social:first-child {
  margin-left: -0.15rem;
}

.about__socials span {
  margin-left: 0.15rem;
}

.about__icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgb(40 28 18 / 0.45));
}

.about a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

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

@media (orientation: landscape) {
  .about {
    background-image:
      linear-gradient(var(--overlay), var(--overlay)),
      url(../assets/images/blurry-logo-gold-landscape.webp);
  }
}

/* Tablet and up: lay the text out around the logo like the mockup */
@media (min-width: 48rem) {
  /* no swiping on bigger screens: the cards go back into the grid */
  .about__slides {
    display: contents;
  }

  .about__dots {
    display: none;
  }

  .about {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-rows: auto 1fr auto;
    column-gap: var(--space-xl);
    row-gap: var(--space-l);
    padding: var(--space-xl) clamp(var(--space-l), 5vw, 6rem);
  }

  /* Same stepped tagline as on phones, scaled to the screen */
  .about__tagline {
    grid-area: 1 / 1;
    font-size: clamp(2rem, 3.6vw, 4.5rem);
  }

  .about__story {
    grid-area: 1 / 2;
  }

  .about__mission {
    grid-area: 3 / 2;
    justify-self: end;
    align-self: end;
    margin-top: 0;
  }

  .about__contact {
    grid-area: 3 / 1;
    align-self: end;
  }
}

/*
  Wide screens: keep the text off the dark logo
  ---------------------------------------------
  The landscape photo fills the screen (background-size: cover), so it is drawn
  at least as wide as the screen and the logo always sits in the middle. In the
  photo the logo (with its blur) spans roughly 31%–69% of the width, so the
  middle grid column is kept empty at that width and the text goes either side:
    --img-w   width the photo is drawn at (landscape photo: 1672 x 941)
    --logo-w  width of the logo on screen
    --dot-y   where the bottom of the logo's dot lands on screen (it sits at
              ~63% of the photo's height; 64.5% leaves room for the blur)
*/
@media (min-width: 48rem) and (orientation: landscape) {
  .about {
    --img-w: max(100vw, 100vh * 1672 / 941);
    --img-h: max(100vh, 100vw * 941 / 1672);
    --logo-w: calc(var(--img-w) * 0.38);
    --dot-y: calc(50vh + (0.645 - 0.5) * var(--img-h));

    grid-template-columns: minmax(0, 1fr) var(--logo-w) minmax(0, 1fr);
    column-gap: 0;
  }

  .about__story {
    grid-area: 1 / 3 / 2 / 4;
  }

  /* Mission starts just below the logo's dot (measured from the section's top padding) */
  .about__mission {
    grid-area: 1 / 3 / 4 / 4;
    justify-self: start;
    align-self: start;
    margin-top: calc(var(--dot-y) - var(--space-xl));
  }
}

/* Smaller landscape screens (e.g. tablets held sideways): the side columns are
   narrow, so tighten things up to keep the section within one screen height
   (if it grows taller, the photo scales up and the logo spreads under the text) */
@media (min-width: 48rem) and (max-width: 75rem) and (orientation: landscape) {
  .about {
    padding-inline: var(--space-l);
    font-size: 0.9rem;
  }

  .about h2 {
    font-size: 1.1rem;
  }
}

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