:root {
  /* Change these to recolour the whole site */
  --bg: #4a6073;      /* page colour, also the tint of the home photo */
  --fg: #ffffff;      /* text and lines */
  --accent: #f3c64c;  /* active menu item, hover */

  --soft: rgba(255, 255, 255, 0.78);
  --line: rgba(255, 255, 255, 0.55);
  --panel: rgba(0, 0, 0, 0.14);
  --font: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --gutter: clamp(18px, 8vw, 150px);
  --gap: clamp(10px, 1.4vw, 20px);
  color-scheme: dark;
}

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

html { height: 100%; background: var(--bg); }

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-underline-offset: 0.25em; }
a:hover { color: var(--accent); }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header: logo with a vertical rule, menu items with a line above */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px clamp(20px, 3vw, 44px);
  padding: clamp(18px, 3vw, 36px) var(--gutter) 0;
}
.brand {
  padding-left: 10px;
  border-left: 2px solid var(--fg);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.15;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--fg); }
.site-nav { display: flex; flex: 1; flex-wrap: wrap; gap: 14px 6px; max-width: 880px; padding-top: 3px; }
.site-nav a {
  flex: 1 0 auto;
  min-width: 84px;
  padding: 9px 22px 0 6px;
  border-top: 1px solid var(--line);
  font-size: 0.73rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
}
.site-nav a:hover { border-top-color: var(--fg); color: var(--fg); }
.site-nav a[aria-current="page"] { padding-top: 7px; border-top: 3px solid var(--accent); }
@media (max-width: 640px) {
  .site-nav { flex-basis: 100%; }
  .site-nav a { flex: 1 0 30%; min-width: 0; padding-right: 6px; }
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: auto;
  padding: 28px var(--gutter) clamp(18px, 3vw, 32px);
  font-size: 0.73rem;
}
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.socials { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }

/* Home: one photo filling the screen, tinted in the page colour */
.home-image { position: fixed; inset: 0; z-index: -1; background: var(--bg); }
.home-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(0.95) brightness(1.1);
  mix-blend-mode: multiply;
}
.home { background: none; }
.home main { flex: 1; }
.home .site-header, .home .site-footer { text-shadow: 0 0 12px rgba(0, 0, 0, 0.35); }

/* Inner pages */
.page { width: 100%; padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(32px, 5vw, 64px); }

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta {
  display: block;
  margin: 6px 0 0;
  color: var(--soft);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro, .text { max-width: 46em; margin: clamp(20px, 3vw, 32px) 0 0; font-weight: 300; font-size: 1.05rem; }
.intro[hidden] { display: none; }
.text p { margin: 0 0 1.2em; }
.text strong { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* About: photo on the left, text on the right */
.about {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.about-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--panel); }
@media (max-width: 800px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 360px; }
}

/* Contact: details and form on the left, map on the right */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 800px) { .contact { grid-template-columns: 1fr; } }

.icon-links { display: flex; gap: 14px; margin: 0; }
.icon-links a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); }
.icon-links a:hover { border-color: var(--accent); }
.icon-links svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.form { display: grid; gap: 16px; margin-top: clamp(16px, 2vw, 24px); }
.form label { display: grid; gap: 6px; font-size: 0.73rem; letter-spacing: 0.08em; text-transform: uppercase; }
.form input, .form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form button {
  justify-self: start;
  padding: 12px 40px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.form button:hover { background: var(--accent); border-color: var(--accent); }
.form button:disabled { opacity: 0.6; cursor: default; }
.form-status { min-height: 1.7em; margin: 0; font-size: 0.9rem; }

.map {
  display: block;
  height: clamp(320px, 60vh, 620px);
  margin-top: clamp(20px, 3vw, 32px);
  overflow: hidden;
  background: var(--panel);
}
.map img { width: 100%; height: 100%; object-fit: cover; object-position: 58% 56%; filter: grayscale(1) contrast(0.95); transition: transform 0.7s ease; }
.map:hover img { transform: scale(1.04); }

.links { display: flex; flex-wrap: wrap; gap: 12px; margin: clamp(24px, 4vw, 40px) 0 0; }
.links a {
  padding: 11px 26px;
  border: 1px solid var(--line);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.links a:hover { border-color: var(--accent); }

.back {
  display: inline-block;
  margin-bottom: clamp(20px, 3vw, 32px);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

/* Project cards */
.projects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 48px) var(--gap);
  margin-top: clamp(28px, 4vw, 48px);
}
@media (max-width: 1000px) { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .projects { grid-template-columns: 1fr; } }

.card { display: block; text-decoration: none; }
.card:hover { color: var(--fg); }
.card-image { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--panel); }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s ease; }
.card:hover .card-image img { transform: scale(1.07); }
.card-title {
  display: block;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}
.card:hover .card-title { border-top-color: var(--accent); }

/* Project gallery */
.gallery { columns: 3; column-gap: var(--gap); margin-top: clamp(28px, 4vw, 48px); }
@media (max-width: 1000px) { .gallery { columns: 2; } }
@media (max-width: 560px) { .gallery { columns: 1; } }

.gallery-item {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0 0 var(--gap);
  padding: 0;
  border: 0;
  background: var(--panel);
  cursor: zoom-in;
  break-inside: avoid;
  overflow: hidden;
}
.gallery-item img { width: 100%; transition: opacity 0.3s ease; }
.gallery-item:hover img { opacity: 0.85; }

.next-project {
  display: block;
  margin-top: clamp(32px, 5vw, 64px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.next-project[hidden] { display: none; }
.next-title {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Photo viewer */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--bg) 22%, #000);
  color: var(--fg);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: color-mix(in srgb, var(--bg) 22%, #000); }
.lightbox figure { margin: 0; padding: 56px 64px; text-align: center; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 150px); margin: 0 auto; object-fit: contain; }
.lightbox figcaption { margin-top: 14px; font-size: 0.73rem; letter-spacing: 0.08em; text-transform: uppercase; }
.lb-btn {
  position: absolute;
  appearance: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.12); }
.lb-close { top: 12px; right: 12px; font-size: 2rem; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
@media (max-width: 560px) {
  .lightbox figure { padding: 56px 12px 72px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; }
  .lb-prev { left: calc(50% - 54px); }
  .lb-next { right: calc(50% - 54px); }
}

@media (prefers-reduced-motion: reduce) {
  .card-image img, .gallery-item img { transition: none; }
}
