/* Carrot-inspired design.
   Palette pulled from the logo:
   - cream background (the off-white the carrot sits on)
   - carrot orange for accents & links
   - leaf green for hover/highlights
   - thick black outlines echoing the logo's hand-drawn stroke */

:root {
  --bg: #FFF4E2;
  --bg-card: #FFFBF1;
  --text: #1A1A1A;
  --muted: #8A7E6E;
  --muted-strong: #5C5448;
  --carrot: #FF7A1A;
  --carrot-dark: #E5631A;
  --leaf: #2DAA3F;
  --border: #1A1A1A;
  --max-width: 1200px;
  --font-sans: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-hand: "Caveat", "Patrick Hand", "Comic Sans MS", cursive;
}

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;800;900&family=Caveat:wght@500;700&display=swap");

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 48px;
}

@media (max-width: 720px) {
  .container { padding: 0 24px; }
}

/* ---------- Header ---------- */

.site-header {
  padding: 40px 0 28px;
  border-bottom: 3px solid var(--border);
  position: relative;
  background: var(--bg);
}

.is-compact .site-header { padding: 18px 0 14px; }
.is-compact .brand { font-size: clamp(1.15rem, 2vw, 1.45rem); }
.is-compact .brand-logo { height: 1.5em; }
.is-compact main { padding: 32px 0 96px; }
.is-compact h1 { font-size: 1.35rem; }
.is-compact .subtitle { font-size: 1.3rem; margin: 14px 0 32px; }

.site-header::after {
  /* a small carrot-orange underline accent below the border */
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -7px;
  height: 4px;
  background: var(--carrot);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 900;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  text-transform: uppercase;
  letter-spacing: 0.005em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 16px;
  line-height: 1;
}

.brand-logo {
  height: 1.6em;
  width: auto;
  display: block;
  transform: rotate(-14deg);
  transform-origin: 50% 60%;
  transition: transform 0.25s ease;
}

.brand:hover .brand-logo {
  transform: rotate(8deg) scale(1.06);
}

.brand:hover span { color: var(--carrot); }
.brand span { transition: color 0.2s ease; }

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.site-nav a {
  color: var(--muted-strong);
  padding: 4px 2px;
  position: relative;
}

.site-nav a:hover { color: var(--carrot); }

.site-nav a.active {
  color: var(--text);
}

.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -8px;
  height: 3px;
  background: var(--carrot);
  border-radius: 2px;
}

/* ---------- Main ---------- */

main {
  padding: 72px 0 120px;
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 0.4em;
  text-transform: uppercase;
}

h1 {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  position: relative;
  display: inline-block;
}

h1::after {
  /* underline accent in carrot orange */
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 48px;
  height: 5px;
  background: var(--carrot);
  border-radius: 3px;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--muted-strong);
  margin-top: 32px;
}

.subtitle {
  font-family: var(--font-hand);
  font-weight: 500;
  color: var(--muted-strong);
  font-size: 1.6rem;
  margin: 24px 0 56px;
  line-height: 1.2;
  transform: rotate(-1.5deg);
  transform-origin: left center;
  display: inline-block;
}

/* ---------- Work grid ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px 36px;
}

@media (max-width: 900px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); gap: 40px 24px; }
}

@media (max-width: 560px) {
  .work-grid { grid-template-columns: 1fr; }
}

a.project {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

a.project:nth-child(3n+1) .project-thumb { transform: rotate(-1deg); }
a.project:nth-child(3n+2) .project-thumb { transform: rotate(0.6deg); }
a.project:nth-child(3n+3) .project-thumb { transform: rotate(-0.4deg); }

a.project:hover { transform: translateY(-4px); }
a.project:hover .project-thumb { transform: rotate(0) scale(1.02); border-color: var(--carrot); }
a.project:hover .project-label { color: var(--carrot); }

.project-thumb {
  background: var(--bg-card);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: 6px 6px 0 var(--border);
  transition: transform 0.25s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a.project:hover .project-thumb {
  box-shadow: 8px 8px 0 var(--carrot);
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-label {
  margin-top: 18px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.2s ease;
}

/* ---------- About ---------- */

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 820px) {
  .about-layout { grid-template-columns: 1fr; gap: 32px; }
}

.portrait {
  background: var(--bg-card);
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: 8px 8px 0 var(--carrot);
  transform: rotate(-1.2deg);
}

.portrait img {
  width: 100%;
  height: auto;
  display: block;
}

.prose {
  max-width: 480px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text);
}

.prose p { margin: 0 0 1.2em; }

.prose a {
  color: var(--text);
  border-bottom: 2px solid var(--carrot);
  padding-bottom: 1px;
}

.prose a:hover { color: var(--carrot); }
.prose strong { font-weight: 700; }

.about-prose h1 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
}

.about-prose h3 {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  color: var(--carrot);
  margin-top: 40px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.about-prose em {
  font-family: var(--font-hand);
  font-style: normal;
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--carrot-dark);
  display: inline-block;
  transform: rotate(-1deg);
}

/* ---------- Contact ---------- */

.contact-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 820px) {
  .contact-layout { grid-template-columns: 1fr; gap: 40px; }
}

