/* Layout, sizing and typography are driven by CSS custom properties generated by /site.css
   (Admin > Site Settings). Every var() below carries today's hardcoded value as a fallback,
   so the site looks unchanged if /site.css is unavailable.
   Colors come from /theme.css (set in Admin > Site Settings, or per project).
   The values after the commas are fallbacks if that file doesn't load. */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: clip; }
body {
  font-family: var(--font-body, 'Open Sans', sans-serif);
  font-size: var(--font-size, 16px);
  background-color: var(--bg, #181818);
  color: var(--text, #ffffff);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; user-select: none; -webkit-user-drag: none; pointer-events: auto; }

/* Sticky Header */
header {
  position: var(--header-position, sticky);
  top: 0; z-index: 100;
  background-color: var(--header-bg, rgba(24, 24, 24, 0.95));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--header-pad-y, 1.5rem) var(--header-pad-x, 4rem);
  transition: padding 0.3s ease;
}
/* Header layout chosen in Site Settings: logo on the left, nav pushed right. */
header[data-layout="logo-left"] .logo { order: -1; }
header[data-layout="logo-left"] nav { margin-left: auto; }
nav ul { list-style: none; display: flex; gap: 2.5rem; font-size: var(--nav-size, 0.85rem); letter-spacing: var(--nav-spacing, 1.5px); text-transform: var(--nav-transform, uppercase); font-weight: 600; }
nav a { color: var(--muted, #888); transition: color 0.2s ease; }
nav a.active, nav a:hover { color: var(--text, #fff); }
/* V2: the active page is accent-coloured and clearly bolder (same rule applies inside the mobile menu). */
nav a.active { color: var(--nav-active-color, #ff5a36); font-weight: 700; }
.logo { display: block; line-height: 0; }
.logo img { height: var(--logo-height, 40px); width: auto; filter: var(--logo-filter, brightness(0) invert(1)); }
/* A recoloured SVG logo must keep its tint; the theme's invert filter is only for black artwork. */
.logo.logo-tinted img, .footer-logo.logo-tinted { filter: none; }
.logo-text { font-size: 2.5rem; font-weight: 700; letter-spacing: -2px; line-height: 1; }
.menu-toggle { display: none; background: none; border: none; color: var(--text, #fff); font-size: 2rem; cursor: pointer; }

main { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 6rem; }
main.home-page { max-width: var(--home-max, 80vw); }
main.project-page { max-width: 1440px; }

/* Portfolio Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--home-cols, 3), minmax(0, 1fr));
  gap: var(--home-gap-y, 4rem) var(--home-gap-x, 2rem);
}
.project-card { display: flex; flex-direction: column; align-items: center; position: relative; }
.project-card .thumb { width: 100%; aspect-ratio: var(--home-cover-ratio, 4 / 3); border-radius: 8px; overflow: hidden; margin-bottom: 1.25rem; object-fit: var(--home-cover-fit, cover); background: var(--raised, rgba(255, 255, 255, 0.07)); transition: transform 0.35s ease, filter 0.35s ease, opacity 0.35s ease; will-change: transform, filter; }
.project-card h2 { font-size: var(--home-title-size, 1rem); font-weight: var(--home-title-weight, 400); display: var(--home-title-display, block); text-align: center; max-width: 90%; line-height: 1.4; overflow-wrap: break-word; transition: color 0.25s ease; }
/* Portfolio hover (V2): subtle fallback first, then grayscale + zoom. Only transform/filter change,
   so neighbours never move; browsers without filter keep the subtle version. */
@media (hover: hover) {
  .project-card:hover .thumb { opacity: 0.8; transform: scale(1.02); }
  .project-card:hover h2 { color: var(--title-hover-color, #ff5a36); }
  .project-card:hover { z-index: 2; }
  @supports (filter: grayscale(1)) {
    .project-card:hover .thumb { filter: grayscale(1); transform: scale(1.07); opacity: 1; z-index: 2; }
  }
}
/* Touch screens: no hover scaling; pressing a card gives the same colour/grayscale feedback. */
@media (hover: none) {
  .project-card:active .thumb { filter: grayscale(1); transform: scale(1.04); }
  .project-card:active h2 { color: var(--title-hover-color, #ff5a36); }
}

/* Project Page */
.preview-banner { max-width: 760px; margin: 0 auto 2rem; padding: 0.75rem 1rem; text-align: center; font-size: 0.9rem; border: 1px dashed var(--muted, #888); border-radius: 8px; color: var(--muted, #888); }
.project-header { text-align: center; margin-bottom: 3rem; }
.project-header h1 { font-size: clamp(1.45rem, 4.6vw, var(--project-title-size, 2.5rem)); font-weight: var(--heading-weight, 600); margin-bottom: 1rem; overflow-wrap: break-word; hyphens: auto; }
.project-description { color: var(--muted, #aaa); max-width: var(--project-desc-width, 600px); margin: 1rem auto 0; white-space: pre-line; overflow-wrap: break-word; }

/* How wide the images are on the page, and the space between them (set per project in the admin) */
.project-blocks { display: flex; flex-direction: column; gap: 2rem; max-width: 1100px; margin: 0 auto; }
.project-blocks[data-width="640"] { max-width: 640px; }
.project-blocks[data-width="860"] { max-width: 860px; }
.project-blocks[data-width="1400"] { max-width: 1400px; }
.project-blocks[data-gap="0"] { gap: 0; }
.project-blocks[data-gap="1"] { gap: 1rem; }
.project-blocks[data-gap="4"] { gap: 4rem; }
.project-empty { text-align: center; color: var(--muted, #888); padding: 2rem; border: 1px dashed var(--border, #444); border-radius: 8px; }

.block-single img { width: 100%; height: auto; border-radius: 8px; cursor: zoom-in; display: block; }
.block-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
/* Grid columns and spacing, chosen in the admin layout editor */
.block-grid[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
.block-grid[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.block-grid[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.block-grid[data-cols="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.block-grid[data-cols="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.block-grid[data-gap="0"] { gap: 0; }
.block-grid[data-gap="0.5"] { gap: 0.5rem; }
.block-grid[data-gap="3"] { gap: 3rem; }
.block-grid img { display: block; width: 100%; height: auto; border-radius: 8px; cursor: zoom-in; transition: opacity 0.2s; }
.block-grid img:hover { opacity: 0.8; }
.block-embed { width: 100%; border-radius: 8px; overflow: hidden; background: #000; }
.block-embed iframe { width: 100% !important; min-height: 600px; border: none; display: block; }

/* Back to Top */
.back-to-top { display: block; width: max-content; margin: 4rem auto 0; padding: 0.75rem 1.5rem; background: var(--raised, #222); border: 1px solid var(--border, #444); border-radius: 30px; color: var(--muted, #aaa); font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s; }
.back-to-top:hover { background: var(--text, #fff); color: var(--bg, #000); border-color: var(--text, #fff); }

/* Carousel */
.carousel-section { margin-top: 6rem; border-top: 1px solid var(--border, #333); padding-top: 3rem; }
.carousel-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 2px; color: var(--muted, #888); margin-bottom: 1.5rem; }
.carousel { display: flex; gap: 2rem; overflow-x: auto; padding-bottom: 1rem; scroll-snap-type: x mandatory; }
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--border, #444); border-radius: 3px; }
.carousel-item { flex: 0 0 var(--carousel-item-width, 280px); scroll-snap-align: start; }
.carousel-item img { width: 100%; aspect-ratio: var(--carousel-cover-ratio, 4 / 3); object-fit: cover; border-radius: 8px; margin-bottom: 0.75rem; transition: opacity 0.2s; }
.carousel-item:hover img { opacity: 0.8; }
.carousel-item h3 { font-size: 0.95rem; font-weight: 400; text-align: center; }

/* Contact Page */
main.contact-page { max-width: 680px; }
.contact-form { display: flex; flex-direction: column; gap: 1.5rem; }
.contact-email { margin-top: 1rem; color: var(--muted, #aaa); font-size: 0.9rem; }
.contact-email a { color: var(--text, #fff); border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.2)); padding-bottom: 1px; }
.contact-email a:hover { border-bottom-color: var(--text, #fff); }
.field label { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted, #aaa); margin-bottom: 0.5rem; }
.req { font-size: 0.65rem; letter-spacing: 0.5px; padding: 1px 7px; border-radius: 10px; background: #e63946; color: #fff; text-transform: uppercase; }
.field.done .req { display: none; }
.field input, .field textarea { width: 100%; padding: 0.85rem 1rem; font: inherit; color: var(--text, #fff); background: var(--raised, rgba(255, 255, 255, 0.07)); border: 1px solid var(--border, rgba(255, 255, 255, 0.12)); border-radius: 8px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--text, #fff); }
.field.has-error input, .field.has-error textarea { border-color: #e63946; }
.field-error, .form-error { color: #ff6b76; font-size: 0.85rem; margin-top: 0.4rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-submit { align-self: flex-start; padding: 0.85rem 2rem; font: inherit; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; font-size: 0.85rem; color: var(--bg, #181818); background: var(--text, #fff); border: none; border-radius: 30px; cursor: pointer; transition: opacity 0.2s; }
.contact-submit:disabled { opacity: 0.35; cursor: not-allowed; }
.contact-hint { font-size: 0.85rem; color: var(--muted, #888); margin-top: -0.75rem; }
.contact-sent { text-align: center; padding: 3rem 1rem; border: 1px solid var(--border, #333); border-radius: 8px; }
.contact-sent h2 { font-size: 1.4rem; font-weight: var(--heading-weight, 600); margin-bottom: 0.5rem; }
.contact-sent p { color: var(--muted, #aaa); }
.contact-sent .back-to-top { margin-top: 2rem; }

/* About Page (site root) */
main.about-page { max-width: none; margin: 0; padding: 0; }
.about-container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: clamp(1.5rem, 5vw, 4rem); }
.about-hero { padding-block: clamp(3rem, 6vw, 5.5rem) clamp(2.5rem, 5vw, 4.5rem); }
.about-hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 4.5vw, 4rem); align-items: center; }
.about-eyebrow { font-family: var(--font-body, 'Open Sans', sans-serif); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted, #888); margin-bottom: clamp(0.9rem, 2vw, 1.4rem); }
.about-headline { font-family: var(--font-display, 'Open Sans', sans-serif); font-size: clamp(2.4rem, 4.2vw, 3.7rem); font-weight: var(--heading-weight, 600); line-height: 1.06; letter-spacing: -0.02em; }
.about-subhead { font-family: var(--font-body, 'Open Sans', sans-serif); font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 400; line-height: 1.55; color: var(--muted, #aaa); margin-top: 0.9rem; }
.about-roles { font-family: var(--font-display, 'Open Sans', sans-serif); font-size: clamp(1.7rem, 2.8vw, 2.35rem); font-weight: 500; line-height: 1.25; margin-top: clamp(1.5rem, 3vw, 2rem); min-height: 1.35em; }
.about-role { display: inline-block; transition: opacity 0.24s ease, transform 0.24s ease; }
.about-role.is-changing { opacity: 0; transform: translateY(0.2em); }
.about-roles-data { display: none; }
.about-photo { margin: 0; }
/* No border/frame: the headshot sits cleanly inside the page gutters and uses the same crop at
   every breakpoint. */
.about-photo-frame { margin: 0; padding: 0; border: 0; background: transparent; border-radius: 16px; overflow: hidden; }
.about-photo-frame img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 16px; }
.about-monogram { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 5; border-radius: 16px; background: radial-gradient(circle at 28% 18%, var(--raised, rgba(255, 255, 255, 0.08)), transparent 62%), var(--bg, #181818); color: var(--accent, #ff5a36); font-family: var(--font-display, 'Open Sans', sans-serif); font-size: clamp(4rem, 11vw, 8rem); line-height: 1; letter-spacing: -0.02em; }
.about-section { padding-block: clamp(2.5rem, 5vw, 4.5rem); border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1)); }
.about-intro { background: var(--raised, rgba(255, 255, 255, 0.04)); }
/* Intro and quote use the same left/right bounds as the hero grid; paragraphs stack vertically. */
.about-intro-copy p { font-family: var(--font-body, 'Open Sans', sans-serif); font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.75; margin: 0 0 1.6em; }
.about-intro-copy p:last-child { margin-bottom: 0; }
.about-quote-block { margin: 0; max-width: none; }
.about-quote-text { font-family: var(--font-display, 'Open Sans', sans-serif); font-size: clamp(1.9rem, 3.4vw, 3rem); font-weight: 500; line-height: 1.16; letter-spacing: -0.01em; }
.about-quote-support { max-width: none; margin-top: clamp(1rem, 2vw, 1.5rem); color: var(--muted, #aaa); font-size: 1rem; line-height: 1.6; }
.about-cta { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(3.5rem, 7vw, 6rem); text-align: center; }
.about-cta .about-container { display: flex; justify-content: center; }
.about-cta-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.9rem 2.1rem; border: 1px solid var(--text, #fff); border-radius: 999px; font-family: var(--font-body, 'Open Sans', sans-serif); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text, #fff); transition: color 0.2s ease, border-color 0.2s ease; }
.about-cta-button:hover { color: var(--accent, #ff5a36); border-color: var(--accent, #ff5a36); }
.about-cta-button:focus-visible { color: var(--accent, #ff5a36); border-color: var(--accent, #ff5a36); outline: 2px solid var(--accent, #ff5a36); outline-offset: 4px; }

/* Footer */
/* main already ends with 6rem of bottom padding, so the footer border sits below that gap */
.site-footer { padding: 2.5rem 1.5rem 3rem; border-top: 1px solid var(--border, rgba(255, 255, 255, 0.12)); color: var(--muted, #888); font-size: 0.85rem; text-align: center; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.footer-logo { height: 24px; width: auto; opacity: 0.8; filter: var(--logo-filter, brightness(0) invert(1)); }
.footer-social { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.5rem; }
/* The empty list is kept in the DOM for the admin's live preview; it takes no visual space. */
.footer-social:empty { display: none; }
.footer-social a { color: var(--muted, #888); font-size: 0.72rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; transition: color 0.2s ease; }
.footer-social a:hover, .footer-social a:focus-visible { color: var(--text, #fff); }
.footer-copy { margin: 0; }

/* Lightbox */
.lightbox { display: none; position: fixed; z-index: 1000; inset: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.lightbox.active { display: flex; opacity: 1; }
.lightbox img { max-width: 90%; max-height: 90vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); cursor: zoom-out; }
.lightbox-close { position: absolute; top: 20px; right: 40px; font-size: 3rem; color: #fff; cursor: pointer; font-weight: 300; }

/* Responsive: scale the settings instead of overwriting them */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(var(--home-cols-mobile, 1), minmax(0, 1fr)); }
  main.home-page { max-width: 100%; }
  /* About page: single column, text first, then the same portrait crop as desktop. */
  .about-hero-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  header { padding: calc(var(--header-pad-y, 1.5rem) * 0.66) calc(var(--header-pad-x, 4rem) * 0.375); }
  .logo img { height: calc(var(--logo-height, 40px) * 0.75); }
  .logo-text { font-size: 1.8rem; }
  .menu-toggle { display: block; }
  nav { position: absolute; top: 100%; left: 0; width: 100%; background: var(--bg, #181818); padding: 1rem 0; border-bottom: 1px solid var(--border, #333); display: none; }
  nav.active { display: block; }
  nav ul { flex-direction: column; align-items: center; gap: 1.5rem; padding: 1rem 0; }
  .grid { gap: calc(var(--home-gap-y, 4rem) * 0.75) calc(var(--home-gap-x, 2rem) * 0.75); }
  /* On phones, grids wider than 2 columns drop to 2 so images stay a usable size */
  .block-grid[data-cols] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .block-grid[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
  .block-embed iframe { min-height: 400px; }
  .carousel-item { flex: 0 0 calc(var(--carousel-item-width, 280px) * 0.857); }
}

/* About page: phones — tighter type scale and a full-width, easy-to-tap CTA */
@media (max-width: 600px) {
  .about-headline { font-size: clamp(2rem, 8.6vw, 2.8rem); }
  .about-subhead { font-size: 1rem; }
  .about-roles { font-size: clamp(1.45rem, 6.4vw, 2rem); }
  .about-quote-text { font-size: clamp(1.6rem, 6.4vw, 2.2rem); }
  .about-cta .about-container { display: block; }
  .about-cta-button { display: flex; width: 100%; }
}

/* Very narrow phones: trim the chrome so titles and images keep the full width */
@media (max-width: 480px) {
  header { padding: calc(var(--header-pad-y, 1.5rem) * 0.55) calc(var(--header-pad-x, 4rem) * 0.25); }
  main { padding: 2rem 1rem 4rem; }
  .project-header { margin-bottom: 2rem; }
  .project-header h1 { font-size: clamp(1.45rem, 8vw, calc(var(--project-title-size, 2.5rem) * 0.76)); }
  .project-description { font-size: 0.95rem; }
  .block-embed iframe { min-height: 320px; }
  .carousel-item { flex: 0 0 calc(var(--carousel-item-width, 280px) * 0.714); }
  .back-to-top { margin-top: 3rem; }
  .site-footer { padding: 2rem 1rem 2.5rem; }
}

/* Reduced motion: the roles script already stops; drop its fade transition too. */
@media (prefers-reduced-motion: reduce) {
  .about-role { transition: none; }
  .project-card .thumb { transition: none; }
}
