/* ==========================================================================
   Makesquare landing page
   Implemented from Figma: OFNT / page (node 78:604)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Erode';
  src: url('assets/fonts/Erode-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Runde';
  src: url('assets/fonts/OpenRunde-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* latin */
@font-face {
  font-family: 'Chivo Mono';
  src: url('assets/fonts/ChivoMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
  font-family: 'Chivo Mono';
  src: url('assets/fonts/ChivoMono-Regular-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  --canvas: #fffffa;
  --canvas-tint: #f7f7f4;
  --surface: #ffffff;
  --ink: #413f26;
  --ink-70: rgba(65, 63, 38, 0.7);
  --ink-60: rgba(65, 63, 38, 0.6);
  --ink-10: rgba(65, 63, 38, 0.1);
  --ink-08: rgba(65, 63, 38, 0.08);
  --ink-01: rgba(65, 63, 38, 0.01);
  --highlight: rgba(65, 63, 38, 0.05); /* --ink at 5% */
  --highlight-on-dark: rgba(255, 255, 250, 0.12); /* the highlight's counterpart on --ink surfaces */
  --accent: #f7e731;
  --accent-ink: #292818;
  --on-dark: #fffffa;

  /* The live page colour, shared by the canvas and the pinned nav so they
     stay in step through the scroll tint. */
  --page-bg: var(--canvas);

  --font-display: 'Erode', Georgia, 'Times New Roman', serif;
  --font-body: 'Open Runde', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'Chivo Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-card: 16px;

  --container: 960px;
  --gutter: 24px;
  --nav-h: 80px;

  /* Strong curves keep the motion calm without making the interface sluggish. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-reveal: 650ms;
  --dur-nav: 260ms;
  --dur-feedback: 150ms;
  --dur-hover: 180ms;
  --dur-tint: 420ms;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Owns the page canvas colour so the tint transition covers the full viewport,
     including any over-scroll area. .is-tinted is toggled by app.js on scroll. */
  background-color: var(--page-bg);
  transition: background-color var(--dur-tint) var(--ease-in-out);
}

html.is-tinted {
  --page-bg: var(--canvas-tint);
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ol {
  margin: 0;
}

h1, h2, h3 {
  text-wrap: balance;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background-color: var(--highlight);
}

/* Inside the dark CTA the same 5% ink lands on its own colour and disappears,
   so selection there mirrors it with the light tone instead. */
.cta ::selection {
  background-color: var(--highlight-on-dark);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* --------------------------------------------------------------------------
   Scroll reveal
   Elements rise and fade in once, then stay put. Driven by app.js.
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* For containers whose children reveal too, without this the child travel
   stacks on top of the parent's and the group drifts twice as far. */
[data-reveal].reveal-fade {
  transform: none;
}

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 32px;
  padding: 0 12px;
  border-radius: 100px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: clip;
  transition:
    filter var(--dur-hover) var(--ease-out),
    transform var(--dur-feedback) var(--ease-out),
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms);
}

.btn:active {
  transform: scale(0.97);
}

.btn__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-ink);
  transition: transform var(--dur-hover) var(--ease-out);
}

/* Buttons fade into the page so their transform remains free for press feedback. */
[data-reveal].btn {
  transform: none;
}

[data-reveal].btn.is-revealed {
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  [data-reveal].btn.is-revealed:hover,
  .btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
  }

  .btn:hover .btn__dot {
    transform: scale(1.15);
  }
}

[data-reveal].btn.is-revealed:active,
.btn:active {
  transform: scale(0.97);
}

/* --------------------------------------------------------------------------
   Tag (eyebrow)
   -------------------------------------------------------------------------- */

.tag {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 13px;
  color: var(--ink-60);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1;
  text-transform: uppercase;
}

.tag__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 8px;
  background: var(--ink-60);
}

/* --------------------------------------------------------------------------
   Shared type
   -------------------------------------------------------------------------- */

.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 37px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

/* --------------------------------------------------------------------------
   Nav hides on scroll down, returns on scroll up
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: transparent;
  transition:
    transform var(--dur-nav) var(--ease-in-out),
    background-color var(--dur-tint) var(--ease-in-out);
}

/* Away from the top the bar needs its own ground, since content passes beneath.
   No border; the bar meets the page edge-to-edge at all times. */
.nav--pinned {
  background-color: var(--page-bg);
}

.nav--hidden {
  transform: translateY(-100%);
}

.nav-spacer {
  height: var(--nav-h);
}

.nav__inner {
  width: min(var(--container), 100% - (var(--gutter) * 2));
  margin-inline: auto;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo img {
  width: auto;
  height: 18px;
  opacity: 0.9;
  transition: opacity var(--dur-hover) var(--ease-out);
}

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

.hero {
  padding-bottom: 60px;
  overflow: clip;
}

.hero__content {
  width: min(476px, 100% - (var(--gutter) * 2));
  margin: 80px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.hero__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero__title {
  max-width: 400px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 37px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.hero__lead {
  max-width: 380px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-70);
}

.hero__illustration {
  margin-top: 80px;
  display: flex;
  justify-content: center;
}

/* Drops <picture> out of layout so the <img> stays the direct flex child and
   every rule below applies to it unchanged. */
.hero__illustration picture {
  display: contents;
}

.hero__illustration img {
  width: 732px;
  height: auto;
}

/* The illustration carries a touch more travel because it is the largest thing to settle. */
.hero__illustration[data-reveal] {
  transform: translateY(20px);
}

.hero__illustration[data-reveal].is-revealed {
  transform: none;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding-block: 60px;
}

.divider {
  height: 0;
  margin: 0 0 32px;
  border: 0;
  border-top: 1px solid var(--ink-08);
}

/* The rule draws itself in rather than sliding. */
.divider[data-reveal] {
  transform: none;
  transform-origin: left center;
  clip-path: inset(0 100% 0 0);
  transition:
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms),
    clip-path 850ms var(--ease-out) var(--reveal-delay, 0ms);
}

.divider[data-reveal].is-revealed {
  clip-path: inset(0 0 0 0);
}

.tag + .section__title,
.section__head {
  margin-top: 24px;
}

.section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
}

