/* ============================================================
   DESIGN SYSTEM — CSS Custom Properties
   Warm Ivory Glass Aesthetic inspired by the reference design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Lora:wght@400;600&display=swap');

:root {
  /* --- Colour Palette --- */
  --bg-main:         #faf9f6;
  --bg-card:         rgba(255, 255, 255, 0.72);
  --bg-card-hover:   rgba(255, 255, 255, 0.88);
  --bg-tag:          rgba(43, 37, 29, 0.08);
  --bg-footer:       #2b251d;

  --clr-text:        #2b251d;
  --clr-muted:       #6b5f52;
  --clr-accent:      #b07d52;
  --clr-accent-dark: #8a5f38;
  --clr-border:      rgba(43, 37, 29, 0.12);
  --clr-divider:     rgba(43, 37, 29, 0.09);
  --clr-footer-text: #e8e0d8;
  --clr-footer-muted:#b8a898;

  /* --- Typography --- */
  --font-heading: 'Lora', Georgia, serif;
  --font-body:    'Outfit', system-ui, sans-serif;

  /* --- Spacing & Radius --- */
  --radius-card:  18px;
  --radius-inner: 10px;
  --radius-tag:   20px;
  --max-w:        860px;
  --gap:          28px;

  /* --- Shadows --- */
  --shadow-card:  0 4px 24px rgba(43, 37, 29, 0.09), 0 1px 4px rgba(43, 37, 29, 0.06);
  --shadow-hover: 0 10px 40px rgba(43, 37, 29, 0.14), 0 2px 8px rgba(43, 37, 29, 0.08);
  --shadow-img:   0 4px 16px rgba(43, 37, 29, 0.15);

  /* --- Transitions --- */
  --tr-fast:   0.18s ease;
  --tr-medium: 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-slow:   0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--clr-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
  width: 100%;
  padding: 44px 24px 28px;
  text-align: center;
  border-bottom: 1px solid var(--clr-divider);
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(250,249,246,0.0) 100%);
}

.site-header__eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clr-accent);
  margin-bottom: 10px;
}

.site-header__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--clr-text);
  line-height: 1.2;
  margin-bottom: 12px;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 48px auto 64px;
  padding: 0 20px;
}

.main-content--project {
  max-width: 1080px;
  margin-top: 30px;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

.project-tabs:not([hidden]) {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 8px 16px 0;
  background: #eeebe5;
  box-shadow: inset 0 -1px var(--clr-border);
}

.project-tabs__home,
.project-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.project-tabs__home {
  color: var(--clr-muted);
  white-space: nowrap;
}

.project-tabs__home:hover,
.project-tabs__home[aria-current="page"] {
  color: var(--clr-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.project-tabs__list {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.project-tab {
  overflow: hidden;
  max-width: 18rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--clr-muted);
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
}

.project-tab:hover {
  background: #e7e1d7;
}

.project-tab[aria-current="page"] {
  background: var(--bg-main);
  border-color: var(--clr-border);
  border-bottom-color: transparent;
  color: var(--clr-text);
  font-weight: 600;
}

.project-tabs a:focus-visible {
  outline-offset: -2px;
}

.directory-list {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.directory-link {
  color: var(--clr-accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.project-card {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  touch-action: pan-y pinch-zoom;
}

@media (prefers-reduced-motion: no-preference) {
  .project-card--from-right {
    --slide-start: 24px;
    animation: slide-project-in 180ms ease-out;
  }

  .project-card--from-left {
    --slide-start: -24px;
    animation: slide-project-in 180ms ease-out;
  }

  @keyframes slide-project-in {
    from { transform: translateX(var(--slide-start)); opacity: 0.72; }
    to { transform: translateX(0); opacity: 1; }
  }
}

.project-heading {
  padding: clamp(20px, 4vw, 38px);
}

.project-heading h1 {
  margin: 0 0 8px;
  font: 600 clamp(1.65rem, 4vw, 2.65rem)/1.2 var(--font-heading);
}

.project-heading p {
  color: var(--clr-muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 11px;
  border-radius: var(--radius-tag);
  background: var(--bg-tag);
  color: var(--clr-muted);
  border: 1px solid var(--clr-border);
  letter-spacing: 0.03em;
  transition: background var(--tr-fast), color var(--tr-fast);
}

.tag:hover {
  background: rgba(176, 125, 82, 0.12);
  color: var(--clr-accent-dark);
}

.project-body-inner {
  border-top: 1px solid var(--clr-divider);
  padding: clamp(20px, 4vw, 38px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.project-intro p {
  margin: 8px 0 0;
  line-height: 1.8;
}

/* ---- Demo Video ---- */
.demo-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-inner);
  overflow: hidden;
  background: #191613;
  box-shadow: var(--shadow-img);
}

.demo-video-wrap--youtube {
  min-height: 200px;
}

.demo-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Video Chapters / Timeline Bar ---- */
.video-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-note,
.video-link {
  font-size: 0.88rem;
}

.video-note {
  margin: 0;
  color: var(--clr-muted);
}

.video-link {
  align-self: flex-start;
  color: var(--clr-accent-dark);
  text-underline-offset: 0.2em;
}

.video-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(43, 37, 29, 0.03);
  padding: 12px 14px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--clr-border);
}

.video-timeline-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-muted);
  letter-spacing: 0.03em;
}

.video-timeline-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--clr-border);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--clr-text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 4px rgba(43, 37, 29, 0.04);
  transition: all var(--tr-fast);
}

.chapter-chip .chip-time {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--clr-accent-dark);
  font-family: monospace;
}

