/* stephenkelman.co.uk — replica stylesheet
   Type scale + palette are the measured values from docs/design-reference/.
   Layout metrics (grid margins, gutters, masthead spacing) are approximate and
   refined against the live site in the parity check. */

:root {
  --font-sans: "neue-haas-grotesk-text", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "le-monde-livre", Georgia, "Times New Roman", serif;

  --c-text: #282828;      /* primary */
  --c-secondary: #636569; /* h1, body, project titles */
  --c-muted: #939393;     /* nav */
  --c-faint: #b9b9b9;     /* footer */
  --c-accent: #ef4023;    /* CTA outline/text */
  --c-bg: #ffffff;

  --maxw-page: 1400px;
  --maxw-project: 1200px;
  --maxw-narrow: 700px;
  --grid-gap: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 24px;
  color: var(--c-secondary);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: #fff;
  padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 38px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--page-bg, #fff);
}
.primary-nav { justify-self: start; }
.nav-menu {
  display: flex; gap: 24px; list-style: none; margin: 0; padding: 0;
}
.nav-menu a {
  font-size: 15px; line-height: 24px; color: var(--c-muted);
}
.nav-menu a:hover, .nav-menu a[aria-current="page"] { color: var(--c-text); }

.logo { justify-self: center; }
.logo img { width: 52px; height: 44px; }

.social {
  justify-self: end;
  display: flex; gap: 18px; list-style: none; margin: 0; padding: 0;
  align-items: center;
}
.social a { color: var(--c-muted); display: inline-flex; }
.social a:hover { color: var(--c-text); }
.social svg { width: 18px; height: 18px; fill: currentColor; }

.nav-toggle { display: none; }

/* ---------- Dark pages (html bg is black on live; body transparent) ----------
   Live keeps nav/social at #939393 on dark pages — only the project title lifts
   to #bfbfbf (verified against live). */
.theme-dark .project-title { color: #bfbfbf; }
.theme-dark .nav-menu { background: var(--page-bg, #000); }  /* mobile menu panel */

/* ---------- Masthead (home) ---------- */
.masthead {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 88px 24px 64px;
}
.masthead-title {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: 31px;
  line-height: 42px;
  color: var(--c-secondary);
  margin: 0 auto;
  max-width: 640px;
}
.masthead-sub {
  font-size: 15px; line-height: 24px; color: var(--c-secondary);
  margin: 24px auto 0; max-width: 560px;
}
.masthead-buttons {
  display: flex; justify-content: center; gap: 16px; margin-top: 40px;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  font-size: 15px; line-height: 1;
  color: var(--c-accent);
  border: 1px solid var(--c-accent);
  border-radius: 20px;
  padding: 12px 22px;
  transition: background .15s ease, color .15s ease;
}
.btn:hover { background: var(--c-accent); color: #fff; }

/* ---------- Project grid (home) ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
  max-width: var(--maxw-page);
  margin: 0 auto;
  padding: 0 40px 64px;
}
.grid-item { position: relative; display: block; overflow: hidden; background: #fff; aspect-ratio: 202 / 158; }
.grid-cover { display: block; width: 100%; height: 100%; }
.grid-cover picture { display: block; width: 100%; height: 100%; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s ease; }
/* Rollover (matches live): cover fades to near-white, project title fades in
   in dark grey, centred, over the washed-out cover. */
.grid-item:hover img, .grid-item:focus-visible img { opacity: .08; }
.grid-title {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center;
  font-size: 15px; line-height: 22px; color: #565656;
  opacity: 0; transition: opacity .2s ease;
}
.grid-item:hover .grid-title, .grid-item:focus-visible .grid-title { opacity: 1; }

/* ---------- Project page ---------- */
.project { padding: 24px 24px 64px; }
.project-title {
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 24px;
  color: var(--c-secondary);
  margin: 24px 0 48px;
}
.project-modules {
  max-width: var(--maxw-project);
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 24px;
}
.project-image { margin: 0; }
.project-image img { width: 100%; cursor: zoom-in; }

/* Text + button modules (interleaved with images).
   Block is centred (max-width + auto margins); text itself reads left — Adobe's
   align-center centres the block, not the copy. */
.project-text { font-size: 15px; line-height: 24px; margin: 16px auto; max-width: 720px; text-align: left; }
.project-text.align-right { text-align: right; }
.project-text p { margin: 0; }
.project-button { text-align: center; margin: 12px 0; }
.project-embed { margin: 16px auto; width: 100%; }
.project-embed .embed-ratio { position: relative; height: 0; }
.project-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ---------- Narrow pages (about / contact) ---------- */
.page-narrow { max-width: var(--maxw-narrow); margin: 0 auto; padding: 24px 24px 64px; }
.about-image { margin: 0 0 32px; }
.about-text p, .contact-intro p { margin: 0 0 20px; }
.contact-heading { font-size: 15px; font-weight: 700; color: var(--c-text); margin: 0 0 20px; }

/* ---------- Contact form ---------- */
.contact-form { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.contact-form input, .contact-form textarea {
  font-family: var(--font-sans); font-size: 15px; color: var(--c-text);
  padding: 14px 16px; border: 1px solid #ddd; border-radius: 2px; width: 100%;
}
.contact-form textarea { resize: vertical; }
.contact-form button {
  align-self: flex-start;
  font-family: var(--font-sans); font-size: 15px; color: var(--c-secondary);
  background: none; border: 1px solid #ccc; border-radius: 2px;
  padding: 12px 28px; cursor: pointer;
}
.contact-form button:hover { border-color: var(--c-text); color: var(--c-text); }

/* ---------- 404 ---------- */
.error-page { text-align: center; max-width: 560px; margin: 0 auto; padding: 80px 24px 100px; }
.error-title { font-family: var(--font-serif); font-weight: 300; font-size: 31px; line-height: 42px; color: var(--c-secondary); margin: 0 0 16px; }
.error-page .btn { margin-top: 24px; }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 40px 24px 48px; }
.site-footer p { font-size: 12px; line-height: 20px; color: var(--c-faint); margin: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(255,255,255,.97);
  display: none; align-items: center; justify-content: center; z-index: 200;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; width: auto; height: auto; }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; font-size: 28px;
  background: none; border: 0; color: var(--c-text); cursor: pointer; line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .site-header { grid-template-columns: auto 1fr auto; padding: 20px; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 28px; height: 28px; background: none; border: 0; cursor: pointer; padding: 0;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--c-text); width: 24px; }
  .nav-menu {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 20px; background: #fff; padding: 24px 20px;
    align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.06); z-index: 50;
  }
  .primary-nav.open .nav-menu { display: flex; }
  .nav-menu a { font-size: 22px; line-height: 32px; }

  .masthead-title { font-size: 18px; line-height: 24px; }
  .masthead { padding: 24px 20px 48px; }
  .project-grid { grid-template-columns: repeat(2, 1fr); padding: 0 20px 48px; }
}

@media (max-width: 520px) {
  .masthead-title { font-size: 16px; line-height: 22px; }
  .masthead-buttons { flex-direction: column; align-items: center; }
  .project-grid { grid-template-columns: 1fr; }
  .logo img { width: 44px; height: 37px; }
}
