:root {
  --forge-black: #16140f;
  --iron-grey: #3a3630;
  --ash-white: #edeae2;
  --straw: #b8924a;
  --ddi-gold: #d3a447;
  --temper-blue: #4a5a5e;

  --font-display: "Cinzel", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --nav-height: 3.75rem;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--forge-black);
  color: var(--ash-white);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--ddi-gold);
  text-decoration: none;
}

a:visited {
  color: var(--temper-blue);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem;
}

.label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--straw);
}

/* ============================================================
   Top nav: slim, always-visible, non-linear section jumps
   ============================================================ */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(22, 20, 15, 0.92);
  border-bottom: 1px solid var(--iron-grey);
  backdrop-filter: blur(6px);
}

.wordmark,
.wordmark:visited {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  color: var(--ash-white);
}

.mark-icon {
  display: inline-block;
  background-color: var(--straw);
  -webkit-mask-image: url("../assets/images/makers-mark.svg");
  mask-image: url("../assets/images/makers-mark.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
}

.wordmark .mark {
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ash-white);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:visited {
  color: var(--ash-white);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ddi-gold);
}

.nav-links a.active {
  color: var(--straw);
  border-bottom-color: var(--straw);
}

/* ============================================================
   Fixed-viewport mode (landscape, wide): no scroll, one panel
   visible at a time, everything fits within the viewport.
   ============================================================ */

html[data-mode="fixed"] body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

html[data-mode="fixed"] .viewport {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
}

html[data-mode="fixed"] .panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.25s ease;
}

html[data-mode="fixed"] .panel.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   Fallback mode (portrait / narrow): conventional scroll,
   every panel stacked and visible.
   ============================================================ */

html:not([data-mode="fixed"]) .viewport {
  margin-top: var(--nav-height);
}

html:not([data-mode="fixed"]) .panel {
  position: relative;
  min-height: 60vh;
  padding: 2.5rem 1.25rem;
  border-bottom: 1px solid var(--iron-grey);
}

/* ============================================================
   Panel content
   ============================================================ */

.panel-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 3rem;
}

html:not([data-mode="fixed"]) .panel-inner {
  padding: 0;
  height: auto;
}

.panel h2.section-title {
  font-size: 1.6rem;
  color: var(--ash-white);
}

.section-title .rule {
  display: block;
  width: 3rem;
  height: 2px;
  margin-top: 0.6rem;
  background: linear-gradient(90deg, var(--straw), transparent);
}

/* --- Home --- */

#home .panel-inner {
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}

#home .hero-image {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 20, 15, 0.35), rgba(22, 20, 15, 0.85)),
    var(--iron-grey);
  background-size: cover;
  background-position: center;
}

#home .hero-content {
  position: relative;
  z-index: 1;
}

#home h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  color: var(--ash-white);
}

#home .hero-caption {
  color: var(--straw);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  margin-bottom: 1rem;
}

#home .intro-text {
  max-width: 34rem;
  margin: 1rem auto 0;
  color: var(--ash-white);
}

/* --- About --- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
  flex: 1;
  min-height: 0;
}

html:not([data-mode="fixed"]) .about-grid {
  grid-template-columns: 1fr;
}

.about-photo {
  min-height: 0;
  background: var(--iron-grey);
  border: 1px solid var(--iron-grey);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.about-mark {
  float: right;
  margin: 0 0 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--iron-grey);
  border-radius: 3px;
  background: rgba(58, 54, 48, 0.25);
}

.about-mark-icon {
  width: min(8rem, 40vw);
  aspect-ratio: 1;
  height: auto;
  border: none;
  padding: 0;
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.about-mark-icon:hover,
.about-mark-icon:focus-visible {
  opacity: 0.85;
  outline: none;
}

.about-mark .label {
  margin: 0;
}

.about-mark-photo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.about-mark-photo {
  display: block;
  width: min(6rem, 32vw);
  aspect-ratio: 1;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 2px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--iron-grey);
  transition: opacity 0.15s ease;
}

.about-mark-photo:hover,
.about-mark-photo:focus-visible {
  opacity: 0.85;
  outline: none;
}

.about-mark-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-cv {
  overflow-y: auto;
  padding-right: 0.5rem;
}

.cv-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ash-white);
  margin: 0 0 1rem;
}

.about-cv h3 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--straw);
  margin-top: 1.25rem;
}

.about-cv h3:first-of-type {
  margin-top: 0;
}

.about-cv ul {
  margin: 0.4rem 0;
  padding-left: 1.1rem;
  color: var(--ash-white);
  font-size: 0.92rem;
}

.cv-section-intro {
  margin: 0.4rem 0;
  color: var(--ash-white);
  font-size: 0.88rem;
  opacity: 0.85;
}

/* --- Workshop --- */

.workshop-image-grid {
  position: relative;
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: grid;
  gap: 0.4rem;
  padding: 0.4rem;
  overflow: hidden;
  background: var(--forge-black);
  border-radius: 3px;
}

.workshop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  flex: 1;
  min-height: 0;
}

.workshop-grid .statement {
  grid-column: 1;
}

.workshop-grid .workshop-image-grid {
  grid-column: 2 / span 2;
}

html:not([data-mode="fixed"]) .workshop-grid {
  grid-template-columns: 1fr;
}

html:not([data-mode="fixed"]) .workshop-grid .statement,
html:not([data-mode="fixed"]) .workshop-grid .workshop-image-grid {
  grid-column: 1;
}

