/* =========================================================
   Max Gershberg | personal site
   Palette drawn from the FoodXChange brand (thefoodxchange.com)
   ========================================================= */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Brand */
  --forest: #14261c;      /* deepest green, dark sections */
  --forest-2: #1b2e23;    /* headings on light */
  --green: #1e6b45;       /* primary brand green */
  --green-soft: #e3eee6;  /* tint for badges */
  --gold: #a2762a;        /* accent rule, small details */

  /* Neutrals */
  --cream: #fbf8f1;       /* page background */
  --paper: #fffdf8;       /* cards */
  --sand: #f3eee1;        /* alternate section */
  --line: #e7e0d0;
  --ink: #1b2e23;
  --muted: #5b6c63;

  /* On dark */
  --on-dark: #f3efe4;
  --on-dark-muted: #b9c7bd;
  --line-dark: rgba(251, 248, 241, 0.14);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 38, 28, 0.06), 0 12px 32px -12px rgba(20, 38, 28, 0.18);
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(72px, 10vw, 128px) 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--paper); padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

h1, h2, h3 { color: var(--forest-2); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: clamp(2.3rem, 5vw, 4rem); }
h2 em, h1 em { color: var(--green); font-size: 1.08em; line-height: 0.9; }
h3 { font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.2; }

.kicker {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green); margin-bottom: 18px;
}
.kicker-light { color: #8fc4a3; }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 24px; border-radius: 999px;
  background: var(--green); color: #fff;
  font-weight: 600; font-size: 0.95rem; line-height: 1;
  border: 1.5px solid var(--green);
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-2px); background: #185a39; box-shadow: 0 10px 22px -10px rgba(30, 107, 69, .6); }
.btn-ghost { background: transparent; color: var(--forest-2); border-color: var(--line); background: var(--paper); }
.btn-ghost:hover { background: var(--paper); border-color: var(--green); box-shadow: none; }
.btn-light { background: var(--cream); color: var(--forest); border-color: var(--cream); }
.btn-light:hover { background: #fff; }
.btn-outline-light { background: transparent; color: var(--on-dark); border-color: rgba(251,248,241,.35); }
.btn-outline-light:hover { background: rgba(251,248,241,.08); border-color: var(--on-dark); box-shadow: none; }
.btn-small { padding: 10px 18px; font-size: 0.88rem; }

.link { display: inline-flex; gap: 6px; font-weight: 600; color: var(--green); border-bottom: 1.5px solid currentColor; padding-bottom: 3px; }
.link:hover { color: var(--forest-2); }
.link-light { font-weight: 600; color: var(--on-dark); border-bottom: 1.5px solid rgba(251,248,241,.4); padding-bottom: 3px; }
.link-light:hover { border-color: var(--on-dark); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 248, 241, 0.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; color: var(--forest-2); }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 30px; font-size: 0.93rem; font-weight: 500; color: var(--muted); }
.site-nav a:not(.btn):hover { color: var(--green); }
.site-nav .btn { color: #fff; }
.menu-toggle { display: none; }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 7vw, 88px) 0 0; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
h1 { font-size: clamp(3.4rem, 8.4vw, 7.4rem); letter-spacing: -0.05em; line-height: 0.98; margin: 28px 0 26px; }
.lead { font-size: clamp(1.08rem, 1.5vw, 1.25rem); color: var(--muted); max-width: 600px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.hero-portrait { position: relative; justify-self: end; width: min(100%, 400px); }
.hero-portrait > img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 22%;
  border-radius: 28px; box-shadow: var(--shadow);
  background: var(--sand);
}
.hero-portrait::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px; z-index: -1;
  border-radius: 28px; background: var(--green-soft); border: 1px solid #cfe0d4;
}
.portrait-badge {
  position: absolute; left: -28px; bottom: 28px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px; border-radius: 16px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 0.8rem; color: var(--muted); line-height: 1.3;
}
.portrait-badge strong { display: block; color: var(--forest-2); font-size: 0.88rem; }
.fx-mark { border-radius: 8px; }

.facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: clamp(56px, 8vw, 96px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.facts li { padding: 26px 20px; text-align: center; border-left: 1px solid var(--line); }
.facts li:first-child { border-left: 0; }
.facts strong { display: block; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--forest-2); }
.facts span { font-size: 0.88rem; color: var(--muted); }

