/*
  Alpen hero: graphite plate that flips into color, tile by tile.
  UI layout follows the supplied 1706 x 980 reference screenshot; --r is one reference
  pixel, scaled with the viewport width. Small UI text has pixel floors for legibility.
*/
:root {
  --r: clamp(0.56px, calc(100vw / 1706), 1.5px);

  --ink-void: #0a0d0a;
  --ink: #1b1c17;
  --ink-soft: #3f413a;
  --nav-idle: #ffffff;
  /* Soft dark glow that hugs the white letters, so they stay legible on bright parts of the plate without a shade layer. */
  --halo: 0 0 1px rgba(9, 11, 8, 0.35), 0 0 14px rgba(9, 11, 8, 0.45);
  --halo-strong: 0 0 2px rgba(9, 11, 8, 0.5), 0 0 10px rgba(9, 11, 8, 0.55), 0 0 22px rgba(9, 11, 8, 0.35);
  --paper: #f4f2ea;
  --white: #ffffff;

  --display: "Instrument Serif", "Times New Roman", serif;
  --script: "Monsieur La Doulaise", "Snell Roundhand", cursive;
  --sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink-void);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

p,
h1 {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink-void);
  cursor: crosshair;
  touch-action: none;
}

/* ---------- Tiles ---------- */

.tiles {
  position: absolute;
  inset: 0;
  z-index: 0;
  perspective: 520px;
  perspective-origin: 50% 50%;
  /* Seamless graphite underlay; main.js sets its cover size and position. */
  background-image: url("assets/alpine-graphite.jpg");
  background-repeat: no-repeat;
}

.tile {
  position: absolute;
  transform-style: preserve-3d;
  visibility: hidden;
}

.tile.is-turning,
.tile.is-turned {
  visibility: visible;
  background: var(--ink-void);
}

.tile.is-turning {
  z-index: 2;
}

.card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.tile.is-turning .card {
  will-change: transform;
}

.face {
  position: absolute;
  /* 1px overlap into the next tile hides compositing seams between flat tiles. */
  inset: 0 -1px -1px 0;
  background-repeat: no-repeat;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face--front {
  background-image: url("assets/alpine-graphite.jpg");
}

.face--back {
  background-image: url("assets/alpine-color.jpg");
}

.tile[data-axis="x"] .face--back {
  transform: rotateX(180deg);
}

.tile[data-axis="y"] .face--back {
  transform: rotateY(180deg);
}

/* Dark edges: a deep floor under the bottom text, lighter fades along the top and sides. */
.shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(9, 11, 8, 0.68) 0%, rgba(9, 11, 8, 0.5) 10%, rgba(9, 11, 8, 0.2) 21%, rgba(9, 11, 8, 0) 34%),
    linear-gradient(90deg, rgba(9, 11, 8, 0.42) 0%, rgba(9, 11, 8, 0.24) 8%, rgba(9, 11, 8, 0.08) 16%, rgba(9, 11, 8, 0) 24%),
    linear-gradient(270deg, rgba(9, 11, 8, 0.42) 0%, rgba(9, 11, 8, 0.24) 8%, rgba(9, 11, 8, 0.08) 16%, rgba(9, 11, 8, 0) 24%),
    linear-gradient(0deg, rgba(9, 11, 8, 0.9) 0%, rgba(9, 11, 8, 0.7) 12%, rgba(9, 11, 8, 0.3) 26%, rgba(9, 11, 8, 0) 42%);
}

/* ---------- UI ---------- */