.contact-no-form { grid-template-columns: minmax(0, 520px); }

.contact-side { font-size: 0.95rem; }

.contact-side h2 {
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: var(--carrot);
  margin-top: 0;
  margin-bottom: 18px;
}

.contact-side .map {
  background: var(--bg-card);
  aspect-ratio: 4 / 3;
  margin-bottom: 20px;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: 6px 6px 0 var(--leaf);
}

.contact-side .map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.contact-side p { margin: 0 0 10px; line-height: 1.7; }
.contact-side strong { font-weight: 700; }
.contact-side a {
  color: var(--text);
  border-bottom: 2px solid var(--carrot);
  padding-bottom: 1px;
}
.contact-side a:hover { color: var(--carrot); }

/* ---------- Footer ---------- */

.site-footer {
  padding: 18px 0 22px;
  margin-top: 40px;
  border-top: 3px solid var(--border);
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -7px;
  height: 4px;
  background: var(--leaf);
}

.footer-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.socials {
  display: flex;
  gap: 10px;
}

.socials a {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.socials a svg { width: 14px; height: 14px; }

.socials a:hover {
  background: var(--carrot);
  color: #fff;
  transform: translateY(-2px) rotate(-6deg);
}

/* ---------- Project detail page ---------- */

.project-page { max-width: 900px; margin: 0 auto; }

.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.back-link {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-strong);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.back-link:hover { color: var(--carrot); border-bottom-color: var(--carrot); }

.project-prose {
  max-width: 62ch;
  margin: 0 auto 56px;
  font-size: 1rem;
}

.project-prose p { margin: 0 0 1.1em; }
.project-prose a {
  color: var(--text);
  border-bottom: 2px solid var(--carrot);
  padding-bottom: 1px;
}
.project-prose a:hover { color: var(--carrot); }

/* ----- Expanding gallery: hovered tile grows, siblings shrink ----- */

.expand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  align-items: stretch;
}

.expand-item {
  position: relative;
  flex: 1 1 220px;
  min-width: 80px;
  height: 360px;
  padding: 0;
  margin: 0;
  background: var(--bg-card);
  border: 3px solid var(--border);
  cursor: zoom-in;
  overflow: hidden;
  transition:
    flex-grow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    flex-basis 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.expand-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;
  filter: saturate(0.92);
}

/* When the grid is being hovered, dim all items… */
@media (hover: hover) {
  .expand-grid:hover .expand-item {
    flex-grow: 0.4;
  }
  .expand-grid:hover .expand-item img {
    filter: saturate(0.6) brightness(0.85);
  }

  /* …except the one actually being hovered, which grows */
  .expand-grid .expand-item:hover {
    flex-grow: 5;
    border-color: var(--carrot);
    box-shadow: 8px 8px 0 var(--carrot);
    z-index: 2;
  }
  .expand-grid .expand-item:hover img {
    filter: saturate(1.05);
    transform: scale(1.03);
  }
}

.expand-item:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 4px;
  z-index: 3;
}

.expand-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.expand-item:hover .expand-caption {
  opacity: 1;
  transform: translateY(0);
}

/* Single-image projects: just one big tile, no expansion */
.expand-grid.is-single .expand-item {
  flex: 1 1 100%;
  height: auto;
  cursor: zoom-in;
}
.expand-grid.is-single .expand-item img {
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

/* On touch devices, fall back to a stable grid (no hover) */
@media (hover: none), (max-width: 640px) {
  .expand-item {
    flex: 1 1 calc(50% - 6px);
    height: 240px;
  }
  .expand-caption { opacity: 1; transform: none; }
}

@media (max-width: 420px) {
  .expand-item { flex: 1 1 100%; height: 280px; }
}

/* ----- Lightbox ----- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 14, 6, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.lightbox[hidden] { display: none; }

.lb-stage {
  max-width: min(1400px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lb-img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  background: var(--bg-card);
  border: 3px solid var(--text);
  box-shadow: 12px 12px 0 var(--carrot);
}

.lb-caption {
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  max-width: 60ch;
}

.lb-caption strong {
  display: block;
  color: var(--carrot);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.lb-caption p { margin: 0; }

.lb-counter {
  color: var(--carrot);
  font-family: var(--font-hand);
  font-size: 1.2rem;
}

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: var(--bg);
  color: var(--text);
  border: 3px solid var(--text);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  z-index: 2;
  line-height: 1;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: var(--carrot);
  color: #fff;
  transform: scale(1.05);
}

.lb-close { top: 20px; right: 20px; }
.lb-prev  { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 20px; top: 50%; transform: translateY(-50%); }

.lb-prev:hover { transform: translateY(-50%) scale(1.05); }
.lb-next:hover { transform: translateY(-50%) scale(1.05); }

@media (max-width: 560px) {
  .lightbox { padding: 16px; }
  .lb-close, .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 1.3rem; }
  .lb-close { top: 12px; right: 12px; }
  .lb-prev  { left: 12px; }
  .lb-next  { right: 12px; }
}

.project-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 80px;
  padding-top: 32px;
  border-top: 3px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.project-nav a {
  color: var(--muted-strong);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
.project-nav a:hover { color: var(--carrot); border-bottom-color: var(--carrot); }
