/* =========================================================
   ROWEN CONSTRUCTION — Landing page
   ========================================================= */

/* ---------- 1. Fonts ---------- */

@font-face {
  font-family: "Diatype";
  src: url("/assets/fonts/ABCDiatype-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Design tokens ---------- */

:root {
  color-scheme: light dark;
  /* Colors */
  --burgundy: #76232f;
  --slate: #2f3e49;
  --ochre: #d6ab29;
  --daffodil: #e9ed7c;
  --stone: #ccd2d5;
  --ink: #0a0a0a;

  --color-bg: var(--stone);
  --color-bg-fade: hsla(190, 3%, 85%, 0);
  --color-ink: var(--ink);
  --color-rule: var(--ink);
  --color-hover: var(--burgundy);
  --color-highlight: var(--daffodil);
  --color-rule-soft: rgba(17, 17, 17, 0.18);
  --color-colophon-bg: var(--burgundy);
  --color-colophon-ink: var(--ink);
  --color-body-bg: #dfe3e5;

  /* Typography */
  --font-sans:
    "Diatype", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial,
    sans-serif;

  --fs-lede: 1.5em;
  --fs-body: 1.1em;
  --fs-small: 0.9375rem;

  --lh-lede: 1.18;
  --lh-body: 1.2;

  /* Spacing scale */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 6rem;

  /* Layout */
  --margin-x: clamp(0.75rem, 1vw, 2rem);
  --margin-y: clamp(0.75rem, 1vw, 2rem);

  /* Colophon */
  --colophon-h: 4rem;
  /* Mobile fixed footer */
  --footer-h-mobile: 12rem;

  /* Mark */
  --mark-ratio: 4.1322;

  /* Motion */
  --ease-in-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 0.2s;
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: var(--ink);
    --color-bg-fade: rgba(26, 26, 24, 0);
    --color-ink: var(--stone);
    --color-rule: var(--stone);
    --color-rule-soft: rgba(232, 232, 230, 0.22);
    --color-hover: var(--daffodil);
    --color-highlight: var(--burgundy);
    --color-colophon-bg: var(--slate);
    --color-colophon-ink: var(--ink);
    --color-body-bg: #1b1b1b;
  }
}
/* ---------- 3. Reset ---------- */

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

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--color-body-bg);
  font-size: 13px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--color-body-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-feature-settings: "ss07" 1;
  line-height: var(--lh-body);
  font-weight: 500;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1,
h2,
p,
figure,
address {
  margin: 0;
  padding: 0;
}

address {
  font-style: normal;
}

a {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
  border-radius: 2px;
  padding: 0.1em 0.3em;
  margin: -0.1em -0.3em;
  transition: background-color var(--duration-fast) var(--ease-in-out);
}

a:hover,
a:focus-visible {
  /* color: var(--color-hover); */
  background-color: var(--color-highlight);
}

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

/* ---------- 4. Typography roles ---------- */

.lede {
  font-size: var(--fs-lede);
  line-height: var(--lh-lede);
  font-weight: 500;
  letter-spacing: -0.005em;
}

.specialties__label,
.specialties__list li {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 500;
}
/* ---------- 5. Mobile-first base layout ---------- */
/* Grid rules formerly on body now live on .page, which wraps
   header/figure/section/footer. .colophon is a sibling of .page
   and sits in normal flow directly beneath it. */

.page {
  position: relative;
  z-index: 1;
  background: var(--color-bg);
  min-height: 100dvh;
  display: grid;
  margin-bottom: var(--colophon-h, 8rem);
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto 1fr auto;
  grid-template-areas:
    "hero"
    "intro"
    "specialties"
    "."
    "footer";
}

.intro {
  grid-area: intro;
  padding: var(--space-2) var(--margin-x) var(--space-2) var(--margin-x);
  display: grid;
  gap: var(--space-2) var(--space-3);
}

.hero {
  grid-area: hero;
  margin: 0;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: top left;
}
.specialties {
  grid-area: specialties;
  padding: 0 var(--margin-x) var(--space-4) var(--margin-x);
}
.specialties__label {
  padding: 0 0 var(--space-1) 0;
  border-bottom: 1px solid var(--color-rule);
  font-size: var(--fs-lede);
}
.specialties__list li {
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-rule);
}
.brand-footer {
  grid-area: footer;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: var(--margin-x);
  padding: var(--margin-y) var(--margin-x);
  background: var(--color-bg);
}
.brand-footer a {
  display: inline;
}
.brand-footer__mark {
  display: block;
  min-width: 14rem;
}
.brand-footer__mark-img {
  display: block;
  width: 100%;
  max-width: calc(4rem * var(--mark-ratio));
  height: auto;
  aspect-ratio: var(--mark-ratio);
  background-color: currentColor;
  -webkit-mask: url("/assets/Rowen.svg") no-repeat center / contain;
  mask: url("/assets/Rowen.svg") no-repeat center / contain;
  margin-bottom: 0.125em;
}

/* ---------- 5b. Colophon ---------- */