.chapter-chip .chip-title {
  color: var(--clr-text);
  font-weight: 500;
}

.chapter-chip:hover {
  background: rgba(176, 125, 82, 0.12);
  border-color: var(--clr-accent);
  transform: translateY(-1px);
}

/* ---- Text Description & Vertical Timeline ---- */
.project-description {
  font-size: 0.97rem;
  color: var(--clr-text);
  line-height: 1.8;
}

.project-timeline {
  position: relative;
  margin-top: 6px;
  margin-bottom: 8px;
  padding-left: 26px;
}

.project-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(to bottom, var(--clr-accent) 0%, rgba(176, 125, 82, 0.25) 100%);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 3px solid var(--clr-accent);
  box-shadow: 0 0 0 2px rgba(176, 125, 82, 0.18);
  transition: transform var(--tr-fast), background var(--tr-fast);
}

.timeline-item:hover .timeline-dot {
  background: var(--clr-accent);
  transform: scale(1.15);
}

.timeline-content {
  display: flex;
  flex-direction: column;
}

.timeline-heading {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.timeline-body {
  font-size: 0.94rem;
  color: var(--clr-text);
  line-height: 1.75;
}

.timeline-body p {
  margin-bottom: 0.55em;
}

.timeline-body p:last-child {
  margin-bottom: 0;
}

.project-description p {
  margin-bottom: 0.75em;
}

.project-description p:last-child {
  margin-bottom: 0;
}

.project-description strong {
  color: var(--clr-text);
  font-weight: 600;
}

.desc-heading-lg {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--clr-divider);
}

.desc-heading {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--clr-accent-dark);
  margin-top: 1.4em;
  margin-bottom: 0.55em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-description > :first-child {
  margin-top: 0 !important;
}

.desc-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1em;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.desc-list li {
  position: relative;
  padding-left: 1.3em;
  line-height: 1.7;
  font-size: 0.94rem;
  color: var(--clr-text);
}

.desc-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--clr-accent);
  font-weight: 700;
}

.desc-callout {
  border-left: 3px solid var(--clr-accent);
  background: rgba(176, 125, 82, 0.08);
  padding: 10px 16px;
  margin: 1em 0;
  border-radius: 0 var(--radius-inner) var(--radius-inner) 0;
  font-size: 0.92rem;
  color: var(--clr-muted);
  line-height: 1.7;
}

.desc-snippet {
  margin: 12px 0;
  padding: 12px 16px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-inner);
  background: var(--bg-tag);
}

.desc-snippet figcaption {
  color: var(--clr-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.desc-snippet pre {
  margin: 6px 0 0;
  font: 0.875rem/1.65 monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.desc-code {
  font-family: monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--bg-tag);
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  color: var(--clr-accent-dark);
}

.hl-underline {
  text-decoration: underline;
  text-decoration-color: #d32f2f;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
  font-weight: 600;
  color: var(--clr-text);
}

/* ---- Embedded Figures in Description / Timeline ---- */
.desc-figure {
  margin: 14px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desc-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-inner);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-card);
  cursor: zoom-in;
  transition: transform var(--tr-fast), box-shadow var(--tr-fast);
  display: block;
}

