/*
 * Fonts are shipped with the site (data/fonts/) so every visitor sees
 * the same thing. Helvetica, Century Gothic and Blackest are not
 * pre-installed everywhere (browsers silently swap in a fallback), and
 * declaring the families here also overrides whatever "Helvetica" /
 * "Courier New" / "Century Gothic" a visitor's own computer might have.
 * The site only uses the weights listed below, no italics, so only
 * those files are wired up.
 *
 *   Courier New      — every word on the site (body font)
 *   Century Gothic   — the service phrases in the two text boxes (page 3)
 *   Blackest Medium  — "Let's get in touch!" on the contact page (page 4)
 *   Helvetica        — kept available; switch with `font` in js/config.js
 */
@font-face {
  font-family: "Helvetica";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/helvetica-255/Helvetica.ttf") format("truetype");
}

@font-face {
  font-family: "Helvetica";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/helvetica-255/Helvetica-Bold.ttf") format("truetype");
}

/* Only the regular cut is provided; bold is synthesised by the browser. */
@font-face {
  font-family: "Courier New";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/cour.ttf") format("truetype");
}

/* Services page phrases. Regular + bold (the ticker bolds the current line). */
@font-face {
  font-family: "Century Gothic";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/century-gothic/CenturyGothic.ttf") format("truetype");
}

@font-face {
  font-family: "Century Gothic";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/century-gothic/CenturyGothic-Bold.ttf") format("truetype");
}

/* Contact heading. Only the Medium cut is used, declared at weight 500. */
@font-face {
  font-family: "Blackest";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("../data/fonts/blackest/Blackest Medium.otf") format("opentype");
}

:root {
  --font-helvetica: "Helvetica", Arial, sans-serif;
  --font-courier: "Courier New", Courier, monospace;
  --font-century-gothic: "Century Gothic", "Avant Garde", Futura, sans-serif;
  --font-blackest: "Blackest", "Helvetica", Arial, sans-serif;
  /* Courier New everywhere; see the two exceptions below */
  --font: var(--font-courier);
  --bg: #fff;
  --fg: #000;
  /* web-safe dark red, used for every red word and border on the site */
  --accent: #990000;
  /*
   * kursor.png is a 32x32 crosshair; "16 16" puts the click point on the
   * center of the cross (the default "0 0" is its top-left corner, which
   * makes small links like the red words at the top miss by 16px).
   */
  --cursor: url("../data/kursor.png") 16 16, auto;
  --cursor-click: url("../data/kursor.png") 16 16, pointer;

  /* Fluid scale — same composition at every width; values shrink gradually. */
  --pad-page-top: 24vh;
  --pad-page-bottom: 8vh;
  --pad-page-x: clamp(0.5rem, 4vw, 4vw);
  --gap-cols: clamp(0.5rem, 4vw, 4vw);
  --frame-max: 62vh;
  --radius-none: 0;
  --border-frame: 2px;

  --fs-brand: clamp(0.875rem, 4.25vw, 4.125rem);
  --fs-brand-gallery: clamp(0.6875rem, 1.2vw, 4.125rem);
  --fs-column: clamp(0.6875rem, 1.2vw, 2.25rem);
  /* Home-page lines above and below the name. Small, but still readable. */
  --fs-tagline: clamp(0.625rem, 0.78vw, 0.75rem);
  --fs-micro: clamp(0.625rem, 0.9vw, 0.875rem);
  /*
   * Same size as the phrases in the red boxes. Those use 4.2cqw of a
   * square that is min(column width, 62vh). Each column is 44vw once
   * the page padding and the gap (4vw each) are taken out, so 4.2% of
   * that square is min(1.848vw, 2.604vh).
   */
  --fs-services-heading: clamp(0.625rem, min(1.848vw, 2.604vh), 1.75rem);
  --fs-contact-heading: clamp(1.125rem, 4.2vw, 5.25rem);
  /*--fs-contact-heading: clamp(1.125rem, 3.5vw, 4.25rem);*/
  --fs-contact-term: clamp(0.6875rem, 1.17vw, 1.1375rem);
  --fs-contact-value: clamp(0.625rem, 0.78vw, 0.8125rem);
  --size-cursor-mark: clamp(1.5rem, 2.6vw, 2.5rem);
  --size-contact-photo: min(clamp(3rem, 15vw, 20rem), 24vh);
  --gap-contact-photo: clamp(0.5rem, 2vw, 2.75rem);
  --gap-contact-grid: clamp(0.75rem, 4vw, 4vw);
  --contact-grid-width: min(90vw, 75rem);
}

