/*
  Temporary page for danibohigues.com until the real site launches (plan, M4).
  Plain CSS on purpose: two static pages with no build step.
  Archivo is licensed under the SIL Open Font License 1.1.
*/

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/archivo-variable.woff2') format('woff2');
}

:root {
  --color-surface: #191918;
  --color-panel: #1f1f1d;
  --color-ink: #f2f0eb;
  --color-muted: #a8a59e;
  --color-line: #e6e3dc;
  --color-shade-top: #3a3934;
  --color-shade-left: #2e2d29;
  --color-shade-right: #242321;
  --color-light: #f1c27d;
  --color-water: #23313a;
  --color-deck: #2b2a27;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

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

body {
  margin: 0;
  background: var(--color-surface);
  color: var(--color-ink);
  font-family:
    'Archivo',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Layout: mobile first, two columns from 64rem. On narrow screens the drawing takes the spare
   height, so the text and the button stay at the bottom, within thumb reach. */

.page {
  display: grid;
  grid-template-rows: auto minmax(12rem, 1fr) auto;
  min-height: 100svh;
}

.page-plain {
  grid-template-rows: auto 1fr;
}

.brand {
  padding: 1.25rem 1.25rem 0;
}

.logo {
  display: block;
  width: 9.5rem;
  height: auto;
}

/* The frame takes its size from the layout, never from the drawing, so the page fits the screen. */
.render {
  position: relative;
  min-height: 0;
  margin: 1.25rem 1.25rem 0;
  overflow: hidden;
  background: var(--color-panel);
}

.render-status {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.render-status::before {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--color-light);
  content: '';
}

/* On narrow screens the drawing is a little wider than its frame, so the house fills it;
   only the ends of the base get cropped. */
.drawing {
  position: absolute;
  inset: 0 auto 0 -10%;
  width: 120%;
  height: 100%;
  padding: 2.75rem 0.25rem 0.5rem;
}

.copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 1.25rem;
  padding: 2rem 1.25rem 2.25rem;
}

.page-plain .copy {
  justify-content: center;
}

.title {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.5rem, 1.5rem + 4.6vw, 4.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

.lead {
  max-width: 26rem;
  margin: 0;
  color: var(--color-muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 3rem;
  margin-top: 0.5rem;
  padding: 0 1.375rem;
  border-radius: 2px;
  background: var(--color-ink);
  color: var(--color-surface);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.cta svg {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 0.2s var(--ease-out);
}

.cta:hover {
  background: #fff;
}

.cta:hover svg {
  transform: translate(2px, -2px);
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 0.5rem;
  color: var(--color-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.cta:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

@media (min-width: 40rem) {
  .brand {
    padding: 2rem 2rem 0;
  }

  .render {
    margin: 2rem 2rem 0;
  }

  .drawing {
    inset: 0;
    width: 100%;
    padding: 3rem 1.5rem 1.5rem;
  }

  .copy {
    padding: 3rem 2rem;
  }
}

@media (min-width: 64rem) {
  .page {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .page-plain {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand {
    padding: 2.5rem 3rem 0;
  }

  .logo {
    width: 11rem;
  }

  .render {
    grid-column: 2;
    grid-row: 1 / 3;
    margin: 1.5rem 1.5rem 1.5rem 0;
  }

  .render-status {
    top: 1.5rem;
    left: 1.5rem;
  }

  .drawing {
    padding: 3.5rem 2rem 2rem;
  }

  .copy {
    grid-row: 2;
    padding: 3rem;
  }
}

/* The drawing: its final state is the base style, so reduced motion shows it finished. */

.grid {
  fill: none;
  stroke: var(--color-line);
  stroke-width: 0.6;
  opacity: 0.16;
}

.line {
  fill: var(--color-panel);
  stroke: var(--color-line);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.55;
  stroke-width: 1.1;
}

.detail {
  fill: none;
  stroke-width: 0.8;
}

.face-top,
.pool {
  fill: var(--color-shade-top);
}

.face-left {
  fill: var(--color-shade-left);
}

.face-right {
  fill: var(--color-shade-right);
}

.water {
  fill: var(--color-water);
}

.deck {
  fill: var(--color-deck);
}

/* Blurred by the drawing's soft-blur filter. */
.shadow {
  fill: #000;
  opacity: 0.32;
}

.light-spill {
  fill: var(--color-light);
  opacity: 0.22;
}

/* Warm light, stronger at floor level, like a house at dusk. */
.window {
  fill: url('#window-light');
  stroke-width: 0.8;
}

@media (prefers-reduced-motion: no-preference) {
  /* Modelling: each edge draws itself in turn, then the lines settle. */
  .line {
    --draw: draw 0.9s var(--ease-out) calc(0.4s + var(--order, 0) * 0.22s) both;
    --settle: settle 1.2s ease 4.2s both;

    stroke-dasharray: 1;
    animation: var(--draw), var(--settle);
  }

  /* Rendering: the volumes take their shading, then the windows light up. */
  .face-top,
  .face-left,
  .face-right,
  .pool,
  .water,
  .deck {
    animation:
      var(--draw),
      var(--settle),
      shade 1.2s ease 4.2s both;
  }

  .window {
    animation:
      var(--draw),
      var(--settle),
      light-up 1.6s ease calc(3.4s + var(--order) * 0.15s) both;
  }

  .shadow {
    animation: fade-in 1.2s ease 4.4s both;
  }

  .light-spill {
    animation: fade-in 1.6s ease 5s both;
  }

  .grid {
    animation: fade-in 1.2s ease 0.1s both;
  }

  /* Three beats, while the drawing renders; then the dot stays still. */
  .render-status::before {
    animation: pulse 1.6s ease-in-out 3;
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes settle {
  from {
    stroke-opacity: 1;
  }
}

@keyframes shade {
  from {
    fill: var(--color-panel);
  }
}

@keyframes light-up {
  from {
    fill-opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}
