/* Delightful Designs
   Colours come from the supplied palette only. */

:root {
  --orange: #E0603B;
  --cream: #FCF4E9;
  --indigo: #4E4FBB;
  --butter: #FCF8B1;
  --lilac: #D4A5DC;
  --peach: #F6C7AB;
  --maroon: #5D0F0F;
  --periwinkle: #B2C8F9;
  --olive: #A1AA35;
  --lime: #CCE16C;

  --paper: var(--cream);
  --ink: var(--maroon);
  --link: var(--indigo);
  --focus: var(--indigo);

  --pad: clamp(20px, 4vw, 56px);
  --gutter: clamp(12px, 2.2vw, 24px);
  --radius: clamp(20px, 3vw, 32px);

  --font-display: "Bricolage Grotesque", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body:has(dialog[open]) { overflow: hidden; }

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

a { color: var(--link); }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 85%;
  line-height: 1;
  letter-spacing: -0.02em;
}

p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--pad);
  top: -100px;
  z-index: 10;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--indigo);
  color: var(--cream);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; --focus: var(--indigo); }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
}

.brand { display: block; line-height: 0; }
.brand img { height: clamp(56px, 8vw, 76px); width: auto; }

.site-nav { display: flex; gap: 6px; }

.site-nav a {
  padding: 10px 20px;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s;
}
.site-nav a:hover { background: var(--butter); }
.site-nav a[aria-current="page"] { background: var(--maroon); color: var(--cream); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 14px 28px;
  border: 2px solid var(--indigo);
  border-radius: 999px;
  background: var(--indigo);
  color: var(--cream);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--maroon); border-color: var(--maroon); }
.btn--ghost { background: transparent; color: var(--indigo); }
.btn--ghost:hover { background: var(--indigo); border-color: var(--indigo); color: var(--cream); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
  padding: clamp(24px, 5vw, 72px) var(--pad) clamp(40px, 7vw, 96px);
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(2.9rem, 7.4vw, 6.4rem);
  line-height: 0.95;
}

.hero p {
  max-width: 34ch;
  margin-top: clamp(18px, 2.5vw, 28px);
  font-size: 1.25rem;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: none;
  margin-top: clamp(24px, 3vw, 36px);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
  width: min(100%, 460px);
  justify-self: end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 6;
  border-radius: clamp(12px, 2vw, 22px);
  background: var(--t-bg);
  animation: tile-in 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards;
  animation-delay: calc(var(--i) * 70ms);
}
.tile svg { width: 64%; height: auto; fill: var(--t-fg); }

.tile:nth-child(1) { --i: 0; --t-bg: var(--orange);     --t-fg: var(--lilac); }
.tile:nth-child(2) { --i: 1; --t-bg: var(--cream);      --t-fg: var(--orange); }
.tile:nth-child(3) { --i: 2; --t-bg: var(--indigo);     --t-fg: var(--periwinkle); }
.tile:nth-child(4) { --i: 3; --t-bg: var(--butter);     --t-fg: var(--indigo); }
.tile:nth-child(5) { --i: 4; --t-bg: var(--lilac);      --t-fg: var(--peach); }
.tile:nth-child(6) { --i: 5; --t-bg: var(--peach);      --t-fg: var(--maroon); }
.tile:nth-child(7) { --i: 6; --t-bg: var(--maroon);     --t-fg: var(--lime); }
.tile:nth-child(8) { --i: 7; --t-bg: var(--periwinkle); --t-fg: var(--butter); }
.tile:nth-child(9) { --i: 8; --t-bg: var(--olive);      --t-fg: var(--cream); }

/* The cream tile sits on the cream page, so give it an edge */
.tile:nth-child(2) { box-shadow: inset 0 0 0 2px var(--peach); }

