/*
 * Copyright 2020 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

/*
 * Futkar design tokens.
 * Warm paper ground, ink text, one terracotta accent. Neutrals are tinted toward the accent's hue
 * so nothing on the page is a dead grey. Set in OKLCH so light and dark steps stay perceptually even.
 */
:root {
  /* colors (names kept from the boilerplate: blocks read them) */
  --background-color: oklch(97.6% 0.009 75deg);
  --light-color: oklch(94.6% 0.014 70deg);
  --dark-color: oklch(40% 0.02 55deg);
  --text-color: oklch(23% 0.018 55deg);
  --link-color: oklch(50% 0.145 42deg);
  --link-hover-color: oklch(41% 0.13 40deg);

  /* futkar */
  --surface-color: oklch(99% 0.005 75deg);
  --border-color: oklch(87.5% 0.018 65deg);
  --muted-color: oklch(45% 0.022 55deg);
  --selection-color: oklch(88% 0.06 50deg);
  --focus-ring: 0 0 0 3px var(--background-color), 0 0 0 5px var(--link-color);

  /* fonts: Martel for display, Mukta for reading */
  --body-font-family: mukta, mukta-fallback, sans-serif;
  --heading-font-family: martel, martel-fallback, serif;

  /* body sizes */
  --body-font-size-l: 1.25rem;
  --body-font-size-m: 1.125rem;
  --body-font-size-s: 1rem;
  --body-font-size-xs: 0.9375rem;

  /* heading sizes: fluid between phone and desktop, display capped well under 6rem */
  --heading-font-size-xxl: clamp(3rem, 1.9rem + 4.6vw, 5.25rem);
  --heading-font-size-xl: clamp(2rem, 1.55rem + 1.9vw, 2.75rem);
  --heading-font-size-l: clamp(1.625rem, 1.35rem + 1.1vw, 2.125rem);
  --heading-font-size-m: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  --heading-font-size-s: 1.25rem;
  --heading-font-size-xs: 1.125rem;

  /* layout */
  --page-width: 1120px;
  --page-gutter: 24px;
  --section-space: clamp(48px, 2rem + 3vw, 88px);
  --measure: 66ch;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* nav height */
  --nav-height: 72px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: oklch(18.5% 0.012 55deg);
    --light-color: oklch(22% 0.014 55deg);
    --dark-color: oklch(82% 0.015 70deg);
    --text-color: oklch(93% 0.012 75deg);
    --link-color: oklch(74% 0.13 48deg);
    --link-hover-color: oklch(83% 0.1 55deg);
    --surface-color: oklch(21% 0.013 55deg);
    --border-color: oklch(33% 0.016 55deg);
    --muted-color: oklch(75% 0.018 65deg);
    --selection-color: oklch(40% 0.08 45deg);
  }
}

@media (width >= 900px) {
  :root {
    --page-gutter: 40px;
  }
}

/* fallback fonts, metric-matched so the swap to the web fonts doesn't reflow the page */
@font-face {
  font-family: martel-fallback;
  font-weight: 700;
  size-adjust: 116.8%;
  ascent-override: 96.8%;
  descent-override: 48%;
  line-gap-override: 0%;
  src: local('Times New Roman Bold'), local('TimesNewRomanPS-BoldMT'), local('Liberation Serif Bold');
}

@font-face {
  font-family: mukta-fallback;
  size-adjust: 91.7%;
  ascent-override: 123.2%;
  descent-override: 57.8%;
  line-gap-override: 0%;
  src: local('Arial'), local('ArialMT'), local('Liberation Sans');
}

body {
  display: none;
  margin: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--body-font-family);
  font-size: var(--body-font-size-m);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizelegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--link-color);
  scrollbar-color: var(--border-color) var(--background-color);
}

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

:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--focus-ring);
}

strong,
b {
  font-weight: 600;
}

body.appear {
  display: block;
}

header {
  height: var(--nav-height);
}

header .header,
footer .footer {
  visibility: hidden;
}

header .header[data-block-status="loaded"],
footer .footer[data-block-status="loaded"] {
  visibility: visible;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 1.6em;
  margin-bottom: 0.5em;
  font-family: var(--heading-font-family);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  scroll-margin: 40px;
}

h1 { font-size: var(--heading-font-size-xxl); }
h2 { font-size: var(--heading-font-size-xl); }
h3 { font-size: var(--heading-font-size-l); }
h4 { font-size: var(--heading-font-size-m); }
h5 { font-size: var(--heading-font-size-s); }
h6 { font-size: var(--heading-font-size-xs); }

p,
dl,
ol,
ul,
pre,
blockquote {
  margin-top: 0;
  margin-bottom: 1em;
}

p,
li,
dd,
blockquote {
  max-width: var(--measure);
  text-wrap: pretty;
}

code,
pre {
  font-size: var(--body-font-size-s);
}

pre {
  padding: 16px;
  border-radius: 8px;
  background-color: var(--light-color);
  overflow-x: auto;
  white-space: pre;
}

main > div {
  margin: 40px var(--page-gutter);
}

input,
textarea,
select,
button {
  font: inherit;
}

/* links */
a:any-link {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: break-word;
  transition: color 0.2s var(--ease-out), text-decoration-color 0.2s var(--ease-out);
}

a:hover {
  color: var(--link-hover-color);
  text-decoration-thickness: 2px;
}

/* buttons */
p.button-wrapper {
  margin: 12px 0;
}

a.button:any-link,
button.button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 2.4em;
  padding: 0.5em 1.2em;
  font: inherit;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.button[aria-disabled="true"],
