/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --black: #000;
  --white: #fff;
  --muted: rgba(255, 255, 255, 0.6);

  --font-display: "DM Serif Display", "Bodoni 72", Didot, Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;

  --sidebar-w: clamp(240px, 17.25vw, 300px);
  --sidebar-pad: clamp(16px, 1.15vw, 24px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
figure { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible { outline: 1px solid var(--white); outline-offset: 3px; }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  /* Part of the first screen only: scrolls away with the hero */
  position: absolute;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 4vh, 40px) var(--sidebar-pad) clamp(18px, 2.5vh, 24px);
  background: var(--black);
  overflow-y: auto;
  z-index: 10;
}

/* Shrinks to the widest child (the logo) and is centred, so the logo,
   body and footer share the same left edge and equal side spacing. */
.sidebar__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.sidebar__top { display: flex; justify-content: center; }

.sidebar__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 5vh, 56px);
  justify-content: center;
  padding: 30px 0 90px;
}

/* Logo */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  line-height: 0.9;
}
.logo__small { font-size: 16px; letter-spacing: 0.01em; }
.logo__medium { font-size: 26px; letter-spacing: -0.01em; }
.logo__big   { font-size: 40px; letter-spacing: -0.02em; margin: 4px 0 6px; }

/* Sections */
.sidebar__heading {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sidebar__list {
  font-size: 13.44px;
  line-height: 22.4px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.sidebar__list a,
.sidebar__links a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.4s var(--ease), color 0.2s;
}
.sidebar__list a:hover,
.sidebar__links a:hover { background-size: 100% 1px; }

.sidebar__links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Footer */
.sidebar__footer { margin-top: auto; }

/* Social */
.social { display: flex; gap: 22px; }
.social a { display: block; transition: opacity 0.2s; }
.social a:hover { opacity: 0.6; }
.social svg { width: 24px; height: 24px; fill: currentColor; display: block; }
.social svg[fill="none"] { fill: none; }

/* Mobile menu toggle (hidden on desktop) */
.menu-toggle { display: none; }

/* ==========================================================================
   Main / Hero
   ========================================================================== */
.hero {
  display: grid;
  margin-left: var(--sidebar-w);
  height: 100vh;
  height: 100svh;
  min-height: 520px;
}

.hero__panel {
  position: relative;
  overflow: hidden;
}

/* Gradient fallback shows until the photo is added to assets/images/ */
.hero__image { --fallback: linear-gradient(160deg, #e6d6c4 0%, #cdb59d 55%, #b39a82 100%); }

.hero__image {
  position: absolute;
  inset: 0;
  background-image: var(--fallback);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.06);
  opacity: 0;
  transition: transform 1.6s var(--ease), opacity 1.2s var(--ease);
}
.is-loaded .hero__image { transform: scale(1); opacity: 1; }

/* Mobile only: the sidebar's links aren't on screen there */
.hero__more { display: none; }

@keyframes hero-arrow {
  50% { transform: translateY(6px); }
}

/* ==========================================================================
   Portfolio
   ========================================================================== */
.works {
  padding: clamp(56px, 10vh, 120px) clamp(16px, 1.5vw, 24px);
}

.works__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: clamp(32px, 6vh, 56px);
  text-align: center;
}

.works__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(36px, 3.4vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1;
}

.works__filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px clamp(20px, 2.4vw, 40px);
  margin-top: clamp(24px, 4vh, 40px);
}

.works__filter {
  display: inline-block;
  padding: 4px 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  color: var(--muted);
  font-size: 13.44px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transition: background-size 0.4s var(--ease), color 0.2s;
}
.works__filter:hover { color: var(--white); }
.works__filter[aria-current="true"] { color: var(--white); background-size: 100% 1px; }

/* Masonry via CSS columns: up to 6 columns, each at least 220px wide */
.works__grid {
  columns: 6 220px;
  column-gap: clamp(12px, 1.5vw, 24px);
}

.works__item {
  break-inside: avoid;
  position: relative;
  margin-bottom: clamp(12px, 1.5vw, 24px);
  overflow: hidden;
  animation: works-in 0.6s var(--ease);
}
.works__item[hidden] { display: none; }

