@layer reset, base, layout, components, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  img { display: block; max-width: 100%; height: auto; }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  a { color: inherit; }
}

@layer base {
  :root {
    --navy: #1c2733;
    --navy-2: #243140;
    --navy-3: #2c3a4a;
    --ink: #f2efe9;
    --muted: #9aa4b0;
    --orange: #e8891d;
    --line: color-mix(in oklab, var(--ink) 12%, transparent);
    --r: 14px;
    --gap: 6px;

    --font: "Rubik", "Helvetica Neue", Arial, sans-serif;
    --step--1: clamp(0.85rem, 0.8rem + 0.2vw, 0.95rem);
    --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
    --step-1: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
    --step-2: clamp(1.5rem, 1.15rem + 1.4vw, 2.3rem);
    --step-3: clamp(2rem, 1.3rem + 2.8vw, 3.6rem);
    --step-4: clamp(2.4rem, 1.4rem + 4vw, 5rem);
    --gutter: clamp(1rem, 3vw, 3rem);
    --section: clamp(3rem, 7vw, 6rem);
    color-scheme: dark;
  }
  html { scroll-behavior: smooth; }
  body {
    background: var(--navy); color: var(--ink);
    font-family: var(--font); font-size: var(--step-0); font-weight: 300; line-height: 1.5;
    -webkit-font-smoothing: antialiased; overflow-x: clip;
  }
  h1, h2, h3 { font-weight: 500; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
  h1 { font-size: var(--step-4); }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-1); }
  p { max-width: 52ch; text-wrap: pretty; }
  a { text-decoration: none; }
  :focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
  ::selection { background: var(--orange); color: var(--navy); }
  .skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--navy); padding: .5rem 1rem; z-index: 100; }
  .skip:focus { top: 1rem; }
}