button.button:disabled {
  cursor: not-allowed;
  pointer-events: none;
}

a.button.primary,
button.button.primary {
  border-color: var(--text-color);
  background-color: var(--text-color);
  color: var(--background-color);
}

a.button.primary:hover,
a.button.primary:focus-visible,
button.button.primary:hover,
button.button.primary:focus-visible {
  border-color: var(--dark-color);
  background-color: var(--dark-color);
  color: var(--light-color);
}

a.button.primary[aria-disabled="true"],
a.button.primary[aria-disabled="true"]:hover,
a.button.primary[aria-disabled="true"]:focus-visible,
button.button.primary:disabled,
button.button.primary:disabled:hover,
button.button.primary:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

a.button.secondary,
button.button.secondary {
  border-color: var(--text-color);
  background-color: transparent;
  color: var(--text-color);
}

a.button.secondary:hover,
a.button.secondary:focus-visible,
button.button.secondary:hover,
button.button.secondary:focus-visible {
  border-color: var(--dark-color);
  background-color: var(--light-color);
  color: var(--dark-color);
}

a.button.secondary[aria-disabled="true"],
a.button.secondary[aria-disabled="true"]:hover,
a.button.secondary[aria-disabled="true"]:focus-visible,
button.button.secondary:disabled,
button.button.secondary:disabled:hover,
button.button.secondary:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

/* high-impact call-to-action */
a.button.accent,
button.button.accent {
  border-color: var(--link-color);
  background-color: var(--link-color);
  color: var(--background-color);
}

a.button.accent:hover,
a.button.accent:focus-visible,
button.button.accent:hover,
button.button.accent:focus-visible {
  border-color: var(--link-hover-color);
  background-color: var(--link-hover-color);
}

a.button.accent[aria-disabled="true"],
a.button.accent[aria-disabled="true"]:hover,
a.button.accent[aria-disabled="true"]:focus-visible,
button.button.accent:disabled,
button.button.accent:disabled:hover,
button.button.accent:disabled:focus-visible {
  background-color: var(--light-color);
  border-color: var(--light-color);
  color: var(--dark-color);
}

main img {
  max-width: 100%;
  width: auto;
  height: auto;
}

.icon {
  display: inline-block;
  height: 24px;
  width: 24px;
}

.icon img {
  height: 100%;
  width: 100%;
}

/* sections */
main > .section {
  margin: 0;
  padding: var(--section-space) 0;
}

main > .section > div {
  width: min(100% - 2 * var(--page-gutter), var(--page-width) - 2 * var(--page-gutter));
  margin: 0 auto;
}

/* section metadata */
main .section.light,
main .section.highlight {
  background-color: var(--light-color);
}

/*
 * futkar: page layout.
 * Each section after the hero is a ruled spread: the heading sits in a left column, the reading
 * column runs beside it at a comfortable measure. On phones the two collapse into one column.
 */
main > .section + .section > div:first-child {
  border-top: 1px solid var(--border-color);
  padding-top: var(--section-space);
}

main > .section + .section {
  padding-top: 0;
}

main > .section + .section h2 {
  margin-top: 0;
  font-size: var(--heading-font-size-l);
}

@media (width >= 900px) {
  main > .section + .section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    column-gap: 64px;
    width: min(100% - 2 * var(--page-gutter), var(--page-width) - 2 * var(--page-gutter));
    margin: 0 auto;
    padding-inline: 0;
    border-top: 1px solid var(--border-color);
    padding-top: var(--section-space);
  }

  main > .section + .section > div {
    display: contents;
  }

  main > .section + .section > div > * {
    grid-column: 2;
  }

  main > .section + .section > .default-content-wrapper > h2 {
    grid-column: 1;
    grid-row: 1 / span 12;
    align-self: start;
    position: sticky;
    top: 32px;
    padding-top: 0.15em;
  }

  main > .section + .section > div > :last-child {
    margin-bottom: 0;
  }
}

/* futkar: hero. The name is the headline, the promise follows in the accent. */
main > .section:first-of-type {
  padding-top: clamp(48px, 2rem + 8vw, 144px);
  padding-bottom: var(--section-space);
}

main > .section:first-of-type h1 {
  margin: 0 0 0.2em;
  font-size: var(--heading-font-size-xxl);
  line-height: 1;
  letter-spacing: -0.03em;
}

main > .section:first-of-type p {
  max-width: 36em;
  font-size: var(--body-font-size-l);
  line-height: 1.55;
}

main > .section:first-of-type h1 + p {
  margin-bottom: 1.25em;
}

main > .section:first-of-type h1 + p strong {
  display: block;
  color: var(--link-color);
  font-family: var(--heading-font-family);
  font-size: var(--heading-font-size-m);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* futkar: the hero's call-to-action link reads as a button */
main > .section:first-of-type p > a:only-child {
  display: inline-block;
  margin-top: 0.5em;
  padding: 0.7em 1.5em 0.6em;
  border-radius: 999px;
  background: var(--link-color);
  color: var(--background-color);
  font-size: var(--body-font-size-m);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

main > .section:first-of-type p > a:only-child:hover {
  background: var(--link-hover-color);
  color: var(--background-color);
}

main > .section:first-of-type p > a:only-child:active {
  transform: translateY(1px);
}

/* futkar: closing call to action. The address is the action, so it is set large. */
main > .section:last-of-type p > a[href^='mailto:']:only-child {
  font-family: var(--heading-font-family);
  font-size: var(--heading-font-size-l);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

main > .section:last-of-type p:has(+ p > a[href^='mailto:']:only-child) {
  margin-bottom: 0.25em;
  color: var(--muted-color);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