.desc-figure img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.desc-figcaption {
  font-size: 0.88rem;
  color: var(--clr-muted);
  line-height: 1.6;
  padding: 8px 12px;
  border-left: 3px solid var(--clr-accent);
  background: rgba(176, 125, 82, 0.07);
  border-radius: 0 var(--radius-inner) var(--radius-inner) 0;
}

/* ---- Image Gallery ---- */
.gallery-wrapper {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-title {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--clr-accent-dark);
}

.image-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-inner);
  background: transparent;
  cursor: zoom-in;
}

.project-footer-link:focus-visible,
.image-zoom:focus-visible {
  outline: 2px solid var(--clr-accent-dark);
  outline-offset: -2px;
}

.project-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.project-gallery img {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  display: block;
  background: #ffffff;
  padding: 12px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-inner);
  box-shadow: var(--shadow-img);
  transition: transform var(--tr-medium), box-shadow var(--tr-medium);
  cursor: zoom-in;
}

.project-gallery img:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(43, 37, 29, 0.18);
}

/* ---- Links ---- */
.project-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 9px 22px;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--tr-fast), border-color var(--tr-fast),
              color var(--tr-fast), transform var(--tr-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--clr-text);
  color: #faf9f6;
  border-color: var(--clr-text);
}

.btn-primary:hover {
  background: var(--clr-accent-dark);
  border-color: var(--clr-accent-dark);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--clr-text);
  border-color: var(--clr-border);
}

.btn-outline:hover {
  background: var(--bg-tag);
  border-color: var(--clr-accent);
  color: var(--clr-accent-dark);
  transform: translateY(-1px);
}

.project-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--clr-divider);
  padding-top: 16px;
}

.project-footer-link {
  padding: 6px 12px;
  color: var(--clr-accent-dark);
  font-size: 0.88rem;
  border: 1px solid var(--clr-border);
  border-radius: 7px;
}

.project-footer-link:hover {
  background: var(--bg-tag);
}

.project-description .gallery-wrapper {
  margin: 18px 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-footer);
  color: var(--clr-footer-text);
  padding: 36px 24px 28px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-footer-text);
}

.footer-brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--clr-footer-muted);
  margin-top: 3px;
  letter-spacing: 0.04em;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--clr-footer-muted);
  font-size: 0.83rem;
  font-weight: 400;
  transition: color var(--tr-fast), transform var(--tr-fast);
}

.footer-social-link:hover {
  color: #e8e0d8;
  transform: translateY(-2px);
}

.footer-social-link img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.7;
  transition: opacity var(--tr-fast);
}

.footer-social-link:hover img {
  opacity: 1;
}

.footer-copy {
  width: 100%;
  text-align: center;
  font-size: 0.73rem;
  color: var(--clr-footer-muted);
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
  letter-spacing: 0.04em;
}

/* ============================================================
   LIGHTBOX OVERLAY
   ============================================================ */
.lightbox-open {
  overflow: hidden;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  width: min(92vw, 1100px);
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 48px 16px 16px;
  border: 0;
  border-radius: var(--radius-inner);
  background: #25201b;
}

.lightbox-overlay::backdrop {
  background: rgba(25, 20, 15, 0.88);
}

.lightbox-image-scroll {
  max-height: calc(100dvh - 90px);
  overflow: auto;
  border-radius: var(--radius-inner);
}

.lightbox-overlay img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 90px);
  object-fit: contain;
  background: white;
  border-radius: var(--radius-inner);
}

.lightbox-overlay .lightbox-diagram {
  min-width: 680px;
  max-height: none;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 1.8rem;
  color: #e8e0d8;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity var(--tr-fast);
  background: none;
  border: none;
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

@media (max-width: 600px) {
  .project-tabs:not([hidden]) {
    gap: 4px;
    padding-inline: 8px;
  }

  .project-tabs__home,
  .project-tab {
    padding-inline: 9px;
  }

  .project-tab {
    max-width: 45vw;
  }

  .main-content {
    padding-inline: 12px;
    margin-top: 20px;
  }

  .project-heading,
  .project-body-inner {
    padding: 16px;
  }

  .project-body-inner {
    gap: 22px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-socials {
    flex-wrap: wrap;
    gap: 14px;
  }

  .site-header {
    padding: 36px 18px 20px;
  }
}