html[data-font="helvetica"] {
  --font: var(--font-helvetica);
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  min-height: 100%;
  min-height: 100dvh;
  cursor: var(--cursor);
  overflow-x: clip;
}

body.intro-lock {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}

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

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

a {
  color: var(--fg);
  text-decoration: none;
  cursor: var(--cursor-click);
}

a:hover {
  text-decoration: none;
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.overlay {
  pointer-events: none;
}

#contact-label {
  pointer-events: auto;
  position: fixed;
  left: 50%;
  top: 15vh;
  transform: translate(-50%, -50%);
  font-size: var(--fs-micro);
  font-weight: 400;
  line-height: 1;
  z-index: 20;
  opacity: 0;
  color: var(--accent);
  text-decoration: none;
  cursor: var(--cursor);
}

#contact-label.is-link {
  cursor: var(--cursor-click);
}

#contact-label.is-link:hover {
  text-decoration: none;
}

#brand {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: var(--fs-brand);
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  z-index: 20;
  line-height: 1;
  /*
   * Black on the home page, red once it has become the gallery header.
   * --brand-mix runs 0 -> 1 with the scroll morph (set from main.js).
   */
  --brand-mix: 0;
  color: var(--fg);
  color: color-mix(in srgb, var(--fg), var(--accent) calc(var(--brand-mix) * 100%));
  pointer-events: none;
}

#brand.is-link {
  pointer-events: auto;
  cursor: var(--cursor-click);
}

#brand.is-link:hover .letter {
  text-decoration: none;
}

#brand .letter {
  display: inline-block;
  opacity: 0;
}

#brand .letter.blink-in {
  animation: blink-in 0.38s steps(2, end) forwards;
}

/*
 * Two lines around the home-page name, in the same face as
 * "jelisavvveta" and the site red. They stay on the home position
 * (main.js fades them out once the name leaves for the gallery).
 * The offsets match the home size main.js gives the name:
 * clamp(0.6875rem, 4.25vw, 4.125rem), centered at 50vh.
 * The extra 4.2vh sets each line out in the open space, on the
 * bands above and below the name.
 */
.brand-tagline {
  position: fixed;
  left: 50%;
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-tagline);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  font-style: italic;
  white-space: nowrap;
  text-align: center;
  color: var(--accent);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
}

#tagline-above {
  top: calc(50vh - clamp(0.6875rem, 4.25vw, 4.125rem) / 2 - clamp(0.55rem, 1.35vh, 1.05rem) - 4.2vh);
  transform: translate(-50%, -100%);
}

#tagline-below {
  top: calc(50vh + clamp(0.6875rem, 4.25vw, 4.125rem) / 2 + clamp(0.55rem, 1.35vh, 1.05rem) + 4.2vh);
  transform: translate(-50%, 0);
}

@keyframes blink-in {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  55% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.column-label {
  position: fixed;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-weight: 400;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  line-height: 1;
}

/* On the contact page the column words link back to the gallery. */
.column-label.is-link {
  pointer-events: auto;
  cursor: var(--cursor-click);
}

/*
 * Crosshair mark (the same picture used as the mouse cursor). On the
 * home page it sits between "architecture" and "photography"; while
 * scrolling to the gallery it travels to the center of the page and
 * makes half a turn; it fades out as the contact page arrives.
 * Position, rotation and opacity are driven from main.js; the inner
 * image carries the intro blink and the slow breathing pulse.
 */
.cursor-mark {
  position: fixed;
  left: 50%;
  top: 85vh;
  transform: translate(-50%, -50%);
  width: var(--size-cursor-mark);
  aspect-ratio: 1 / 1;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
}

.cursor-mark img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  opacity: 0;
}

