/* ============================================================
   MELMAR GROUP — Shared styles
   ============================================================ */

:root {
  /* Brand */
  --accent: #E63946;
  --accent-deep: #B81D29;
  --accent-soft: #FBE9EB;

  /* Neutrals — warm */
  --ink: #14110F;
  --ink-2: #2A2724;
  --ink-3: #524E4A;
  --ink-4: #8C8884;
  --line: #E6E2DD;
  --line-2: #D8D2CB;
  --paper: #FBFAF7;
  --paper-2: #F2EFE9;
  --paper-3: #E9E5DD;
  --white: #ffffff;

  /* Type */
  --font-display: "Space Grotesk", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --max: 1320px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 4px;
  --radius-lg: 14px;
  --header-h: 76px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

/* ============================================================
   Type scale
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}
.eyebrow.no-mark::before { display: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(46px, 7.8vw, 112px); letter-spacing: -0.06em; }
h2 { font-size: clamp(38px, 5vw, 74px); }
h3 { font-size: clamp(26px, 3vw, 40px); }
h4 { font-size: clamp(20px, 2vw, 26px); }

p { margin: 0; color: var(--ink-2); text-wrap: pretty; }
.lead { font-size: clamp(17px, 1.4vw, 20px); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }

/* ============================================================
   Header / Nav
   ============================================================ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
  background: transparent;
  border-bottom: 1px solid transparent;
}
.site-header.is-glass {
  background: rgba(251, 250, 247, 0.55);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom-color: rgba(20,17,15,0.06);
}
.site-header.is-solid {
  background: rgba(251,250,247,0.96);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom-color: var(--line);
}
.site-header.on-dark:not(.is-solid):not(.is-glass) { color: #fff; }
.site-header.on-dark:not(.is-solid):not(.is-glass) .nav a { color: rgba(255,255,255,0.92); }
.site-header.on-dark:not(.is-solid):not(.is-glass) .header-phone {
  color: rgba(255,255,255,0.78);
  background: rgba(20,17,15,0.34);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 8px 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header.on-dark:not(.is-solid):not(.is-glass) .header-phone strong { color: #fff; }
.site-header.on-dark:not(.is-solid):not(.is-glass) .logo {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* Logo variant toggle: dark logo by default, light logo on dark hero */
.logo-img.logo-light {
  display: none;
}
.logo-img.logo-dark {
  display: block;
}
.site-header.on-dark:not(.is-solid):not(.is-glass) .logo-img.logo-dark {
  display: none;
}
.site-header.on-dark:not(.is-solid):not(.is-glass) .logo-img.logo-light {
  display: block;
}

.header-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.logo-img {
  height: 58px;
  width: auto;
  flex: none;
  object-fit: contain;
}

.nav {
  justify-self: center;
  display: flex;
  gap: 36px;
  align-items: center;
}
.nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  position: relative;
  padding: 6px 0;
  transition: color .2s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: 14px; justify-self: end; }
.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.header-phone strong { color: var(--ink); font-weight: 500; }
.phone-icon { width: 14px; height: 14px; flex: none; }