.content {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.content a,
.content button {
  pointer-events: auto;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* Header */

.top {
  position: absolute;
  top: calc(26 * var(--r));
  left: calc(15 * var(--r));
  right: calc(16 * var(--r));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: max(6px, calc(8 * var(--r)));
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
}

.logo-mark {
  width: max(19px, calc(26 * var(--r)));
  height: max(19px, calc(26 * var(--r)));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(9, 11, 8, 0.6)) drop-shadow(0 0 8px rgba(9, 11, 8, 0.4));
}

.logo-word {
  text-shadow: var(--halo-strong);
  font-family: var(--display);
  font-size: max(21px, calc(29 * var(--r)));
  line-height: 1;
  letter-spacing: -0.01em;
  transform: translateY(-0.04em);
}

.nav {
  display: flex;
  gap: max(14px, calc(19 * var(--r)));
  font-family: var(--sans);
  font-size: max(12.5px, calc(15 * var(--r)));
  line-height: 1;
}

.nav a {
  position: relative;
  text-shadow: var(--halo);
  padding: 6px 0;
  color: var(--nav-idle);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.nav a:hover {
  opacity: 0.66;
}

.nav a[aria-current="page"] {
  color: var(--white);
  font-weight: 500;
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: currentColor;
}

.contact {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: max(10px, calc(16 * var(--r)));
  height: max(36px, calc(42 * var(--r)));
  padding: 0 max(5px, calc(7 * var(--r))) 0 max(18px, calc(27 * var(--r)));
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: max(12.5px, calc(15 * var(--r)));
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.contact:hover {
  background: var(--paper);
}

.contact-icon {
  display: grid;
  place-items: center;
  width: max(25px, calc(28 * var(--r)));
  height: max(25px, calc(28 * var(--r)));
  border-radius: 50%;
  background: var(--ink);
}

.contact-icon svg {
  width: 52%;
  height: 52%;
  fill: var(--white);
}

/* Headline: condensed caps woven with large script words. */

.title {
  position: absolute;
  top: calc(80 * var(--r));
  left: 0;
  right: 0;
  font-weight: 400;
  color: var(--white);
  text-shadow: var(--halo);
}

.line {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}

.line-1 {
  padding-left: calc(212 * var(--r));
  height: calc(150 * var(--r));
}

.line-2 {
  padding-left: calc(548 * var(--r));
  height: calc(148 * var(--r));
}

.caps {
  font-family: var(--display);
  font-size: calc(92 * var(--r));
  line-height: 1;
  letter-spacing: -0.012em;
  text-transform: uppercase;
}

.script {
  font-family: var(--script);
  font-size: calc(158 * var(--r));
  line-height: 0.9;
  letter-spacing: 0;
}

.script-1 {
  margin: 0 calc(24 * var(--r)) 0 calc(30 * var(--r));
}

.script-2 {
  margin-right: calc(28 * var(--r));
}

/* Field notes: caption on the right, subline under the headline. */

.notes {
  position: absolute;
  inset: 0;
}

.caption {
  position: absolute;
  top: calc(240 * var(--r));
  right: calc(222 * var(--r));
  font-family: var(--display);
  font-style: italic;
  font-size: max(14px, calc(17 * var(--r)));
  line-height: 1;
  color: var(--white);
  text-shadow: var(--halo-strong);
}

.subline {
  position: absolute;
  top: calc(402 * var(--r));
  left: calc(568 * var(--r));
  font-family: var(--display);
  font-size: calc(40 * var(--r));
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--white);
  text-shadow: var(--halo);
}

.subline em {
  font-family: var(--script);
  font-style: normal;
  font-size: 1.62em;
  line-height: 0;
  letter-spacing: 0;
  text-transform: none;
  margin: 0 0.12em 0 0.08em;
}

/* Call to action in parentheses */

.estimate {
  position: absolute;
  right: calc(30 * var(--r));
  bottom: calc(40 * var(--r));
  display: flex;
  align-items: center;
  gap: calc(14 * var(--r));
  color: var(--white);
  text-decoration: none;
  font-family: var(--display);
}

.paren {
  font-size: calc(76 * var(--r));
  line-height: 1;
  transform: translateY(-0.06em);
}

.estimate-text {
  font-size: max(24px, calc(38 * var(--r)));
  line-height: 0.93;
  letter-spacing: -0.012em;
  text-align: center;
}

.estimate-u {
  display: inline-block;
  padding-bottom: calc(6 * var(--r));
  border-bottom: 1px solid currentColor;
}

.estimate:hover .estimate-u {
  border-bottom-width: 2px;
  padding-bottom: calc(6 * var(--r) - 1px);
}

/* ---------- Narrow screens: same plate, re-stacked UI ---------- */

@media (max-width: 720px) {
  .top {
    top: 16px;
    left: 16px;
    right: 16px;
    grid-template-columns: 1fr auto;
    row-gap: 14px;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
    font-size: 13px;
  }

  .contact {
    grid-column: 2;
    grid-row: 1;
    font-size: 13px;
  }

  .title {
    top: 128px;
    left: 16px;
    right: 16px;
    text-align: center;
  }

  .line {
    flex-wrap: wrap;
    justify-content: center;
    padding-left: 0;
    height: auto;
    white-space: normal;
  }

  .caps {
    font-size: 13.4vw;
    white-space: nowrap;
  }

  .script {
    font-size: 23vw;
    line-height: 1;
  }

  .shade {
    background:
      linear-gradient(180deg, rgba(9, 11, 8, 0.68) 0%, rgba(9, 11, 8, 0.48) 9%, rgba(9, 11, 8, 0.18) 18%, rgba(9, 11, 8, 0) 28%),
      linear-gradient(90deg, rgba(9, 11, 8, 0.38) 0%, rgba(9, 11, 8, 0.16) 12%, rgba(9, 11, 8, 0) 26%),
      linear-gradient(270deg, rgba(9, 11, 8, 0.38) 0%, rgba(9, 11, 8, 0.16) 12%, rgba(9, 11, 8, 0) 26%),
      linear-gradient(0deg, rgba(9, 11, 8, 0.92) 0%, rgba(9, 11, 8, 0.78) 22%, rgba(9, 11, 8, 0.5) 36%, rgba(9, 11, 8, 0) 52%);
  }

  .script-1 {
    margin: 0 3vw 0 2vw;
  }

  .line-2 {
    margin-top: -2vw;
  }

  .script-2 {
    margin-right: 3vw;
  }

  .caption {
    top: auto;
    right: 16px;
    bottom: 132px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: none;
  }

  .subline {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 168px;
    font-size: 5.4vw;
    text-align: center;
    white-space: normal;
    color: var(--white);
    text-shadow: none;
  }

  .estimate {
    right: 50%;
    bottom: 36px;
    transform: translateX(50%);
  }

  .paren {
    font-size: 58px;
  }

  .estimate-text {
    font-size: 28px;
  }
}

@media (max-width: 380px) {
  .nav {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-turning .card {
    will-change: auto;
  }
}