.cursor-mark img.is-on {
  animation:
    blink-in 0.38s steps(2, end) forwards,
    cursor-pulse 2.6s ease-in-out 0.38s infinite;
}

/* Intro skipped (page reloaded past the home screen): no blink, just the pulse. */
.cursor-mark img.is-on.is-instant {
  opacity: 1;
  animation: cursor-pulse 2.6s ease-in-out infinite;
}

@keyframes cursor-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18);
  }
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--pad-page-top) var(--pad-page-x) var(--pad-page-bottom);
  gap: var(--gap-cols);
}

.col {
  min-width: 0;
  /* Lets the portfolio caption (and any other col children) size with cqw. */
  container-type: inline-size;
  container-name: col;
}

/*
 * Slideshow frame. Always a square, as wide as the column allows but
 * never taller than 62vh, centered in its column. The pictures and the
 * phrase layer both fill this same box, so their relationship is the
 * same on every screen size and window shape. No frame here: the red
 * border is only on the text boxes of the services page.
 */
.gallery {
  position: relative;
  width: min(100%, var(--frame-max));
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  container-type: inline-size;
}

/*
 * "click above for the portfolio" caption under each slideshow, centered
 * on that image box. Plain text, no arrow: the picture itself is the
 * thing to click. The box is the same width as the frame above it.
 */
.portfolio-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, var(--frame-max));
  margin: 1.5vh auto 0;
  container-type: inline-size;
  container-name: cta;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  color: var(--fg);
  cursor: var(--cursor-click);
}

.portfolio-cta .cta-text {
  /* Child queries the CTA frame width (not the wider column) via cqw. */
  font-size: clamp(0.5rem, 5.2cqw, 0.875rem);
  text-decoration: none;
  color: var(--fg);
}

.gallery img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.gallery img.is-active {
  opacity: 1;
}

.gallery.is-animated img {
  transition: opacity 0.55s ease;
}

.gallery.is-clickable img.is-active {
  pointer-events: auto;
  cursor: var(--cursor-click);
}

/*
 * Services page (third page). "ways we can work together" at the top,
 * two red-framed text boxes with the same geometry as the slideshow
 * frames, and the fixed "architecture" / "photography" words placed
 * below the boxes by main.js.
 */
.services-heading {
  position: absolute;
  left: 50%;
  /* Boxes begin at --pad-page-top. Hang the line above that edge,
     plus 4vh so it sits in the open band under the name. */
  top: var(--pad-page-top);
  transform: translate(-50%, calc(-100% - clamp(0.35rem, 1.6vh, 1.1rem) - 4vh));
  margin: 0;
  font-size: var(--fs-services-heading);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  color: var(--fg);
}

/* Same padding as the gallery page so the boxes sit in the same place. */
.services-columns {
  padding: var(--pad-page-top) var(--pad-page-x) var(--pad-page-bottom);
}

.services-list {
  position: relative;
  width: min(100%, var(--frame-max));
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  container-type: inline-size;
  border: var(--border-frame) solid var(--accent);
  display: flex;
  flex-direction: column;
  /* compact block, centered vertically in the square */
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
  color: var(--fg);
}

/*
 * Each phrase is spread across the line: first word against the left
 * margin, last word against the right margin, the rest spaced evenly
 * between them (text-align-last: justify). Lowercase, light rhythm.
 * These phrases are the one place on the site set in Century Gothic.
 */
.services-list li.phrase {
  display: block;
  width: 100%;
  padding: 0 clamp(0.2rem, 6cqw, 12cqw);
  font-family: var(--font-century-gothic);
  font-size: clamp(0.625rem, 4.2cqw, 1.75rem);
  line-height: 1.2;
  white-space: nowrap;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  font-weight: 400;
  text-align: justify;
  text-align-last: justify;
  opacity: 1;
  transition: opacity 0.4s ease;
}