/* ---------- Statement ---------- */
.statement { padding: clamp(72px, 10vw, 128px) 0; }
.statement-grid { display: grid; grid-template-columns: 1fr 2.4fr; gap: 40px; }
.statement-text { font-size: clamp(1.6rem, 3.2vw, 2.7rem); line-height: 1.25; letter-spacing: -0.03em; font-weight: 600; color: var(--forest-2); }
.statement-text em { color: var(--green); }

/* ---------- FoodXChange (dark) ---------- */
.fx { background: var(--forest); color: var(--on-dark); padding: clamp(80px, 11vw, 136px) 0; position: relative; overflow: hidden; }
.fx::before {
  content: ""; position: absolute; width: 900px; height: 900px; right: -300px; top: -380px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(30,107,69,.55), transparent);
  pointer-events: none;
}
.fx h2, .fx h3 { color: #fff; }
.fx h2 em { color: #8fc4a3; }
.fx-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 80px); align-items: center; }
.fx-copy > p { color: var(--on-dark-muted); margin-top: 18px; max-width: 540px; }
.fx-copy h2 { margin-bottom: 26px; }
.fx-points { margin-top: 28px; display: grid; gap: 14px; }
.fx-points li { position: relative; padding-left: 30px; color: var(--on-dark-muted); font-size: 0.97rem; }
.fx-points li::before {
  content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border-radius: 5px;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg stroke='%23fbf8f1' stroke-width='14' stroke-linecap='round'%3E%3Cline x1='32' y1='32' x2='68' y2='68'/%3E%3Cline x1='32' y1='68' x2='68' y2='32'/%3E%3C/g%3E%3C/svg%3E") center / 100% no-repeat;
}
.fx-points strong { color: #fff; font-weight: 600; }
.fx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 36px; }

/* Phone mockups (screens load from thefoodxchange.com) */
.phones { display: flex; justify-content: center; align-items: center; gap: 0; padding: 20px 0; }
.phone {
  flex: 0 0 auto; background: #0c0f0d; border-radius: 34px; padding: 8px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.55), inset 0 0 0 1.5px #2c3a31;
}
.phone img { width: 100%; aspect-ratio: 880 / 1913; object-fit: cover; border-radius: 27px; background: #213428; }
.phone-main { width: 42%; max-width: 250px; z-index: 2; }
.phone-side { width: 34%; max-width: 205px; opacity: .92; }
.phone-side:first-child { transform: translateX(22%) rotate(-6deg); }
.phone-side:last-child { transform: translateX(-22%) rotate(6deg); }

/* Story gallery */
.story { position: relative; margin-top: clamp(72px, 10vw, 120px); padding-top: clamp(48px, 7vw, 72px); border-top: 1px solid var(--line-dark); }
.story-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 48px; align-items: end; margin-bottom: 36px; }
.story-head .kicker { grid-column: 1 / -1; margin: 0; }
.story-head h3 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); letter-spacing: -0.035em; line-height: 1.1; }
.story-head > p:last-child { color: var(--on-dark-muted); max-width: 440px; }
.story-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.story-wide { grid-column: 1 / -1; }
.story-grid .photo:not(.story-wide) img { aspect-ratio: 4 / 5; object-fit: cover; }