@keyframes tile-in {
  from { opacity: 0; transform: scale(0.6) rotate(-6deg); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Home: projects ---------- */

.work { padding-bottom: var(--gutter); }

.project {
  --focus: var(--indigo);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  margin: 0 var(--gutter) var(--gutter);
  padding: clamp(24px, 5vw, 72px);
  border-radius: var(--radius);
  background: var(--p-bg);
  color: var(--p-ink);
}
.project:last-child { margin-bottom: 0; }

.project--indigo { --p-bg: var(--indigo); --p-ink: var(--cream);  --focus: var(--butter); }
.project--peach  { --p-bg: var(--peach);  --p-ink: var(--maroon); --focus: var(--indigo); }
.project--olive  { --p-bg: var(--olive);  --p-ink: var(--maroon); --focus: var(--maroon); }
.project--lilac  { --p-bg: var(--lilac);  --p-ink: var(--maroon); --focus: var(--indigo); }
.project--maroon { --p-bg: var(--maroon); --p-ink: var(--cream);  --focus: var(--butter); }

.project--flip .project__text { order: 2; }

.project__text h3 {
  font-size: clamp(2.4rem, 5.4vw, 4.6rem);
  line-height: 0.95;
}

.project__type {
  margin-top: 18px;
  font-weight: 700;
  font-size: 1.1rem;
}

.project__desc {
  max-width: 42ch;
  margin-top: 10px;
}

.project__media { justify-self: center; width: min(100%, 500px); }

.shot {
  display: block;
  overflow: hidden;
  border-radius: clamp(12px, 1.6vw, 18px);
  line-height: 0;
  cursor: zoom-in;
}
.shot img { width: 100%; height: auto; transition: transform 0.35s ease; }
.shot:hover img { transform: scale(1.025); }

/* Grouped project (several images, one design) */

.project--group {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.project--group .project__media {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(10px, 2vw, 24px);
  width: 100%;
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: var(--gutter);
  padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 48px);
  border-radius: var(--radius);
  background: var(--maroon);
  color: var(--cream);
  --focus: var(--butter);
}
.site-footer a { color: var(--cream); font-weight: 700; }
.site-footer nav { display: flex; gap: 20px; }

/* ---------- Contact page ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 72px);
  margin: 0 var(--gutter);
  padding: clamp(24px, 5vw, 72px);
  border-radius: var(--radius);
  background: var(--periwinkle);
  --focus: var(--indigo);
}

.contact h1 { font-size: clamp(2.8rem, 7vw, 5.6rem); line-height: 0.95; }
.contact__intro p { max-width: 36ch; margin-top: 20px; font-size: 1.15rem; }
.contact__intro .btn { margin-top: 28px; }
.contact__intro noscript { display: block; margin-top: 20px; font-weight: 700; }

.form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }
.field label { font-weight: 700; }

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--maroon);
  border-radius: 16px;
  background: var(--cream);
  color: var(--maroon);
  font: inherit;
}
.field textarea { min-height: 180px; resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
.field input:user-invalid,
.field textarea:user-invalid { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }

/* Honeypot: hidden from people, visible to simple bots */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

.status { min-height: 1.6em; font-weight: 700; }
.status[data-state="error"] { color: var(--maroon); }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
}
.lightbox[open] {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 72px 16px 20px;
}
.lightbox::backdrop { background: rgb(93 15 15 / 0.92); }

.lightbox img {
  max-width: min(92vw, 900px);
  max-height: calc(100dvh - 190px);
  width: auto;
  height: auto;
  border-radius: 16px;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  --focus: var(--butter);
}

.lightbox__caption { max-width: 60ch; text-align: center; font-weight: 700; }

.lightbox button {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--maroon);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.lightbox button:hover { background: var(--butter); }
.lightbox .lightbox__close { position: absolute; top: 16px; right: 16px; --focus: var(--butter); }
.lightbox [hidden] { display: none; }
.lightbox { --focus: var(--butter); }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .tiles { justify-self: start; width: min(100%, 380px); }

  .project,
  .contact { grid-template-columns: minmax(0, 1fr); }
  .project--flip .project__text { order: 0; }
  .project__media { width: min(100%, 440px); justify-self: start; }
}

@media (max-width: 640px) {
  .site-nav a { padding: 10px 14px; }

  .project--group .project__media {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    width: calc(100% + 2 * clamp(24px, 5vw, 72px));
    margin-inline: calc(-1 * clamp(24px, 5vw, 72px));
    padding-inline: clamp(24px, 5vw, 72px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: clamp(24px, 5vw, 72px);
    overscroll-behavior-x: contain;
  }
  .project--group .shot { scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile { animation: none; }
  .shot img { transition: none; }
  .shot:hover img { transform: none; }
}
