/* Ískvist — design system
   Fluid, rem-based; root size grows on large screens (TVs).
   Motion is progressive: @supports + prefers-reduced-motion. */

:root {
  --ink: #231f20;
  --ink-2: #3a3536;
  --paper: #f6f4f0;
  --paper-2: #ece8e1;
  --muted: #6e6866;
  --line: rgb(35 31 32 / 0.12);
  --line-light: rgb(255 255 255 / 0.14);
  --green: #3a7b39;
  --green-light: #5fa35d;

  --font: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --max: 84rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --header-h: 4.5rem;
  --section: clamp(4.5rem, 11vw, 10rem);
  --radius: 3px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  background: var(--paper);
  color: var(--ink);
}

/* Large screens and TVs: scale everything up proportionally. */
@media (min-width: 1600px) {
  html { font-size: calc(100% + 0.28vw); }
}

body {
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; padding: 0; }

h1, h2, h3 { font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: var(--green); color: #fff; }

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

/* ---------- layout primitives ---------- */

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
}
.skip:focus { top: 1rem; }

/* ---------- type helpers ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--green);
}
.eyebrow-light { color: rgb(255 255 255 / 0.6); }
.eyebrow-light::before { background: var(--green-light); }

.display {
  font-size: clamp(2.75rem, 7.2vw, 6.75rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;
}

h2 { font-size: clamp(1.9rem, 3.8vw, 3.4rem); max-width: 20ch; }
h3 { font-size: clamp(1.15rem, 1.6vw, 1.4rem); letter-spacing: -0.015em; }

.lede {
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 40ch;
}

/* underline that draws in on hover */
.nav a, .link, .contact-big, .footer-cols a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.45s var(--ease), color 0.3s;
}
.nav a:hover, .link:hover, .contact-big:hover, .footer-cols a:hover { background-size: 100% 1px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease), translate 0.3s var(--ease);
}
.btn:active { translate: 0 1px; }

.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--green); }

.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: rgb(246 244 240 / 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 0 var(--line);
}

/* transparent at the top, frosted once you scroll */
@supports (animation-timeline: scroll()) {
  .site-header {
    background: rgb(246 244 240 / 0);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 1px 0 rgb(35 31 32 / 0);
    animation: header-solid linear both;
    animation-timeline: scroll(root);
    animation-range: 0 8rem;
  }
}
@keyframes header-solid {
  to {
    background: rgb(246 244 240 / 0.86);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 1px 0 var(--line);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-h);
}

.brand { flex-shrink: 0; }
.brand-logo { height: 2.5rem; width: auto; }

.nav { display: none; gap: 2.25rem; font-size: 0.9375rem; font-weight: 500; }
.nav a { padding-block: 0.25rem; }

.header-cta { min-height: 2.5rem; padding: 0 1.1rem; font-size: 0.875rem; }

@media (min-width: 760px) {
  .nav { display: flex; margin-left: auto; }
  .header-cta { margin-left: 1rem; }
}

/* ---------- hero ---------- */

.hero { padding-block: clamp(1.5rem, 5vw, 5rem) var(--section); }

.hero-grid { display: grid; gap: clamp(2.5rem, 6vw, 6rem); align-items: center; }

.hero-copy .display { margin-bottom: clamp(1.25rem, 2.5vw, 2rem); }
.hero-copy .lede { margin-bottom: 2.25rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: var(--paper-2);
  /* edge-to-edge on phones */
  margin-inline: calc(-1 * max(var(--gutter), env(safe-area-inset-left)));
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 60%;
}

@media (min-width: 600px) {
  .hero-media { margin-inline: 0; }
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
  .hero-media {
    aspect-ratio: auto;
    height: min(calc(100svh - var(--header-h) - 4rem), 52rem);
    min-height: 32rem;
  }
}

/* ---------- sections ---------- */

.section { padding-block: var(--section); border-top: 1px solid var(--line); }
.section-head { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }

.split { display: grid; }

@media (min-width: 900px) {
  .split { grid-template-columns: 5fr 7fr; gap: clamp(3rem, 6vw, 7rem); align-items: start; }
  .split .section-head { position: sticky; top: calc(var(--header-h) + 2.5rem); margin-bottom: 0; }
}

/* ---------- services ---------- */

.services { border-bottom: 1px solid var(--line); }

.service {
  display: grid;
  grid-template-columns: 3rem 1fr;
  column-gap: 1rem;
  row-gap: 0.4rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}
.service-num {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.25rem;
  transition: color 0.4s var(--ease);
}
.service h3 { transition: translate 0.5s var(--ease); }
.service p { grid-column: 2; color: var(--muted); max-width: 42ch; }

.service:hover .service-num { color: var(--green); }
.service:hover h3 { translate: 0.35rem 0; }

@media (min-width: 700px) {
  .service { grid-template-columns: 4rem 1fr 1.15fr; align-items: baseline; padding-block: 2.25rem; }
  .service p { grid-column: 3; }
}

/* ---------- gallery ---------- */

