/*
 * Copperwell design system: the header and the footer of every page (src/shop/chrome).
 * Builds on base.css (tokens, type, buttons, fields); see the note on isolation there.
 *
 * The header stays at the top of the window; its height is --cw-header (base.css), which pages
 * use to start below it. On the home page, whose top is a film, it floats over the film as a
 * glass bar (as on the development site) until the page is scrolled past the film.
 */

/* The offer scrolls with the page. Its adjacent header takes over at the top of the viewport. */
#cw .cw-spend-banner {
  background: var(--cw-brown);
  color: var(--cw-cream);
  text-align: center;
}

#cw .cw-spend-banner__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.3;
}

#cw .cw-spend-banner__link:focus-visible {
  outline: 2px solid var(--cw-peach);
  outline-offset: -4px;
}

#cw .cw-spend-banner__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 16px;
  border-left: 1px solid var(--cw-copper);
  color: var(--cw-peach);
  /* The site's font is served in 300, 400 and 700 only. */
  font-weight: 700;
  white-space: nowrap;
}

#cw .cw-spend-banner__link:hover .cw-spend-banner__cta span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

#cw .cw-spend-banner__cta .cw-icon {
  width: 16px;
  height: 16px;
}

#cw .cw-spend-banner + .cw-header {
  position: sticky;
  margin-bottom: calc(0px - var(--cw-header));
}

#cw .cw-spend-banner + .cw-header[data-over]:not([data-scrolled]) {
  margin: 18px 24px calc(0px - var(--cw-header) - 18px);
}

@media (max-width: 1024px) {
  #cw .cw-spend-banner + .cw-header[data-over]:not([data-scrolled]) {
    margin: 12px 12px calc(0px - var(--cw-header) - 12px);
  }
}

@media (max-width: 480px) {
  #cw .cw-spend-banner__link {
    gap: 8px;
    font-size: 14px;
  }

  #cw .cw-spend-banner__cta {
    padding: 0;
    border: 0;
  }

  #cw .cw-spend-banner__cta span {
    display: none;
  }
}

/* ---- Header ------------------------------------------------------------------------------------ */
#cw .cw-header {
  position: fixed;
  z-index: 900;
  top: 0;
  right: 0;
  left: 0;
  height: var(--cw-header);
  border: 0 solid transparent;
  border-bottom: 1px solid var(--cw-line);
  background: var(--cw-paper);
  color: var(--cw-brown);
  transition:
    top 0.3s var(--cw-ease),
    right 0.3s var(--cw-ease),
    left 0.3s var(--cw-ease),
    border-radius 0.3s var(--cw-ease),
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

/* The logo on the left, the menu in the middle, the account and cart on the right. */
#cw .cw-header__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  max-width: calc(var(--cw-max) + 2 * var(--cw-gutter));
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--cw-gutter);
}

#cw .cw-header__logo {
  display: flex;
  align-items: center;
  justify-self: start;
  width: 180px;
  min-height: 44px;
}

#cw .cw-header__logo img {
  width: 100%;
  height: auto;
}

#cw .cw-header__nav > ul {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.4vw, 40px);
}

#cw .cw-header__link,
#cw .cw-navmenu__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.5;
  color: inherit;
  white-space: nowrap;
  transition: color 0.2s ease;
}

#cw .cw-header__link:hover,
#cw .cw-navmenu__button:hover {
  color: var(--cw-copper);
}

/* The page being shown is underlined in the menu. */
#cw .cw-header__link[aria-current='page'] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
}

#cw .cw-header__tools {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 4px;
}

#cw .cw-header__more {
  margin-right: 12px;
}

#cw .cw-header .cw-iconbtn,
#cw .cw-header .cw-cartbtn {
  color: inherit;
}

#cw .cw-header .cw-iconbtn:hover,
#cw .cw-header .cw-cartbtn:hover {
  background: rgba(80, 43, 9, 0.08);
}

#cw .cw-header .cw-cartbtn .cw-icon {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

/* The menu button belongs to tablets and phones. */
#cw .cw-header__menubtn {
  display: none;
}

/* A menu item that opens a small list of links. */
#cw .cw-navmenu {
  position: relative;
}

#cw .cw-navmenu__button .cw-icon {
  transition: transform 0.25s var(--cw-ease);
}

#cw .cw-navmenu__button[aria-expanded='true'] .cw-icon {
  transform: rotate(180deg);
}

#cw .cw-navmenu__list {
  position: absolute;
  z-index: 1;
  top: calc(100% + 10px);
  left: -16px;
  display: grid;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius-sm);
  background: var(--cw-paper);
  box-shadow: var(--cw-shadow);
  color: var(--cw-brown);
}

#cw .cw-navmenu[data-align='end'] .cw-navmenu__list {
  right: -16px;
  left: auto;
}

#cw .cw-navmenu__list a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

#cw .cw-navmenu__list a:hover,
#cw .cw-navmenu__list a[aria-current='page'] {
  background: var(--cw-sand);
}

/* Over the film of the home page: a glass bar with light text, set in from the edges. */
#cw .cw-header[data-over]:not([data-scrolled]) {
  top: 18px;
  right: 24px;
  left: 24px;
  border: 1px solid rgba(255, 248, 238, 0.22);
  border-radius: 16px;
  background: rgba(32, 24, 18, 0.42);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.09);
  color: #fff8ee;
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  backdrop-filter: blur(22px) saturate(125%);
}

#cw .cw-header[data-over]:not([data-scrolled]) .cw-header__bar {
  max-width: none;
  padding-inline: 28px;
}

#cw .cw-header[data-over]:not([data-scrolled]) :where(.cw-header__link, .cw-navmenu__button):hover {
  color: #f6c798;
}