@layer layout {
  .top {
    position: sticky; top: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
    padding: .9rem var(--gutter); background: color-mix(in oklab, var(--navy) 88%, transparent); backdrop-filter: blur(10px);
  }
  .brand { display: inline-flex; justify-self: start; }
  .logo { height: 1.9rem; width: auto; display: block; }
  .nav { display: flex; gap: 1.8rem; font-size: var(--step--1); font-weight: 400; }
  .nav a { padding: .35rem .7rem; border-radius: 999px; transition: background .2s; }
  .nav a:hover { background: var(--navy-3); }
  .pill { justify-self: end; font-size: var(--step--1); font-weight: 500; padding: .55rem 1rem; border-radius: 999px; background: var(--navy-3); transition: background .2s; font-variant-numeric: tabular-nums; }
  .pill:hover { background: var(--orange); color: var(--navy); }
  .burger { display: none; justify-self: end; font-weight: 500; font-size: var(--step--1); padding: .5rem .9rem; border-radius: 999px; background: var(--navy-3); }
  .mobile-nav { position: fixed; inset: 0; z-index: 15; background: var(--navy); display: grid; align-content: center; gap: .4rem; padding: var(--gutter); font-size: var(--step-2); font-weight: 500; }
  .mobile-nav[hidden] { display: none; }
  .mobile-nav a { padding: .6rem 1rem; border-radius: var(--r); background: var(--navy-2); }

  main { padding: var(--gap) var(--gap) 0; display: grid; gap: var(--section); }
  .sec-title { grid-column: 1 / -1; font-size: var(--step-2); font-weight: 500; padding: 0 calc(var(--gutter) - var(--gap)) .2rem; }

  .mosaic { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .tile { border-radius: var(--r); background: var(--navy-2); overflow: hidden; min-width: 0; }
  .t-text { padding: clamp(1.5rem, 4vw, 3.5rem); display: grid; align-content: end; gap: 1.2rem; }
  .t-photo { position: relative; margin: 0; }
  .t-photo img { width: 100%; height: 100%; object-fit: cover; }
  .t-photo figcaption {
    position: absolute; left: 1rem; bottom: 1rem; font-size: var(--step--1); font-weight: 400;
    background: color-mix(in oklab, var(--navy) 75%, transparent); padding: .35rem .7rem; border-radius: 999px; backdrop-filter: blur(6px);
  }
  .t-orange { background: var(--orange); color: var(--navy); }
  .big { font-size: var(--step-1); font-weight: 500; line-height: 1.2; }

  /* Hero mosaic */
  .hero { grid-template-rows: minmax(22rem, auto) minmax(14rem, auto); min-height: calc(100svh - 5rem); }
  .t-hero { grid-column: 1 / 8; grid-row: 1; }
  .t-hero p { color: var(--muted); font-size: var(--step-1); max-width: 34ch; }
  .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
  .t-tall { grid-column: 8 / 13; grid-row: 1 / 3; }
  .t-wide { grid-column: 1 / 5; grid-row: 2; }
  .t-facts { grid-column: 5 / 8; grid-row: 2; padding: clamp(1.2rem, 3vw, 2.2rem); display: grid; align-content: space-between; gap: 1rem; }
  .t-facts p:last-child { font-size: var(--step--1); font-weight: 400; }

  /* Fields */
  .t-field { grid-column: span 4; display: grid; grid-template-rows: auto 1fr; }
  .t-field img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
  .t-field div { padding: clamp(1.2rem, 2.5vw, 2rem); display: grid; gap: .6rem; align-content: start; }
  .t-field p { color: var(--muted); font-size: var(--step--1); }

  /* Why */
  .t-why { grid-column: 1 / 6; background: var(--navy-3); }
  .t-why h2 { font-size: var(--step-3); }
  .t-list { grid-column: 6 / 13; padding: clamp(1.2rem, 3vw, 2.5rem); }
  .t-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: .5rem 2rem; padding: 1.2rem 0; border-top: 1px solid var(--line); }
  .t-list li:first-child { border-top: 0; padding-top: 0; }
  .t-list strong { font-weight: 500; }
  .t-list span { color: var(--muted); font-size: var(--step--1); }

  /* Steps */
  .steps-wrap { display: grid; gap: var(--gap); }
  .steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); position: relative; }
  .steps li { padding: clamp(1.2rem, 2.5vw, 2rem); display: grid; gap: .6rem; align-content: start; }
  .n { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 8px; background: var(--orange); color: var(--navy); font-weight: 600; margin-bottom: .6rem; }
  .steps p { color: var(--muted); font-size: var(--step--1); }

  /* Gallery */
  .gallery { display: grid; gap: var(--gap); }
  .masonry { columns: 3; column-gap: var(--gap); }
  .masonry .tile { display: block; width: 100%; break-inside: avoid; margin-bottom: var(--gap); position: relative; text-align: left; }
  .masonry img { width: 100%; transition: scale .5s cubic-bezier(.2,.7,.2,1); }
  .masonry .tile:hover img { scale: 1.03; }
  .masonry span { position: absolute; left: 1rem; bottom: 1rem; font-size: var(--step--1); font-weight: 400; background: color-mix(in oklab, var(--navy) 75%, transparent); padding: .35rem .7rem; border-radius: 999px; backdrop-filter: blur(6px); }

  /* Contact */
  .t-contact { grid-column: 1 / 8; grid-row: 1 / 3; align-content: start; }
  .t-contact dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 2rem; margin-top: 1rem; }
  .t-contact dt { font-size: var(--step--1); color: var(--muted); margin-bottom: .2rem; }
  .t-contact dd { font-weight: 400; font-variant-numeric: tabular-nums; }
  .t-contact a:hover { color: var(--orange); }
  .t-cta { grid-column: 8 / 13; grid-row: 1; padding: clamp(1.5rem, 3vw, 2.5rem); display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem; min-height: 12rem; transition: background .2s; }
  .t-cta:hover { background: #f09a37; }
  .t-cta .big { font-size: var(--step-2); }
  .arrow { font-size: var(--step-3); line-height: 1; }
  .t-map { grid-column: 8 / 13; grid-row: 2; padding: clamp(1.5rem, 3vw, 2.5rem); display: grid; align-content: end; gap: .3rem; background: var(--navy-3); min-height: 10rem; }
  .t-map span:last-child { color: var(--muted); font-size: var(--step--1); }
  .t-map:hover { background: #34455a; }

  .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding: 2rem var(--gutter) 2rem; font-size: var(--step--1); color: var(--muted); margin-top: var(--section); }

  @media (max-width: 900px) {
    .nav, .pill { display: none; }
    .burger { display: block; grid-column: 3; }
    .hero { grid-template-rows: auto; min-height: 0; }
    .t-hero, .t-tall, .t-wide, .t-facts { grid-column: 1 / -1; grid-row: auto; }
    .t-tall img { aspect-ratio: 4 / 3; }
    .t-field { grid-column: 1 / -1; }
    .t-why, .t-list { grid-column: 1 / -1; }
    .t-list li { grid-template-columns: 1fr; }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .masonry { columns: 2; }
    .t-contact, .t-cta, .t-map { grid-column: 1 / -1; grid-row: auto; }
    .t-contact dl { grid-template-columns: 1fr; }
  }
  @media (max-width: 560px) {
    .steps { grid-template-columns: 1fr; }
    .masonry { columns: 1; }
  }
}

@layer components {
  .btn {
    display: inline-flex; align-items: center; padding: .85rem 1.3rem; border-radius: 999px;
    background: var(--orange); color: var(--navy); font-weight: 500; font-size: var(--step--1); transition: background .2s, color .2s;
  }
  .btn:hover { background: var(--ink); }
  .btn-ghost { background: var(--navy-3); color: var(--ink); }
  .btn-ghost:hover { background: var(--ink); color: var(--navy); }

  .lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh; color: var(--ink); }
  .lightbox::backdrop { background: color-mix(in oklab, var(--navy) 92%, transparent); }
  .lightbox img { max-height: 82vh; width: auto; margin-inline: auto; border-radius: var(--r); }
  .lightbox-cap { text-align: center; margin-top: .8rem; font-size: var(--step--1); color: var(--muted); }
  .lightbox-close { position: absolute; top: -2.8rem; right: 0; font-size: var(--step--1); font-weight: 500; padding: .4rem .9rem; border-radius: 999px; background: var(--navy-3); }
}

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .hero .tile { opacity: 0; translate: 0 .8rem; animation: tile .7s cubic-bezier(.2,.7,.2,1) forwards; }
    .hero .tile:nth-child(2) { animation-delay: .08s; }
    .hero .tile:nth-child(3) { animation-delay: .16s; }
    .hero .tile:nth-child(4) { animation-delay: .24s; }
  }
  @keyframes tile { to { opacity: 1; translate: 0 0; } }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  }
}