/* ---------- Photo cards (shared) ---------- */
.photo { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fx .photo { background: #1b2e23; border-color: var(--line-dark); }
.photo figcaption { padding: 14px 18px 16px; font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
.fx .photo figcaption { color: var(--on-dark-muted); }
.photo figcaption strong { color: var(--forest-2); margin-right: 4px; }
.fx .photo figcaption strong { color: #fff; display: block; margin-bottom: 2px; }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; overflow: hidden; }
.zoom img { width: 100%; transition: transform .5s ease; }
.zoom:hover img { transform: scale(1.025); }

/* ---------- Revinova ---------- */
.rv-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(40px, 6vw, 80px); align-items: center; }
.rv-copy h2 { margin-bottom: 14px; }
.rv-copy .sub { font-size: 1.2rem; font-weight: 600; color: var(--forest-2); letter-spacing: -0.01em; margin-bottom: 18px; }
.rv-copy > p:not(.kicker):not(.sub) { color: var(--muted); margin-bottom: 28px; }
.rv-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rv-main { grid-column: 1 / -1; }
.rv-photos img { aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Section heads ---------- */
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 48px; margin-bottom: 48px; }
.section-head > p { max-width: 380px; color: var(--muted); }

/* ---------- Experience ---------- */
.experience { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.timeline { border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 0.8fr 1.3fr 1.6fr; gap: 28px; padding: 30px 0; border-bottom: 1px solid var(--line); align-items: start; }
.when { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); padding-top: 5px; }
.org { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.timeline li > p { color: var(--muted); }
.timeline a { color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Model UN ---------- */
.mun { background: var(--sand); }
.mun-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-rows: auto auto; gap: 20px; }
.mun-feature { grid-row: 1 / span 2; display: flex; flex-direction: column; }
.mun-feature .zoom { flex: 1; }
.mun-feature img { height: 100%; object-fit: cover; object-position: center 70%; }
.mun-grid .photo:not(.mun-feature) img { aspect-ratio: 16 / 10; object-fit: cover; }
.mun-crop img { object-position: center 38%; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 8vw, 120px); }
.about-copy p { font-size: 1.08rem; color: var(--ink); margin-bottom: 20px; }
.about-facts { margin-top: 34px; border-top: 1px solid var(--line); }
.about-facts div { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.about-facts dt { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); padding-top: 3px; }

/* ---------- Contact ---------- */
.contact { background: var(--forest); color: var(--on-dark); padding: clamp(88px, 12vw, 144px) 0; text-align: center; position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; left: 50%; bottom: -520px; width: 1000px; height: 800px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(30,107,69,.5), transparent); pointer-events: none;
}
.contact-inner { position: relative; max-width: 860px; }
.contact h2 { color: #fff; font-size: clamp(2.5rem, 6vw, 4.6rem); }
.contact h2 em { color: #8fc4a3; }
.contact-inner > p:not(.kicker) { color: var(--on-dark-muted); font-size: 1.12rem; max-width: 600px; margin: 24px auto 0; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 38px; }

/* ---------- Footer ---------- */
.site-footer { background: #0f1d15; color: #9fb1a5; font-size: 0.88rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 28px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 22px; }
.site-footer a:hover { color: #fff; }

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 20, 14, 0.88); }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: 12px; }
.lightbox-caption { color: #e6ece8; text-align: center; margin-top: 12px; font-size: 0.92rem; }
.lightbox-close {
  position: absolute; top: -48px; right: 0; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr 0.8fr; }
  .portrait-badge { left: -16px; }
  .fx-grid { grid-template-columns: 1fr; }
  .phones { max-width: 560px; margin: 0 auto; }
  .rv-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr 2fr; }
  .timeline li > p { grid-column: 2; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  }
  .menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 18px; height: 2px; background: var(--forest-2); border-radius: 2px; position: relative; transition: transform .2s ease, background .2s ease; }
  .menu-bars::before, .menu-bars::after { content: ""; position: absolute; left: 0; }
  .menu-bars::before { top: -6px; }
  .menu-bars::after { top: 6px; }
  .menu-toggle[aria-expanded="true"] .menu-bars { background: transparent; }
  .menu-toggle[aria-expanded="true"] .menu-bars::before { transform: translateY(6px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-bars::after { transform: translateY(-6px) rotate(-45deg); }

  .site-nav {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 20px; background: var(--cream); border-bottom: 1px solid var(--line);
    font-size: 1.05rem; color: var(--forest-2);
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a:not(.btn) { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .site-nav .btn { justify-content: center; margin-top: 16px; padding: 14px; }

  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { justify-self: center; width: min(100%, 340px); margin: 12px auto 18px; }
  .hero-portrait::before { inset: 14px -12px -12px 14px; }
  .portrait-badge { left: 50%; transform: translateX(-50%); bottom: -22px; width: max-content; max-width: calc(100vw - 32px); }
  .eyebrow { font-size: 0.76rem; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts li:nth-child(3) { border-left: 0; }
  .facts li:nth-child(n+3) { border-top: 1px solid var(--line); }

  .statement-grid { grid-template-columns: 1fr; gap: 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 18px; margin-bottom: 32px; }
  .story-head { grid-template-columns: 1fr; }
  .story-grid { grid-template-columns: 1fr; }
  .rv-photos { grid-template-columns: 1fr; }
  .rv-main { grid-column: auto; }

  .timeline li { grid-template-columns: 1fr; gap: 8px; padding: 24px 0; }
  .timeline li > p { grid-column: auto; }

  .mun-grid { grid-template-columns: 1fr; }
  .mun-feature { grid-row: auto; }
  .mun-feature img { height: auto; aspect-ratio: 928 / 1280; }

  .about-facts div { grid-template-columns: 1fr; gap: 2px; }
  .contact-actions .btn { width: 100%; justify-content: center; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  .phone { border-radius: 24px; padding: 5px; }
  .phone img { border-radius: 20px; }
  .fx-actions .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .zoom img { transition: none; }
}
