/* Euphoricdog — creative kennel */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  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;
}

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Same files, but the fitted wordmark waits for them instead of
   flashing a wider fallback that would be cropped. */
@font-face {
  font-family: "Archivo Display";
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: block;
  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;
}

@font-face {
  font-family: "Archivo Display";
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: block;
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Palette: the sun the dog is basking in, and the dog itself. */
  --sun: #f6c445;
  --kennel: #354646;   /* the mascot's outline */
  --kennel-deep: #283636;
  --bone: #e3eeee;     /* the mascot's coat */

  --font-display: "Archivo Display", "Arial Narrow", sans-serif-condensed, ui-sans-serif, sans-serif;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1.5rem, 6vw, 7rem);
  --step-0: clamp(1rem, 0.9rem + 0.3vw, 1.375rem);
  --step-1: clamp(1.25rem, 1.05rem + 0.75vw, 2.25rem);
  --step-2: clamp(1.75rem, 1.2rem + 2.4vw, 4.5rem);
  --step--1: clamp(0.8125rem, 0.7rem + 0.2vw, 1.125rem);

  /* The stage never grows taller than the screen can hold. */
  --stage-max: min(152rem, calc(165svh + 2 * var(--gutter)));

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  background: var(--kennel);
  color: var(--kennel);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

p {
  margin: 0;
}

::selection {
  background: var(--kennel);
  color: var(--sun);
}

/* ---------- Sky and wordmark ---------- */