.section__head .section__title {
  width: 315px;
  flex: none;
}

.section__lead {
  width: 476px;
  flex: none;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-70);
}

/* --------------------------------------------------------------------------
   What we make: product cards
   -------------------------------------------------------------------------- */

.products {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.product[hidden] {
  display: none !important;
}

.product {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-card);
  background: var(--surface);
  overflow: clip;
  display: block;
}

a.product {
  transition:
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--dur-hover) var(--ease-out),
    box-shadow var(--dur-hover) var(--ease-out);
}

.product[data-reveal],
.product[data-reveal].is-revealed {
  transform: none;
}

.product__logo {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 28px;
  height: 28px;
}

.product__logo--wordmark {
  width: auto;
}

.product__text {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product__title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.product__arrow {
  width: 24px;
  height: 24px;
  flex: none;
  transition:
    opacity var(--dur-hover) var(--ease-out),
    transform var(--dur-hover) var(--ease-out);
}

/* The arrow waits until you reach for the card, then drifts up-and-out into
   place. Gated on hover-capable pointers so touch users, who have no hover
   state to trigger it, always see the affordance. */
@media (hover: hover) and (pointer: fine) {
  .nav__logo:hover img {
    opacity: 1;
  }

  a.product.is-revealed:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px -12px var(--highlight), 0 2px 8px -4px var(--highlight);
    transition:
      transform var(--dur-hover) var(--ease-out),
      box-shadow var(--dur-hover) var(--ease-out);
  }

  .product__arrow {
    opacity: 0;
    transform: translate(-4px, 4px);
  }

  a.product:hover .product__arrow,
  a.product:focus-visible .product__arrow {
    opacity: 1;
    transform: translate(0, 0);
  }
}

a.product.is-revealed:active {
  transform: scale(0.985);
  transition: transform var(--dur-feedback) var(--ease-out);
}

.product__desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-70);
}

.product--empty {
  background: var(--ink-01);
  border: 1px dashed var(--ink-10);
}

/* --------------------------------------------------------------------------
   How we make: rules card
   -------------------------------------------------------------------------- */

.rules {
  margin-top: 32px;
  display: flex;
  gap: 32px;
  padding: 32px;
  border-radius: var(--radius-card);
  background: var(--surface);
}

.rule {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  transition:
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms);
}

.rule__num {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-70);
}

.rule__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.rule__desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-70);
}

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

.footer {
  padding-block: 60px 40px;
}

.cta {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  border-radius: var(--radius-card);
  background: var(--ink);
  overflow: clip;
}

.cta__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.cta__title {
  max-width: 320px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 37px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--on-dark);
  text-wrap: balance;
}

.colophon {
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-70);
}

.colophon__links {
  display: flex;
  align-items: center;
  gap: 24px;
  line-height: 1;
}

.colophon__links a {
  position: relative;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 6px;
  transition:
    color var(--dur-hover) var(--ease-out),
    background-color var(--dur-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .colophon__links a:hover {
    color: var(--ink);
    background-color: var(--highlight);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .hero__illustration img {
    width: 100%;
    max-width: 732px;
  }
}

@media (max-width: 860px) {
  .section__head {
    flex-direction: column;
    gap: 24px;
  }

  .section__head .section__title,
  .section__lead {
    width: 100%;
  }

  .products {
    grid-template-columns: repeat(2, 1fr);
  }

  .rules {
    flex-direction: column;
  }

  .rule {
    gap: 16px;
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: 20px;
    --nav-h: 64px;
  }

  .nav__logo img {
    width: auto;
    height: 18px;
  }

  .hero__content {
    margin-top: 48px;
  }

  .hero__title,
  .section__title,
  .cta__title {
    font-size: 30px;
  }

  .hero__illustration {
    margin-top: 48px;
  }

  .section {
    padding-block: 40px;
  }

  .products {
    grid-template-columns: 1fr;
  }

  .product {
    aspect-ratio: auto;
  }

  .product__logo {
    position: static;
    margin: 24px 0 0 24px;
  }

  .product__text {
    position: static;
    margin-top: 48px;
    padding: 0 24px 24px;
  }

  .product--empty {
    min-height: 140px;
  }

  .rules {
    padding: 24px;
    gap: 24px;
  }

  .colophon {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion: keep every end state, drop the travel
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
    transition-duration: var(--dur-hover);
  }

  .nav {
    transition: background-color var(--dur-hover) var(--ease-out);
  }

  .nav--hidden {
    transform: none;
  }

  [data-reveal],
  [data-reveal].btn,
  .hero__illustration[data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .divider[data-reveal] {
    clip-path: none;
  }

  .btn:active,
  [data-reveal].btn.is-revealed:hover,
  [data-reveal].btn.is-revealed:active,
  a.product.is-revealed:hover,
  a.product.is-revealed:active,
  a.product:hover .product__arrow,
  a.product:focus-visible .product__arrow,
  .btn:hover .btn__dot,
  .product__arrow,
  .btn__dot {
    transform: none;
  }
}