/*
 * Dashed rule between two phrases. Same side padding as the phrases,
 * so it runs from the first letter of the line to the last letter.
 */
.services-list li.sep {
  display: block;
  width: 100%;
  height: 0;
  margin: 1.1cqw 0;
  padding: 0 clamp(0.2rem, 6cqw, 12cqw);
  font-size: 0;
  line-height: 0;
  user-select: none;
}

.services-list li.sep::before {
  content: "";
  display: block;
  width: 100%;
  height: 0;
  border-top: 1px dashed var(--fg);
}

/*
 * Ticker highlight. Which style is used comes from
 * SITE.servicesHighlight in js/config.js ("bold" or "dim"):
 *   bold — the current phrase is drawn bold, the others regular;
 *   dim  — the current phrase is solid black, the others are greyed.
 */
html[data-highlight="bold"] .services-list li.is-current {
  font-weight: 700;
}

html[data-highlight="dim"] .services-list li:not(.is-current):not(.sep) {
  opacity: 0.35;
}

/* Section fades in/out with the scroll (opacity set from main.js). */
.services-inner {
  opacity: 0;
}

/*
 * Contact layout. Four rows, equally spaced down the page:
 *   1. "jelisavvveta"                      7vh  (fixed overlay, main.js)
 *   2. picture + "Let's get in touch!"    33vh
 *   3. email / instagram / phone          59vh
 *   4. "architecture" / "photography"     85vh  (fixed overlay, main.js)
 * Rows 1 and 4 are placed by main.js (see .column-label and
 * .cursor-mark); rows 2 and 3 split the gap between them in thirds.
 */
.contact-inner {
  position: absolute;
  inset: 0;
  opacity: 0;
}

/*
 * The heading itself is centered on the page; the picture hangs off
 * its left side (see .contact-photo), so the words never move when
 * the picture size changes.
 */
.contact-headline {
  position: absolute;
  left: 50%;
  top: 33vh;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  max-width: 92vw;
}

/* "Let's get in touch!" — Blackest Medium (weight 500 matches the @font-face). */
#contact-heading {
  margin: 0;
  font-family: var(--font-blackest);
  font-size: var(--fs-contact-heading);
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
}

.contact-grid {
  position: absolute;
  left: 50%;
  top: 59vh;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap-contact-grid);
  width: var(--contact-grid-width);
  text-align: center;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.contact-item {
  min-width: 0;
}

.contact-term {
  display: block;
  margin-bottom: 1.2vh;
  font-size: var(--fs-contact-term);
  font-weight: 700;
  line-height: 1;
}

.contact-value {
  display: block;
  font-size: var(--fs-contact-value);
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.contact-value a {
  color: var(--fg);
  text-decoration: none;
}

/*
 * Contact picture. Sits directly left of the heading. Hidden until the
 * contact page is in view, then turns and grows into place
 * (class "is-revealed" is toggled from main.js).
 */
.contact-photo {
  position: absolute;
  /* directly left of the centered heading */
  right: 100%;
  top: 50%;
  margin: 0 var(--gap-contact-photo) 0 0;
  /* scales with the viewport so the heading stays centered without clipping */
  width: var(--size-contact-photo);
  aspect-ratio: 1 / 1;
  opacity: 0;
  /* starts small and turned, then spins up into place */
  transform: translateY(-50%) rotate(-200deg) scale(0.4);
  transition:
    transform 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s,
    opacity 0.4s ease 0.15s;
}

.contact-photo.is-revealed {
  opacity: 1;
  transform: translateY(-50%) rotate(0deg) scale(1);
}

.contact-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  /* the picture carries its own lace frame, so show all of it */
  object-fit: contain;
}

/* No outline: when the file is missing the box simply stays blank. */
.contact-photo.is-empty img {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .cursor-mark img.is-on {
    animation: blink-in 0.38s steps(2, end) forwards;
  }

  .cursor-mark img.is-on.is-instant {
    animation: none;
  }

  .contact-photo {
    transition: opacity 0.3s ease;
    transform: translateY(-50%);
  }
}