/* Gradient fallback shows while the photo loads */
.works__image {
  --fallback: linear-gradient(160deg, #2a2a2a 0%, #111 100%);
  aspect-ratio: var(--ratio, 4 / 3);
  background-image: var(--fallback);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition: transform 1s var(--ease), opacity 0.4s;
}
.works__item:nth-child(3n + 2) .works__image { --fallback: linear-gradient(160deg, #3a3330 0%, #151210 100%); }
.works__item:nth-child(3n) .works__image { --fallback: linear-gradient(160deg, #e6d6c4 0%, #b39a82 100%); }

.works__item:hover .works__image { transform: scale(1.04); }

@keyframes works-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* ==========================================================================
   About
   ========================================================================== */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 96px);
  padding: clamp(48px, 8vh, 96px) clamp(24px, 6vw, 120px);
}

.about__photo { justify-self: end; width: min(100%, 520px); }

/* Gradient fallback shows until the photo is added to assets/images/ */
.about__image {
  --fallback: radial-gradient(closest-side, #3a3a3a 0%, #151515 60%, #000 100%);
  aspect-ratio: 4 / 5;
  background-image: var(--fallback);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.about__content { max-width: 34rem; }

.about__name {
  margin: clamp(16px, 2.5vh, 28px) 0 clamp(22px, 3.5vh, 38px);
  font-weight: 300;
  font-size: clamp(36px, 3.4vw, 60px);
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.about__text {
  margin: 0 0 1.2em;
  color: var(--muted);
  font-size: 16px;
  line-height: 2;
}

.about__content .social { margin-top: clamp(28px, 5vh, 48px); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 32px clamp(24px, 6vw, 120px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 13.44px;
  letter-spacing: 0.01em;
  text-align: center;
}
.site-footer p { margin: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 14px 16px;
    overflow: visible;
    align-items: stretch;
  }

  .sidebar__top { justify-content: space-between; align-items: center; }

  .logo { flex-direction: row; align-items: baseline; gap: 6px; line-height: 1; }
  .logo__big { font-size: 28px; margin: 0; }
  .logo__small { font-size: 13px; }
  .logo__medium { font-size: 23px; }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    width: 40px;
    height: 40px;
    padding: 0 8px;
    background: none;
    border: 0;
    color: var(--white);
    cursor: pointer;
  }
  .menu-toggle__bar {
    display: block;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.3s var(--ease);
  }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bar:first-child { transform: translateY(4.25px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { transform: translateY(-4.25px) rotate(-45deg); }

  .sidebar__body {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100svh - 68px);
    margin: 0;
    justify-content: flex-start;
    padding: 32px 16px 72px; /* bottom room for the fixed footer */
    background: var(--black);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
  }
  .sidebar.is-open .sidebar__body { visibility: visible; opacity: 1; transform: none; }

  /* Footer sits at the bottom of the open menu */
  .sidebar__footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0 16px 24px;
    background: var(--black);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
  }
  .sidebar.is-open .sidebar__footer { visibility: visible; opacity: 1; }

  .hero {
    position: relative;
    margin-left: 0;
    height: calc(100vh - 68px);
    height: calc(100svh - 68px); /* fill the screen below the sticky header */
  }
  .hero__more {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-40%);
    color: var(--white);
    font-size: 18px;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: opacity 0.4s var(--ease), visibility 0.4s;
  }
  .hero__more.is-hidden { opacity: 0; visibility: hidden; }
  .hero__more-label {
    padding: 4px 0;
    background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  }
  .hero__arrow {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
    animation: hero-arrow 2.4s ease-in-out infinite;
  }

  .works { padding: 56px 16px; scroll-margin-top: 68px; } /* clear the sticky header */
  .works__grid { columns: 2; column-gap: 12px; }
  .works__item { margin-bottom: 12px; }

  .about {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 56px 16px;
    scroll-margin-top: 68px;
  }
  .about__photo { justify-self: center; width: min(50%, 260px); }

  .site-footer { padding: 24px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .hero__arrow { animation: none; }
}