.gallery { display: grid; gap: clamp(1rem, 2vw, 1.75rem); }

.tile { position: relative; }

.tile-btn {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper-2);
  cursor: zoom-in;
}
.tile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 1.4s var(--ease), filter 0.6s var(--ease);
}
.tile-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(20 18 18 / 0.55), transparent 45%);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

.tile-caption {
  position: absolute;
  left: 1.25rem;
  bottom: 1.1rem;
  z-index: 1;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 500;
  opacity: 0;
  translate: 0 0.5rem;
  transition: opacity 0.5s var(--ease), translate 0.5s var(--ease);
}

.tile-btn:hover img, .tile-btn:focus-visible img { scale: 1.045; }
.tile-btn:hover::after, .tile-btn:focus-visible::after { opacity: 1; }
.tile-btn:hover .tile-caption, .tile-btn:focus-visible .tile-caption { opacity: 1; translate: 0 0; }

/* touch screens: captions always visible */
@media (hover: none) {
  .tile-btn::after { opacity: 1; }
  .tile-caption { opacity: 1; translate: 0 0; }
}

/* staggered columns */
@media (min-width: 600px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .tile:nth-child(even) { margin-top: clamp(3rem, 8vw, 6rem); }
}
@media (min-width: 1000px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .tile:nth-child(even) { margin-top: 0; }
  .tile:nth-child(3n + 2) { margin-top: clamp(4rem, 9vw, 9rem); }
}

/* ---------- about ---------- */

.about-text {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  max-width: 34ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.people { display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.person { background: var(--paper); padding-block: 1.5rem; }
.person-name { font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em; }
.person-role { color: var(--muted); }

@media (min-width: 600px) {
  .people { grid-template-columns: 1fr 1fr; }
  .person + .person { padding-left: 1.5rem; }
}

/* ---------- contact + footer (one dark band) ---------- */

.contact, .site-footer { background: var(--ink); color: var(--paper); }

.contact { padding-block: var(--section) clamp(4rem, 8vw, 7rem); }
.contact .display { max-width: 14ch; margin-bottom: 1.5rem; }

.contact-lede { color: rgb(255 255 255 / 0.7); font-size: clamp(1.05rem, 1.4vw, 1.25rem); max-width: 40ch; margin-bottom: clamp(2.5rem, 5vw, 4rem); }

.contact-links { display: flex; flex-wrap: wrap; gap: 1rem 3.5rem; }
.contact-big {
  font-size: clamp(1.6rem, 4.4vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background-size: 100% 1px;
  background-image: linear-gradient(var(--green-light), var(--green-light));
  overflow-wrap: anywhere;
}
.contact-big:hover { color: var(--green-light); }

.site-footer { padding-bottom: env(safe-area-inset-bottom); }

.footer-inner {
  display: grid;
  gap: 3rem;
  padding-block: clamp(3rem, 6vw, 5rem);
  border-top: 1px solid var(--line-light);
}
.footer-logo { width: 11rem; height: auto; opacity: 0.95; }

.footer-cols { display: grid; gap: 1.75rem; }
.footer-label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.5);
  margin-bottom: 0.35rem;
}
.footer-cols a { font-size: 1.0625rem; }

.footer-base {
  padding-block: 1.5rem;
  border-top: 1px solid var(--line-light);
  font-size: 0.875rem;
  color: rgb(255 255 255 / 0.5);
}

@media (min-width: 700px) {
  .footer-inner { grid-template-columns: auto 1fr; align-items: end; gap: 4rem; }
  .footer-cols { grid-template-columns: repeat(3, auto); justify-content: end; gap: 3.5rem; }
}

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

.not-found { padding-block: var(--section); min-height: 60svh; }
.not-found h1 { font-size: clamp(2.25rem, 5vw, 4rem); margin-bottom: 1.5rem; }

/* ---------- motion (progressive) ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* hero: plays on load */
  .hero .reveal { animation: rise 1s var(--ease) both; }
  .hero .reveal:nth-child(2) { animation-delay: 0.08s; }
  .hero .reveal:nth-child(3) { animation-delay: 0.16s; }
  .hero .reveal:nth-child(4) { animation-delay: 0.24s; }

  .hero-media { animation: unveil 1.4s var(--ease) 0.1s both; }
  .hero-media img { animation: settle 2s var(--ease) 0.1s both; }

  /* scroll-driven: reveal on enter, gentle parallax on the hero photo */
  @supports (animation-timeline: view()) {
    .section .reveal, .contact .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 55%;
    }

    .hero-media img {
      animation: settle 2s var(--ease) 0.1s both, drift linear both;
      animation-timeline: auto, view();
      animation-range: normal, exit 0% exit 100%;
    }
  }
}

@keyframes rise {
  from { opacity: 0; translate: 0 1.75rem; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes unveil {
  from { clip-path: inset(100% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes settle {
  from { scale: 1.18; }
  to   { scale: 1; }
}
@keyframes drift {
  to { translate: 0 12%; }
}