.colophon {
  position: fixed;
  inset: auto 0 -20vh 0;
  z-index: 0;
  display: grid;
  align-content: end;
  gap: var(--space-1);
  grid-template-columns: 1fr auto;
  padding: calc(20vh + var(--colophon-h) * 0.333) var(--margin-x);
  background: var(--color-colophon-bg);
  color: var(--color-colophon-ink);
  font-size: var(--fs-small);
}
.attribution {
  text-align: right;
  white-space: nowrap;
}
.attribution img {
  display: inline-block;
  vertical-align: middle;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0;
}

/* ---------- 6. Shared non-mobile layout (≥640px) ---------- */
/* Common to both intermediate and desktop. Differences handled below. */

@media (min-width: 640px) {
  html {
    font-size: 13px;
  }
  .page {
    grid-template-columns: 1fr 1fr;
    padding: var(--margin-y) var(--margin-x) 0 var(--margin-x);
  }
  .hero {
    min-height: 100%;
  }
  .hero img {
    height: 100%;
  }
  .intro {
    padding: 0 0 var(--space-4) 0;
  }
  .specialties {
    border-top: 1px solid var(--color-rule);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    padding: 0;
  }
  .specialties__label {
    grid-column: 1;
    border-bottom: none;
    font-size: var(--fs-body);
    padding: var(--space-1) 0;
  }
  .specialties__list {
    grid-column: 2;
  }
  .specialties__list li {
    border-left: none;
    padding-left: 0;
  }
  .brand-footer {
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: var(--margin-y) 0;
  }
  .brand-footer__contact {
    font-size: var(--fs-body);
  }
}
/* ---------- 7. Intermediate layout ---------- */
/* 640–1279px wide, OR ≥1280px but taller than square. */

@media (min-width: 640px) and (max-width: 1279.98px),
  (min-width: 1280px) and (max-aspect-ratio: 1/1) {
  .page {
    grid-template-areas:
      "intro       hero"
      "specialties specialties"
      "footer      footer";
    row-gap: var(--margin-y);
    grid-template-rows: minmax(min-content, 50dvh) minmax(min-content, 1fr) auto;
    align-content: stretch;
  }
  .hero {
    aspect-ratio: 4/3;
    height: auto;
  }

  .intro {
    padding-right: var(--margin-x);
    align-content: start;
  }

  .brand-footer__mark {
    padding-right: var(--margin-x);
  }

  .brand-footer__mark img {
    max-width: calc(5rem * var(--mark-ratio));
  }
}
@media (min-width: 800px) {
  html {
    font-size: 14px;
  }
}
@media (min-width: 960px) {
  html {
    font-size: 15px;
  }
}
/* ---------- 8. Desktop layout (≥1280px, wider than square) ---------- */

@media (min-width: 1280px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 13px;
  }
  .page {
    grid-template-rows: minmax(min-content, 1fr) minmax(min-content, 1fr) auto;
    grid-template-areas:
      "intro       hero"
      "specialties hero"
      "footer      hero";
    column-gap: var(--margin-x);
    padding: var(--margin-y) var(--margin-x);
  }

  .intro {
    padding-right: 0;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--margin-x);
  }

  .intro .lede:first-child {
    grid-column: 1;
  }

  .intro .lede:last-child {
    grid-column: 2;
    grid-row: 1;
  }

  .specialties {
    align-self: start;
    column-gap: var(--margin-x);
  }

  .brand-footer {
    grid-area: footer;
    padding: var(--margin-y) 0 0 0;
    background: transparent;
    column-gap: var(--margin-x);
  }

  .brand-footer__mark img {
    max-width: calc(6rem * var(--mark-ratio));
  }
}
@media (min-width: 1440px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 14px;
  }
}
@media (min-width: 1600px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 15px;
  }
}
@media (min-width: 1920px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 16px;
  }
}
@media (min-width: 2160px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 17px;
  }
}
@media (min-width: 2400px) and (min-aspect-ratio: 1/1) {
  html {
    font-size: 18px;
  }
}
/* ---------- 9. Sticky footer, mobile + intermediate ---------- */
/* Footer sticks to the viewport bottom while .page scrolls beneath it,
   then releases once .page's own flow ends — revealing .colophon,
   which sits in normal flow directly after .page. */

@media (max-width: 1279.98px), (min-width: 1280px) and (max-aspect-ratio: 1/1) {
  .brand-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--color-bg);
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  }
  .brand-footer::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: var(--space-4);
    background: linear-gradient(to top, var(--color-bg), var(--color-bg-fade));
    pointer-events: none;
  }
}
.no-intro .intro-overlay {
  display: none;
}
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end;
  background: var(--color-colophon-bg);
  padding: var(--margin-x);
  animation: overlay-slide-away 0.6s var(--ease-in-out) 1.8s forwards;
  pointer-events: none;
}

.intro-overlay__mark {
  display: block;
  width: 100%;
  aspect-ratio: var(--mark-ratio);
  background-color: var(--color-colophon-ink);
  -webkit-mask: url("/assets/Rowen.svg") no-repeat center / contain;
  mask: url("/assets/Rowen.svg") no-repeat center / contain;
  opacity: 0;
  animation: mark-fade-in 0.8s var(--ease-in-out) 0.2s forwards;
}

@keyframes mark-fade-in {
  to {
    opacity: 1;
  }
}

@keyframes overlay-slide-away {
  to {
    transform: translateY(-100%);
  }
}
