/* Canny Oven Co.
   Two flat colours and white, like the side of a van or a printed price card.
   This file: colours, type, buttons, header, hero and the before/after slider.
   sections.css: everything further down the page. */

:root {
  --yellow: #ffd21e;
  --yellow-pale: #fff4bf;
  --green: #14352f;
  --green-lift: #1f4a42;
  --white: #ffffff;
  --panel: #eff2ee;
  --line: #cdd5d0;
  --ink-soft: #46574f;

  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-space: clamp(3.5rem, 8vw, 6.5rem);
  --mobile-bar: 4rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
  scroll-padding-bottom: calc(var(--mobile-bar) + 1rem);
}

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

body {
  margin: 0;
  background: var(--white);
  color: var(--green);
  font-family: var(--font-body);
  font-size: 1.1875rem;
  line-height: 1.55;
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
p,
dl,
dd,
ul,
ol,
figure,
fieldset {
  margin: 0;
  padding: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}

h1 {
  font-size: clamp(3rem, 7.6vw, 6rem);
}

h2 {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
}

h3 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

main:focus {
  outline: none;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
}

.section__lede {
  max-width: 40rem;
  margin-top: 0.9rem;
  font-size: 1.3rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.icon {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0.7rem 1.5rem;
  border: 3px solid var(--green);
  border-radius: 6px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.btn--solid {
  background: var(--green);
  color: var(--white);
}

.btn--solid:hover {
  background: var(--green-lift);
  border-color: var(--green-lift);
}

.btn--line {
  color: var(--green);
}

.btn--line:hover {
  background: var(--green);
  color: var(--white);
}

.btn--yellow {
  border-color: var(--yellow);
  background: var(--yellow);
  color: var(--green);
}

.btn--yellow:hover {
  border-color: var(--white);
  background: var(--white);
}

/* Header and hero */

.top {
  background: var(--yellow);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand__mark {
  width: 2.75rem;
  height: 2.75rem;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-nav {
  display: none;
  gap: 1.9rem;
  font-weight: 600;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.header-phone:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.2em;
}

.hero {
  display: grid;
  gap: clamp(3rem, 5vw, 4.5rem);
  align-items: center;
  padding-block: clamp(1.75rem, 4vw, 3.5rem) clamp(3rem, 7vw, 5.5rem);
}

.hero__lede {
  max-width: 33rem;
  margin-top: 1.4rem;
  font-size: clamp(1.25rem, 1.8vw, 1.45rem);
  font-weight: 500;
  line-height: 1.45;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.hero__compare {
  position: relative;
}

.hero__compare figcaption {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  font-weight: 500;
}

/* The price sticker on the corner of the hero picture */

.sticker {
  position: absolute;
  top: -3rem;
  right: -1rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 8.5rem;
  height: 8.5rem;
  border: 3px solid var(--yellow);
  border-radius: 50%;
  background: var(--green);
  color: var(--yellow);
  font-family: var(--font-display);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(9deg);
  pointer-events: none;
}

.sticker span {
  max-width: 5.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sticker strong {
  margin-top: 0.1rem;
  font-size: 3.4rem;
  font-weight: 800;
}

/* Before and after slider */

.compare__stage {
  --pos: 50%;
  position: relative;
  aspect-ratio: 10 / 9;
  overflow: hidden;
  border: 3px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.compare__img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.compare__before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  -webkit-clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.compare__tag {
  position: absolute;
  bottom: 0.7rem;
  left: 0.7rem;
  padding: 0.3rem 0.65rem 0.25rem;
  border-radius: 4px;
  background: var(--green);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
}

.compare__tag--after {
  right: 0.7rem;
  left: auto;
  background: var(--yellow);
  color: var(--green);
}

.compare__range {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 5px;
  background: var(--yellow);
  box-shadow: 0 0 0 1.5px var(--green);
  transform: translateX(-50%);
  pointer-events: none;
}

.compare__handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: url("../images/grip.svg") center / contain no-repeat;
  transform: translate(-50%, -50%);
}

.compare__range:focus-visible + .compare__handle::after {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--white);
}

/* The four promises under the hero */

.promises {
  background: var(--green);
  color: var(--white);
}

.promises ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1.5rem;
  padding-block: 1.25rem;
  list-style: none;
  font-weight: 600;
  line-height: 1.3;
}

.promises li {
  position: relative;
  padding-left: 1.6rem;
}

.promises li::before {
  content: "";
  position: absolute;
  top: 0.3em;
  left: 0.1rem;
  width: 0.5rem;
  height: 0.85rem;
  border: solid var(--yellow);
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}

@media (min-width: 58rem) {
  .site-nav {
    display: flex;
  }

  .hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  }

  .promises ul {
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
  }
}

@media (max-width: 30rem) {
  .header-phone span {
    display: none;
  }

  .header-phone {
    padding: 0.55rem;
    border: 3px solid currentColor;
    border-radius: 6px;
  }

  .brand__name {
    font-size: 1.5rem;
  }

  .sticker {
    top: -1.75rem;
    right: -0.4rem;
    width: 7rem;
    height: 7rem;
  }

  .sticker span {
    font-size: 0.9rem;
  }

  .sticker strong {
    font-size: 2.7rem;
  }
}

/* Older phones without aspect-ratio: hold the picture's shape with padding instead. */
@supports not (aspect-ratio: 1) {
  .compare__stage::before {
    content: "";
    display: block;
    padding-top: 90%;
  }

  .portfolio .compare__stage::before {
    padding-top: 75%;
  }
}