/* mobile */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: 0;
  padding: 9px 10px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
}
.nav-toggle span {
  display: block; width: 22px; height: 1.5px; background: currentColor; margin: 5px 0;
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav, .header-phone { display: none; }
  .nav-toggle { display: inline-flex; }
  .header-inner { grid-template-columns: auto 1fr auto; }
  .nav.is-open {
    display: flex;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: var(--paper);
    flex-direction: column;
    padding: 40px var(--gutter);
    gap: 8px;
    z-index: 49;
  }
  .nav.is-open a { font-size: 28px; font-family: var(--font-display); padding: 14px 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  :root { --header-h: 68px; --gutter: 20px; }
  .header-inner { gap: 12px; }
  .logo { gap: 9px; }
  .logo-img { height: 44px; }
  .header-actions { gap: 8px; }
  .header-actions > .btn { display: none; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: none; }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 8px 18px -8px rgba(230,57,70,0.5);
}
.btn-primary:hover { background: var(--accent-deep); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 12px 22px -10px rgba(230,57,70,0.6); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(20,17,15,0.16);
}
.btn-ghost:hover { border-color: var(--ink); background: rgba(20,17,15,0.04); }
.btn-ghost.on-dark { color: #fff; border-color: rgba(255,255,255,0.35); }
.btn-ghost.on-dark:hover { background: rgba(255,255,255,0.08); border-color: #fff; }
.btn .arr {
  width: 14px; height: 14px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover .arr { transform: translateX(2px); }
.btn .arr svg { width: 100%; height: 100%; transition: transform .25s var(--ease); }

/* Link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: gap .25s var(--ease), color .25s var(--ease);
}
.link-arrow:hover { gap: 14px; color: var(--accent); }

/* ============================================================
   Layout helpers
   ============================================================ */
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(80px, 10vw, 140px) 0; }
.section.tight { padding: clamp(56px, 7vw, 96px) 0; }
.section.dark { background: var(--ink); color: var(--paper); }
.section.dark h1, .section.dark h2, .section.dark h3, .section.dark h4 { color: var(--paper); }
.section.dark p { color: rgba(251,250,247,0.78); }
.section.dark .eyebrow { color: rgba(251,250,247,0.6); }
.section.cream { background: var(--paper-2); }

/* ============================================================
   Reveal on scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
.reveal.delay-1 { transition-delay: .04s; }
.reveal.delay-2 { transition-delay: .08s; }
.reveal.delay-3 { transition-delay: .12s; }
.reveal.delay-4 { transition-delay: .16s; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--ink);
  color: rgba(251,250,247,0.78);
  padding: 80px 0 28px;
  font-size: 14px;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 64px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-top h4 {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 18px;
  font-weight: 500;
}
.footer-top ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer-top a { color: rgba(255,255,255,0.85); transition: color .2s var(--ease); }
.footer-top a:hover { color: var(--accent); }
.footer-brand p { color: rgba(255,255,255,0.65); margin-top: 18px; max-width: 36ch; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
@media (max-width: 880px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-bottom { flex-direction: column; gap: 16px; align-items: flex-start; }
}
@media (max-width: 560px) {
  .site-footer { padding: 56px 0 28px; }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { font-size: 12px; }
}

/* ============================================================
   Page header (sub-pages)
   ============================================================ */
.page-head {
  padding: calc(var(--header-h) + 80px) 0 80px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.page-head .crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 24px;
}
.page-head .crumb a { color: var(--ink-3); }
.page-head .crumb a:hover { color: var(--accent); }
.page-head .crumb .sep { margin: 0 10px; opacity: 0.5; }
.page-head h1 { font-size: clamp(56px, 9vw, 132px); }
.page-head .lead { margin-top: 24px; max-width: 56ch; }
.page-head .head-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: end;
}
.page-head .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 32px;
}
.page-head .meta dt { color: var(--ink-3); margin-bottom: 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; }
.page-head .meta dd { margin: 0; color: var(--ink); }
@media (max-width: 880px) { .page-head .head-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .page-head { padding: calc(var(--header-h) + 48px) 0 56px; }
  .page-head h1 { font-size: clamp(44px, 14vw, 64px); letter-spacing: -0.055em; }
  .page-head .lead { margin-top: 12px; font-size: 16px; }
  .page-head .head-grid { gap: 22px; }
}

/* ============================================================
   Card (project)
   ============================================================ */
.proj-card {
  display: block;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}
.proj-card .img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.proj-card .img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--ease), filter .35s var(--ease);
}
.proj-card:hover .img-wrap img { transform: scale(1.025); }
.proj-card .img-wrap::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
}
.proj-card .body {
  position: absolute;
  left: 18px; right: 18px; bottom: 18px;
  color: #fff;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  z-index: 1;
}
.proj-card .body h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.25;
}
.proj-card .body .loc {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}
.proj-card .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.proj-card .arrow-circle {
  position: absolute;
  top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
  transform: translate(6px, -6px);
  opacity: 0;
  transition: all .35s var(--ease);
}
.proj-card:hover .arrow-circle { transform: none; opacity: 1; }

/* ============================================================
   Forms
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field input, .field textarea, .field select {
  font: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  padding: 12px 0;
  color: var(--ink);
  outline: none;
  transition: border-color .2s var(--ease);
  border-radius: 0;
  width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field.error input, .field.error textarea { border-color: var(--accent); }
.field .err-msg {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.dark .field label { color: rgba(255,255,255,0.5); }
.dark .field input,
.dark .field textarea {
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.18);
}
.dark .field input:focus,
.dark .field textarea:focus { border-bottom-color: var(--accent); }

/* ============================================================
   Tweaks panel base (overrides for our context)
   ============================================================ */
.tweaks-panel-fix { z-index: 9999; }

/* Certification badge cards */
.cert-logos {
  display: grid;
  gap: 18px;
  justify-items: end;
}
.cert-logo-card {
  width: min(100%, 680px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  box-shadow: 0 14px 34px -28px rgba(20,17,15,0.42);
}
.cert-logo-card img {
  width: 100%;
  max-height: 84px;
  object-fit: contain;
}
@media (max-width: 880px) {
  .cert-logos { justify-items: stretch; }
  .cert-logo-card { padding: 14px 16px; }
}

/* Color certification badges */
.cert-badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.cert-badge-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: 0 18px 42px -30px rgba(20,17,15,0.46);
}
.cert-badge-card img {
  width: 100%;
  max-width: 148px;
  max-height: 82px;
  object-fit: contain;
}
.cert-badge-card span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
}
@media (max-width: 880px) {
  .cert-badge-grid { grid-template-columns: 1fr; }
  .cert-badge-card { min-height: 126px; }
}

/* Gallery cards: let the photography carry the presentation */
.proj-card .img-wrap::after { display: none; }
.proj-card .arrow-circle {
  background: rgba(20,17,15,0.42);
  border-color: rgba(255,255,255,0.28);
}

@media (max-width: 560px) {
  .logo { min-height: 44px; }
  .info-row dd a { display: inline-flex; min-height: 36px; align-items: center; }
}

@media (max-width: 560px) {
  .modal-close { width: 44px; height: 44px; }
}

/* ============================================================
   Photo Dividers — full-bleed image breaks
   ============================================================ */
.photo-divider {
  position: relative;
  height: 340px;
  overflow: hidden;
  isolation: isolate;
}
.photo-divider-tall {
  height: 420px;
}
.photo-divider-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -2;
  transform: none;
}
.photo-divider-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(20,17,15,0.35) 0%, rgba(20,17,15,0.55) 100%);
}
.photo-divider-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 var(--gutter) 28px;
  max-width: var(--max);
  margin: 0 auto;
}
@media (max-width: 880px) {
  .photo-divider { height: 240px; }
  .photo-divider-tall { height: 300px; }
}
@media (max-width: 560px) {
  .photo-divider { height: 200px; }
  .photo-divider-tall { height: 240px; }
}

/* Footer logo */
.footer-logo {
  height: 72px;
  width: auto;
}
