/* =========================
   1) Tokens
   ========================= */

:root {
  --ink: #232323;
  --muted: rgba(35, 35, 35, 0.65);
  --rule: rgba(35, 35, 35, 0.12);
  --paper: #fff;

  --body-max: 1600px;
  --header-max: 1600px;
  --content-max: 1250px;

  --brand-w: 100px;

  --page-pad-x: 64px;
  --top-pad: 38px;
  --header-min-h: 10vh;

  --nav-gap: 30px;
  --col-gap: 10px;

  --font: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --fs: 11px;
  --lh: 2.0em;
}

/* =========================
   2) Global
   ========================= */

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 18px 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* =========================
   3) Layout
   ========================= */

.page {
  max-width: var(--body-max);
  margin: 0 auto;
  padding: 0 var(--page-pad-x) 5vw;

  position: relative;
  min-height: 100vh;
  padding-bottom: 90px;
  /* reserve space for fixed footer */
}

.content {
  max-width: var(--content-max);
  padding-top: 10px;

  margin-left: auto;
  margin-right: auto;
}

.page-title {
  margin: 0 0 12px 0;
  font-size: var(--fs);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.caption,
.small {
  color: var(--muted);
}

/* =========================
   4) Header
   ========================= */

.topbar {
  width: 100%;
  max-width: var(--header-max);
  min-height: var(--header-min-h);
  padding-top: var(--top-pad);
  position: relative;
  z-index: 10;

  display: grid;
  grid-template-columns: var(--brand-w) 1fr auto;
  align-items: start;
  column-gap: var(--col-gap);
}

.brand {
  width: var(--brand-w);
  margin: 0;

  display: block;
  text-align: right;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 100%;
  max-width: 100px;
  max-height: 100px;
  height: auto;
  margin-left: auto;
}

/* Let nav children participate in the grid */
.topbar-nav {
  display: contents;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.nav-left {
  grid-column: 2;
  display: flex;
  gap: var(--nav-gap);
  align-items: flex-start;
}

.nav-right {
  grid-column: 3;
  display: flex;
  gap: var(--nav-gap);
  justify-content: flex-end;
  align-items: flex-start;
}

.topbar-nav a[aria-current="page"] {
  text-decoration: underline;
}

/* =========================
   5) Burger + Overlay
   ========================= */

.nav-toggle {
  display: none;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--ink);
  margin: 5px 0;
}

.overlay-nav {
  position: fixed;
  inset: 0;
  z-index: 200;

  background: var(--paper);

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;

  font-size: var(--fs);
  text-transform: lowercase;
  letter-spacing: 0.02em;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay-nav.active {
  opacity: 1;
  pointer-events: auto;
}

.topbar.is-collapsed .topbar-nav {
  display: none;
}

.topbar.is-collapsed .nav-toggle {
  display: block;
}

/* =========================
   6) Index / generic media
   ========================= */

.hero {
  display: grid;
  gap: 18px;
  justify-content: center;
}

.hero img {
  width: 100%;
  height: auto;
  max-width: 50vw;
}

.media img {
  width: 100%;
  max-height: 560px;
  object-fit: cover;
}

/* =========================
   Hero Slideshow
   ========================= */

.hero {
  position: relative;
}

.hero-img {
  width: 100%;
  height: auto;
  display: block;

  transition: opacity 1.2s ease;
}

.hero-img.is-fading {
  opacity: 0;
}

/* =========================
   7) Projects (no-scroll viewer)
   ========================= */

.page-projects {
  overflow: hidden;
}

.page--projects {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content--projects {
  flex: 1;
  min-height: 0;
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

.projects-shell {
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;

  position: relative;
  margin-top: 16px;
  padding-top: 16px;
}

/* Thin separator line */
.projects-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;

  height: 1px;
  background: var(--rule);
}

.project-view {
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-title {
  margin: 0;
  font-size: var(--fs);
  font-weight: 400;
}

.project-text {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;
}

/* Tabs */
.project-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px var(--nav-gap);
  margin-bottom: 14px;
}

.project-tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;

  color: inherit;
  font: inherit;

  text-transform: lowercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.project-tab:hover {
  text-decoration: underline;
}

.project-tab[aria-current="page"] {
  text-decoration: underline;
}

/* Gallery: main image + strip */
.project-media {
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;

  overflow: hidden;
}

.project-media-main {
  flex: 1;
  min-height: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

/* Main image (single source of truth) */
.project-img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  padding: 0 10em 0 10em;
}

/* Strip */
.project-strip {
  flex: 0 0 auto;

  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;

  padding-bottom: 2px;
}

.project-thumb {
  width: 20px;
  height: 20px;

  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  border-radius: 2px;
  overflow: hidden;
}

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

.project-thumb:hover img {
  opacity: 1;
}

.project-thumb[aria-current="true"] img {
  opacity: 1;
  outline: 1px solid var(--rule);
  outline-offset: 2px;
}

.project-meta {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-line {
  line-height: 1.5em;
}

.meta-line:first-child {
  color: var(--ink);
}

/* =========================
   8) Footer (fixed)
   ========================= */

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: 7px;
  z-index: 50;

  max-width: var(--body-max);
  margin-left: auto;
  margin-right: auto;

  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x);
  padding-top: 7px;

  border-top: 1px solid var(--rule);
  background: var(--paper);

  color: var(--muted);
}

.footer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--col-gap);
}

.footer-left {
  max-width: 520px;
}

.footer-right {
  display: flex;
  gap: var(--nav-gap);
  white-space: nowrap;
}

.footer-address {
  color: var(--muted);
}

/* =========================
   9) Responsive
   ========================= */

@media (max-width: 1000px) {
  .content {
    margin-left: auto;
    margin-right: auto;
  }

  .topbar-nav {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .content {
    padding-right: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --top-pad: 18px;
    --header-min-h: 7vh;
    --page-pad-x: 20px;
  }

  .page {
    padding: 0 var(--page-pad-x) 8vw;
    padding-bottom: 90px;
  }

  .footer {
    padding-left: var(--page-pad-x);
    padding-right: var(--page-pad-x);
    padding-top: 6px;
    padding-bottom: 4px;
    text-align: center;
    line-height: 0.4em;
  }

  .footer-row {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .footer-left {
    max-width: 100%;
  }

  .footer-address {
    line-height: 1.4em;
  }

  .footer-right {
    justify-content: center;
    gap: 18px;
  }

  /* Main image (single source of truth) */
  .project-img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    padding: 0 0em 0 0em;
  }

  .hero img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}