#workshop .statement {
  color: var(--ash-white);
  margin-bottom: 1.25rem;
  white-space: pre-line;
}

html[data-mode="fixed"] #workshop .statement {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* --- Filmstrip (shared: Workshop photos, Work gallery) --- */

.filmstrip-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.filmstrip {
  height: 100%;
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding: 0.25rem 0.25rem 1rem;
  scrollbar-color: var(--straw) var(--iron-grey);
  scrollbar-width: thin;
}

.filmstrip::-webkit-scrollbar {
  height: 6px;
}

.filmstrip::-webkit-scrollbar-thumb {
  background: var(--straw);
}

.filmstrip-item {
  flex: 0 0 clamp(180px, 22vw, 300px);
  scroll-snap-align: center;
  background: var(--iron-grey);
  border-radius: 3px;
  overflow: hidden;
}

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

.filmstrip-item.is-portrait {
  flex-basis: clamp(120px, 14vw, 200px);
}

.filmstrip-item.is-portrait img {
  object-fit: contain;
  background: var(--forge-black);
}

.piece-thumb {
  flex: 0 0 clamp(220px, 24vw, 320px);
  scroll-snap-align: center;
  background: var(--iron-grey);
  border: 1px solid var(--iron-grey);
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.piece-thumb:hover,
.piece-thumb:focus-visible {
  border-color: var(--straw);
  transform: translateY(-2px);
  outline: none;
}

.piece-thumb .thumb-image {
  flex: 1;
  min-height: 0;
  background: linear-gradient(135deg, var(--iron-grey), var(--forge-black));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--iron-grey);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.5rem;
}

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

.piece-thumb .thumb-caption {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--forge-black);
}

.piece-thumb .thumb-caption .label {
  display: block;
  margin-bottom: 0.2rem;
}

.piece-thumb .thumb-caption h3 {
  font-size: 0.95rem;
  margin: 0;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(22, 20, 15, 0.8);
  border: 1px solid var(--straw);
  color: var(--straw);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.carousel-arrow:hover,
.carousel-arrow:focus-visible {
  color: var(--ddi-gold);
  border-color: var(--ddi-gold);
  outline: none;
}

.carousel-arrow.prev {
  left: -0.75rem;
}

.carousel-arrow.next {
  right: -0.75rem;
}

html:not([data-mode="fixed"]) .carousel-arrow {
  display: none;
}

/* --- Work & Engagement: gallery / detail modes --- */

.gallery-section {
  position: relative;
  height: 100%;
}

html:not([data-mode="fixed"]) .gallery-section {
  height: auto;
}

.work-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-view,
.detail-view {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.gallery-section:not(.mode-detail) .detail-view {
  display: none;
}

.gallery-section.mode-detail .gallery-view {
  display: none;
}

.gallery-section:not(.mode-detail) .detail-back {
  display: none;
}

.detail-back {
  background: none;
  border: 1px solid var(--iron-grey);
  color: var(--straw);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
}

.detail-back:hover,
.detail-back:focus-visible {
  border-color: var(--straw);
  color: var(--ddi-gold);
  outline: none;
}

.detail-track {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  position: relative;
}

.detail-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 0;
  min-height: 0;
}

@media (max-width: 900px) {
  .detail-slide {
    grid-template-columns: 1fr;
    grid-template-rows: min(48vh, 420px) 1fr;
    overflow-y: auto;
  }
}

.detail-slide .image-pane {
  position: relative;
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: grid;
  gap: 0.4rem;
  padding: 0.4rem;
  overflow: hidden;
  background: var(--forge-black);
}

.image-grid-tile {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  background: var(--iron-grey);
  border-radius: 2px;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

.image-grid-tile:hover,
.image-grid-tile:focus-visible {
  opacity: 0.85;
  outline: none;
}

.image-grid-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-slide .image-pane.grouped {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  align-content: start;
}

.build-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.build-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.build-header h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ash-white);
  margin: 0;
}

.build-header .year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--straw);
}

.build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  grid-auto-rows: 140px;
  gap: 0.4rem;
}

.image-pane.grouped .video-tile {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.video-tile {
  position: relative;
  cursor: pointer;
}

.video-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.video-tile .play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--ash-white);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.video-tile .play-icon::before {
  content: '\25B6';
}

.meta-pane {
  padding: 1.75rem 2rem;
  overflow-y: auto;
  border-left: 1px solid var(--iron-grey);
}

.meta-pane h3.piece-title {
  font-size: 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.meta-pane h3.piece-title .year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--straw);
}

.meta-field {
  margin: 1rem 0;
}

.meta-field .label {
  display: block;
  margin-bottom: 0.25rem;
}

.meta-field p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ash-white);
}

.meta-field.testimonial p {
  font-style: italic;
  color: var(--temper-blue);
  border-left: 2px solid var(--temper-blue);
  padding-left: 0.75rem;
}

.meta-images {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

.meta-images .image-grid-tile {
  aspect-ratio: 1;
}

/* --- Lightbox --- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  background: rgba(22, 20, 15, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  box-shadow: 0 0 3rem rgba(0, 0, 0, 0.6);
}

.lightbox img[hidden],
.lightbox video[hidden] {
  display: none;
}

.lightbox-caption {
  color: var(--ash-white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: center;
  max-width: 40rem;
  margin: 0;
}

.lightbox-caption[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.75rem;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  color: var(--ash-white);
  cursor: pointer;
  padding: 0.25rem 0.75rem;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: var(--straw);
}