#cw .cw-header[data-over]:not([data-scrolled]) :where(.cw-iconbtn, .cw-cartbtn):hover {
  background: rgba(255, 248, 238, 0.14);
}

#cw .cw-header[data-over]:not([data-scrolled]) :where(a, button):focus-visible {
  outline-color: #f6c798;
}

#cw .cw-header[data-over]:not([data-scrolled]) .cw-navmenu__list :where(a):focus-visible {
  outline-color: var(--cw-navy);
}

/* ---- The menu as a sheet (tablets and phones) -------------------------------------------------- */
#cw .cw-sheet {
  width: min(380px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 auto 0 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  background: var(--cw-paper);
  color: var(--cw-brown);
}

#cw .cw-sheet::backdrop {
  background: rgba(46, 26, 8, 0.45);
}

#cw .cw-sheet[open] {
  animation: cw-sheet-in 0.35s var(--cw-ease);
}

@keyframes cw-sheet-in {
  from {
    transform: translateX(-100%);
  }
}

#cw .cw-sheet__panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
  padding: 12px 20px 28px;
}

#cw .cw-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  margin-bottom: 8px;
}

#cw .cw-sheet__logo {
  width: 150px;
  height: auto;
}

#cw .cw-sheet__list {
  display: grid;
}

#cw .cw-sheet__list > li {
  border-bottom: 1px solid var(--cw-line);
}

#cw .cw-sheet__list a,
#cw .cw-sheet__group {
  display: flex;
  align-items: center;
  min-height: 56px;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

#cw .cw-sheet__group {
  min-height: 48px;
  padding-top: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cw-copper);
}

#cw .cw-sheet__sub {
  padding-bottom: 8px;
}

#cw .cw-sheet__sub a {
  min-height: 48px;
}

/* The second menu is set smaller, as the less used of the two. */
#cw .cw-sheet__list--more {
  margin-top: 16px;
}

#cw .cw-sheet__list--more > li {
  border-bottom: 0;
}

#cw .cw-sheet__list--more a {
  min-height: 44px;
  font-size: 16px;
  letter-spacing: 0;
  color: var(--cw-brown-soft);
}

#cw .cw-sheet__list a[aria-current='page'] {
  color: var(--cw-copper);
}

#cw .cw-sheet__account {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  min-height: 48px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 16px;
}

/* ---- Footer ------------------------------------------------------------------------------------ */
#cw .cw-footer {
  border-top: 1px solid var(--cw-line);
  background: var(--cw-cream);
}

#cw .cw-footer__main {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  padding-block: clamp(48px, 6vw, 88px) clamp(24px, 3vw, 36px);
}

#cw .cw-footer__main > :only-child {
  grid-column: 1 / -1;
}

#cw .cw-footer__news {
  display: grid;
  align-content: start;
  gap: 16px;
  max-width: 480px;
}

#cw .cw-footer__title {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

#cw .cw-footer__note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--cw-brown-soft);
}

/* The sign-up: the field with its button beside it. */
#cw .cw-news {
  display: grid;
  gap: 6px;
}

#cw .cw-news__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#cw .cw-news .cw-btn {
  min-height: 56px;
}

#cw .cw-footer__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-content: start;
  gap: 32px 24px;
}

#cw .cw-footer__heading {
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cw-copper);
}

#cw .cw-footer__links {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

#cw .cw-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 15px;
  line-height: 1.4;
  transition: color 0.2s ease;
}

#cw .cw-footer__links a:hover {
  color: var(--cw-copper);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Copyright and social links form the bottom row. */
#cw .cw-footer__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 20px 28px;
  border-top: 1px solid var(--cw-line);
  font-size: 13px;
  line-height: 1.5;
  color: var(--cw-brown-soft);
}

#cw .cw-footer__social {
  display: flex;
  gap: 8px;
}

#cw .cw-footer__social a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--cw-line-strong);
  border-radius: 50%;
  color: var(--cw-brown);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

#cw .cw-footer__social a:hover {
  border-color: var(--cw-brown);
  background: var(--cw-sand);
}

#cw .cw-footer__notice {
  max-width: 960px;
  margin: 0;
  padding-bottom: 20px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--cw-brown-soft);
}

/* The link beside the copyright line answers to a tap over at least 24 pixels (see .cw-link in
   base.css); the margin gives the space back, so nothing moves. */
#cw .cw-footer__base > a {
  padding-block: 4px;
  margin-block: -4px;
  transition: color 0.2s ease;
}

#cw .cw-footer__base > a:hover {
  color: var(--cw-brown);
}

/* ---- Narrower windows -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  /* The menu button on the left, the logo in the middle, the cart on the right. */
  #cw .cw-header__bar {
    grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
    gap: 12px;
  }

  #cw .cw-header__menubtn {
    display: grid;
    justify-self: start;
    margin-left: -10px;
  }

  #cw .cw-header__logo {
    justify-self: center;
    width: 150px;
  }

  #cw .cw-header__nav,
  #cw .cw-header__more,
  #cw .cw-header__account {
    display: none;
  }

  #cw .cw-header__tools {
    margin-right: -8px;
  }

  #cw .cw-header[data-over]:not([data-scrolled]) {
    top: 12px;
    right: 12px;
    left: 12px;
    border-radius: 12px;
  }

  #cw .cw-header[data-over]:not([data-scrolled]) .cw-header__bar {
    padding-inline: 16px;
  }
}

@media (max-width: 900px) {
  #cw .cw-footer__main {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  #cw .cw-header__logo {
    width: 132px;
  }

  #cw .cw-news__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  #cw .cw-header {
    transition: none;
  }

  #cw .cw-sheet[open] {
    animation: none;
  }
}