.sky {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: radial-gradient(ellipse at 85% 22%, #fff6d955, transparent 52%),
    linear-gradient(167deg, #f3dfaa, #faedc9 53%, #faf2db);
  padding-top: clamp(5rem, 14vh, 10rem);
  overflow: hidden;
  isolation: isolate;
}

.stage {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--stage-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sky--home {
  align-items: center;
  padding-block: clamp(5.25rem, 10svh, 9rem) clamp(2rem, 4vw, 4.5rem);
}

.sky--home .stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 27%;
  grid-template-areas:
    "intro mascot"
    "name  name";
  align-items: end;
  row-gap: clamp(0.875rem, 1.8vw, 2rem);
}

.intro {
  grid-area: intro;
  padding-bottom: 0.7em;
}

.intro .tagline {
  color: var(--kennel);
  font-size: clamp(2.25rem, 4.4cqi, 4.5rem);
  letter-spacing: -0.045em;
  font-weight: 400;
  font-stretch: 86%;
}

.intro__about {
  max-width: 42ch;
  margin-top: 0.65em;
  font-size: clamp(1rem, 1.4cqi, 1.375rem);
  line-height: 1.45;
  color: #4e5c54;
  text-wrap: pretty;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  /* Light, very condensed capitals echo the original 2009 wordmark. */
  font-weight: 260;
  font-stretch: 62%;
  /* Sized so the full name spans the stage edge to edge. */
  font-size: 18.4vw; /* fallback without container query units */
  font-size: 20.6cqi;
  line-height: 0.74;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--kennel);
  padding-top: 0.04em;
  grid-area: name;
}

.wordmark__word {
  display: inline-block;
}

/* Compensate for the side bearings of the first E and the final G. */
.sky--home .wordmark {
  font-size: 21.1cqi;
  margin-inline: -1.25cqi;
}

/* ---------- The mascot ---------- */

.mascot {
  grid-area: mascot;
  position: relative;
  z-index: 1;
  width: 100%;
  transform-origin: 50% 100%;
}

.pet {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pet:focus-visible {
  outline-color: var(--kennel);
  outline-offset: 0;
  border-radius: 1rem;
}

.dog {
  display: block;
  width: 100%;
  max-width: none;
  overflow: visible;
  -webkit-user-drag: none;
  user-select: none;
}

.dog__arrival,
.dog__body,
.dog__idle {
  transform-origin: 50% 90%;
}

.dog__shadow {
  transform-origin: 50% 89%;
}

.dog__blink {
  opacity: 0;
}

/* The tail and the panel share a fill and cast one continuous shadow. */
.bubble {
  --paper: #fffdf5;
  position: absolute;
  z-index: 1;
  right: 69%;
  bottom: calc(100% + 0.65rem);
  width: max-content;
  max-width: min(21em, 42cqi);
  padding: 0.7em 1.12em;
  border-radius: 1.15em 1.15em 0.65em 1.15em;
  background: var(--paper);
  color: var(--kennel-deep);
  filter: drop-shadow(0 2px 3px #5a492016);
  font-size: clamp(1rem, 1.25cqi, 1.25rem);
  font-weight: 500;
  font-stretch: 92%;
  line-height: 1.3;
  text-wrap: balance;
  pointer-events: none;
  transform-origin: calc(100% - 1.5em) 100%;
}

.bubble::after {
  content: "";
  position: absolute;
  right: 0.4em;
  top: calc(100% - 1px);
  width: 21px;
  height: 13px;
  background: var(--paper);
  clip-path: path("M0 0H16Q16 7 21 13Q8 12 0 0Z");
}

.bubble:empty {
  display: none;
}

/* ---------- Clouds, a nod to the 2009 site ---------- */

.clouds {
  position: absolute;
  inset: 0;
  mask-image: linear-gradient(#000 22%, #000a 42%, transparent 79%);
  z-index: -1;
  pointer-events: none;
}

.cloud-layer {
  position: absolute;
  inset: 0;
}

.cloud-layer--far    { --depth: 3px;  --wind: 0.65vw; opacity: 0.38; }
.cloud-layer--middle { --depth: 7px;  --wind: 1.15vw; opacity: 0.56; }
.cloud-layer--near   { --depth: 12px; --wind: 1.7vw; opacity: 0.7; }

.cloud {
  position: absolute;
  height: auto;
}

.cloud--haze   { left: 21%; top: 14%; width: 8%; }
.cloud--high   { left: 51%; top: 6%;  width: 7%; }
.cloud--east   { left: 58%; top: 23%; width: 9%; }
.cloud--west   { left: 4%;  top: 23%; width: min(20%, 19rem); }
.cloud--little { left: 41%; top: 34%; width: min(11%, 10rem); }
.cloud--rim    { right: -6%; top: 6%; width: 17%; }
.cloud--low    { left: -8%; top: 34%; width: 17%; }
.cloud--bank   { left: 30%; top: 24%; width: 9%; }

@media (max-width: 40rem) {
  .sky--home {
    align-items: stretch;
    padding-block: clamp(2.25rem, 8svh, 5rem) clamp(2rem, 8svh, 5rem);
  }

  .sky--home .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "intro" "mascot" "name";
    row-gap: 0.75rem;
  }

  .intro {
    padding-bottom: 0;
  }

  .intro__about {
    max-width: 27ch;
  }

  .sky--home .mascot {
    justify-self: end;
    width: min(58%, 15rem);
    /* Reserve space for the longest three-line reply above the dog. */
    margin-top: 7rem;
  }

  .bubble {
    max-width: 58cqi;
    padding-inline: 0.85em;
    text-align: center;
  }

  .cloud--haze   { left: 13%; top: 22%; width: 19%; }
  .cloud--high   { left: 52%; top: 29%; width: 15%; }
  .cloud--east   { left: 70%; top: 54%; width: 19%; }
  .cloud--west   { left: -9%; top: 32%; width: 47%; }
  .cloud--little { left: 30%; top: 55%; width: 19%; }
  .cloud--rim    { right: -9%; top: 36%; width: 35%; }
  .cloud--low    { left: -12%; top: 68%; width: 39%; }
  .cloud--bank   { left: 72%; top: 12%; width: 34%; }
}

/* ---------- Ground: everything you need to know ---------- */

.ground {
  background: var(--kennel);
  color: var(--bone);
  padding: clamp(1.75rem, 3vw, 3.25rem) var(--gutter);
}

.ground__grid {
  max-width: calc(var(--stage-max) - 2 * var(--gutter));
  margin-inline: auto;
  display: grid;
  gap: 1.75rem 3rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "tagline"
    "about"
    "legal";
}

@media (min-width: 52rem) {
  .ground__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas:
      "tagline about"
      "legal   about";
    align-items: start;
  }
}

.ground__grid--home {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "contact legal";
  align-items: end;
}

.ground__grid--home .contact {
  grid-area: contact;
}

@media (max-width: 40rem) {
  .ground__grid--home {
    grid-template-columns: 1fr;
    grid-template-areas: "contact" "legal";
    gap: 1.5rem;
  }
}

.tagline {
  grid-area: tagline;
  font-size: var(--step-2);
  font-weight: 300;
  font-stretch: 75%;
  line-height: 1.05;
  color: var(--sun);
}

.about {
  grid-area: about;
  display: grid;
  gap: 0.75rem;
  max-width: 34em;
  font-size: var(--step-1);
  line-height: 1.35;
}

.contact {
  font-size: var(--step-0);
  line-height: 1.5;
  color: color-mix(in srgb, var(--bone) 82%, var(--kennel));
}

.contact a {
  display: block;
  width: fit-content;
  margin-top: 0.15em;
  font-size: var(--step-1);
  font-weight: 500;
  font-stretch: 96%;
  color: #ffda84;
  text-decoration: underline;
  text-decoration-color: #f6c44570;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
  transition: text-decoration-color 160ms ease;
}

.contact a:hover {
  text-decoration-color: currentColor;
}

.legal {
  grid-area: legal;
  align-self: end;
  font-size: var(--step--1);
  color: color-mix(in srgb, var(--bone) 70%, var(--kennel));
}

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

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* On load: the name rises out of the ground, then the dog lands on it. */
  .wordmark__word {
    animation: rise 900ms var(--ease-out) both;
  }

  .sky--lost .mascot,
  .dog__arrival {
    animation: land 700ms 650ms var(--ease-out) both;
  }

  .bubble.is-in {
    animation: pop 320ms var(--ease-out) both;
  }

  .dog__idle {
    animation: breathe 3.8s ease-in-out infinite alternate;
    transition: rotate 320ms var(--ease-out);
  }

  .pet:focus-visible .dog__idle {
    rotate: -1.5deg;
  }

  @media (hover: hover) {
    .pet:hover .dog__idle {
      rotate: -1.5deg;
    }
  }

  .dog__blink {
    animation: blink 6.7s linear infinite;
  }

  .dog.is-hopping .dog__body {
    animation: hop 570ms ease-in-out;
  }

  .dog.is-euphoric .dog__body {
    animation: euphoric 950ms ease-in-out;
  }

  .dog.is-hopping .dog__shadow {
    animation: hop-shadow 570ms ease-in-out;
  }

  .dog.is-euphoric .dog__shadow {
    animation: happy-shadow 950ms ease-in-out;
  }

  .cloud-layer {
    transform: translate3d(calc(var(--look-x, 0) * var(--depth)),
      calc((var(--look-y, 0) + var(--scroll, 0)) * var(--depth)), 0);
    transition: transform 550ms ease-out;
  }

  .cloud {
    animation: drift 23s ease-in-out infinite alternate;
  }

  .cloud:nth-child(even) { animation-delay: -17s; }
  .cloud-layer--far .cloud { animation-duration: 38s; }
  .cloud-layer--middle .cloud { animation-duration: 30s; }

  @keyframes breathe {
    to { transform: scale(1.004, 1.012) rotate(-0.45deg); }
  }

  @keyframes blink {
    0%, 46%, 50%, 100% { opacity: 0; }
    47.5%, 48.5% { opacity: 1; }
  }

  @keyframes rise {
    from { clip-path: inset(0 0 100% 0); translate: 0 100%; }
    to   { clip-path: inset(0 0 0 0);    translate: 0 0; }
  }

  @keyframes land {
    0%   { opacity: 0; translate: 0 -40%; scale: 1 1; }
    55%  { opacity: 1; translate: 0 0;    scale: 1.04 0.94; }
    78%  {             translate: 0 -2%;  scale: 0.99 1.02; }
    100% { opacity: 1; translate: 0 0;    scale: 1 1; }
  }

  @keyframes pop {
    from { opacity: 0; translate: 0 3px; scale: 0.98; }
    to   { opacity: 1; translate: 0 0; scale: 1; }
  }

  @keyframes hop {
    0%, 100% { transform: none; }
    19% { transform: scale(1.035, 0.93); }
    48% { transform: translate(-0.7%, -8%) rotate(-2deg) scale(0.98, 1.025); }
    77% { transform: scale(1.04, 0.95); }
  }

  @keyframes euphoric {
    0%, 100% { transform: none; }
    12% { transform: scale(1.06, 0.9); }
    35% { transform: translate(-2%, -14%) rotate(-4deg) scale(0.98, 1.04); }
    56% { transform: scale(1.055, 0.93); }
    74% { transform: translate(1%, -6%) rotate(2.5deg); }
    90% { transform: scale(1.02, 0.97); }
  }

  @keyframes hop-shadow {
    0%, 19%, 77%, 100% { transform: none; opacity: 1; }
    48% { transform: scale(0.9, 0.86); opacity: 0.78; }
  }

  @keyframes happy-shadow {
    0%, 12%, 56%, 90%, 100% { transform: none; opacity: 1; }
    35% { transform: scale(0.82, 0.75); opacity: 0.65; }
    74% { transform: scale(0.93, 0.89); opacity: 0.83; }
  }

  @keyframes drift {
    from { transform: translateX(calc(-1 * var(--wind))); }
    to   { transform: translateX(var(--wind)); }
  }
}

@media print {
  .sky,
  .ground {
    background: none;
  }

  .clouds,
  .bubble {
    display: none;
  }

  .ground *,
  .wordmark {
    color: #000 !important;
  }
}

/* ---------- 404 ---------- */

.sky--lost .wordmark {
  font-size: 36vw;
  font-size: 40cqi;
}

.sky--lost .mascot {
  /* No name to stand on: the dog waits on the ground beside the number. */
  position: absolute;
  right: var(--gutter);
  bottom: 0;
  width: 34%;
  width: 34cqi;
  margin: 0;
}

@media (max-width: 40rem) {
  .sky--lost {
    align-items: flex-end;
    padding-top: 14rem;
  }

  .sky--lost .bubble {
    right: 0;
  }

  .sky--lost .stage {
    display: block;
    min-height: 0;
  }

  .sky--lost .wordmark {
    display: block;
    font-size: 40cqi;
  }

  .sky--lost .mascot {
    width: 48cqi;
  }
}
