/* ==========================================================================
   Tumanov Portfolio — Redesign
   Dual theme: light (#fdf9f7) for Home/About, dark (#010101) for Work Detail
   ========================================================================== */

:root {
  /* Accent colors */
  --color-accent: #f95c07;
  --color-accent-yellow: #ccb01c;

  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-console: 'Inconsolata', monospace;
  --font-mono: 'Fira Mono', monospace;
  --font-body: 'Lato', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 5rem;

  /* Layout */
  --max-width: 1920px;
  --side-pad: 200px;
  --header-height: 64px;
}

/* ==========================================================================
   Theme definitions
   ========================================================================== */

.theme-light {
  --color-bg: #fdf9f7;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
}

.theme-dark {
  --color-bg: #010101;
  --color-text: #ffffff;
  --color-text-muted: #999999;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.35;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.7;
}

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

/* ==========================================================================
   Header & Navigation — always black
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  background: #000000;
  z-index: 100;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--side-pad);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  height: 48px;
  width: auto;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  color: #ffffff;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  font-family: var(--font-console);
  font-size: 16px;
  color: #ffffff;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--color-accent);
  opacity: 1;
}

.nav-links a.active {
  color: var(--color-accent);
}

/* ==========================================================================
   Main Layout
   ========================================================================== */

.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--side-pad);
}

/* ==========================================================================
   Footer — always black
   ========================================================================== */

.footer {
  background: #000000;
  color: #ffffff;
  padding: 50px 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--side-pad);
  font-family: var(--font-body);
  font-size: 14px;
  color: #999999;
}

/* ==========================================================================
   Home Page — Cards
   ========================================================================== */

.home-cards {
  display: flex;
  flex-direction: column;
  gap: 100px;
}

.home-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
  padding: 20px;
}

.home-card:hover {
  opacity: 1;
}

.home-card:hover .home-card__title {
  opacity: 0.7;
}

.home-card__info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-end;
  text-align: right;
}

.home-card__title {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1.35;
  transition: opacity 0.2s ease;
}

.home-card__type {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.35;
}

.home-card__year {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
}

.home-card__image {
  height: 544px;
  overflow: hidden;
}

.home-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Work Detail Page — Dark Theme
   ========================================================================== */

.work-detail {
  color: #ffffff;
}

/* Hero */
.work-hero {
  margin-bottom: var(--space-lg);
}

.work-hero__title {
  font-family: var(--font-console);
  font-size: 96px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: lowercase;
  color: #ffffff;
  margin-bottom: var(--space-sm);
}

.work-hero__meta {
  font-family: var(--font-console);
  font-size: 16px;
  font-weight: 700;
  color: #dbdab0;
}

.work-hero__sep {
  margin: 0 8px;
}

/* Anchor nav */
.work-anchors {
  display: flex;
  gap: 30px;
  margin-bottom: var(--space-2xl);
  font-family: var(--font-console);
  font-size: 16px;
  color: var(--color-accent-yellow);
}

.work-anchors a {
  color: var(--color-accent-yellow);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 2-column layout */
.work-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  margin-bottom: var(--space-2xl);
}

.work-layout__decor {
  display: none;
}

.work-layout__content {
  min-width: 0;
}

.work-layout__sidebar {
  min-width: 0;
}

/* Sections */
.work-section {
  margin-bottom: var(--space-2xl);
}

.work-section__title {
  font-family: var(--font-console);
  font-size: 24px;
  font-weight: 400;
  color: var(--color-accent-yellow);
  margin-bottom: var(--space-lg);
  text-transform: lowercase;
}

.work-text {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.52;
  color: #d0d0d0;
  white-space: pre-line;
}

/* Sidebar */
.sidebar-block {
  margin-bottom: var(--space-xl);
}

.sidebar-block__title {
  font-family: var(--font-console);
  font-size: 16px;
  font-weight: 700;
  color: #dbdab0;
  margin-bottom: var(--space-sm);
  text-transform: lowercase;
}

.sidebar-block__list {
  list-style: none;
  font-family: var(--font-console);
  font-size: 16px;
  color: #dbdab0;
  line-height: 1.8;
}

.sidebar-block__list a {
  color: var(--color-accent);
}

/* ==========================================================================
   Media Section
   ========================================================================== */

.work-media {
  margin-bottom: var(--space-2xl);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.gallery-item {
  overflow: hidden;
}

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

.gallery-item figcaption {
  margin-top: var(--space-sm);
  font-family: var(--font-console);
  font-size: 12px;
  color: #999999;
}

.gallery-item.diagram {
  background: #111111;
  padding: var(--space-lg);
}

.gallery-item.diagram img {
  object-fit: contain;
  max-width: 100%;
}

.gallery-item.hidden {
  display: none;
}

/* Tech section */
.work-tech {
  margin-bottom: var(--space-2xl);
}

.tech-block h3 {
  font-family: var(--font-console);
  font-size: 16px;
  color: var(--color-accent-yellow);
  margin-bottom: var(--space-sm);
}

.tech-block ul {
  list-style: none;
  font-family: var(--font-console);
  font-size: 14px;
  color: #cccccc;
  line-height: 1.8;
}

/* Work nav */
.work-nav {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid #333;
}

.work-nav a {
  font-family: var(--font-console);
  font-size: 14px;
  color: #999999;
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-page {
  /* no extra wrapper needed */
}

.about-main {
  display: flex;
  gap: 50px;
  align-items: flex-start;
}

.about-sections {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 50px;
  min-width: 0;
}

.about-section-row {
  display: flex;
  gap: 50px;
  align-items: flex-start;
}

.about-section-row__label {
  width: 300px;
  flex-shrink: 0;
  text-align: right;
}

.about-section-row__label h2 {
  font-family: var(--font-console);
  font-size: 40px;
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1.35;
}

.about-section-row__content {
  flex: 1;
  min-width: 0;
}

.about-bio {
  font-family: var(--font-console);
  font-size: 24px;
  line-height: 1.35;
  color: var(--color-text);
  white-space: pre-line;
}

.about-photo {
  width: 460px;
  flex-shrink: 0;
  border: 1px solid #000000;
}

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

/* Education */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.education-item {
  display: flex;
  gap: 20px;
  font-family: var(--font-console);
  font-size: 24px;
  line-height: 1.35;
  color: var(--color-text);
}

.education-item__period {
  width: 144px;
  flex-shrink: 0;
  font-weight: 700;
}

.education-item__desc {
  flex: 1;
}

.education-item__detail {
  color: var(--color-text-muted);
}

/* Contacts */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-item {
  display: flex;
  gap: 20px;
  font-family: var(--font-console);
  font-size: 24px;
  line-height: 1.35;
}

.contact-item__type {
  width: 144px;
  flex-shrink: 0;
  font-weight: 700;
}

.contact-item a {
  color: var(--color-text);
}

.contact-item a:hover {
  color: var(--color-accent);
  opacity: 1;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox.active {
  display: flex;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.lightbox__caption {
  margin-top: var(--space-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: #999999;
  text-align: center;
}

.gallery-item img {
  cursor: zoom-in;
}

body.lightbox-open {
  overflow: hidden;
}

/* ==========================================================================
   Video Embeds
   ========================================================================== */

.work-videos {
  margin-bottom: var(--space-2xl);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.video-embed {
  position: relative;
  padding-top: 56.25%;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-caption {
  font-family: var(--font-console);
  font-size: 13px;
  color: #999999;
  margin-top: 0.75rem;
  line-height: 1.4;
}

/* ==========================================================================
   WHY Section with Background Image
   ========================================================================== */

.work-section--with-bg {
  position: relative;
  padding: 80px var(--side-pad);
  margin-left: calc(-1 * var(--side-pad));
  margin-right: calc(-1 * var(--side-pad));
  width: calc(100% + 2 * var(--side-pad));
  overflow: hidden;
  background-size: cover;
  background-position: center right;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.work-section--with-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.85) 35%, rgba(0, 0, 0, 0) 60%);
}

.work-section--with-bg > * {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

/* ==========================================================================
   Process Gallery
   ========================================================================== */

.tech-block__subtitle {
  font-family: var(--font-console);
  font-size: 16px;
  color: var(--color-accent-yellow);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.process-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  margin-top: var(--space-lg);
}

.process-gallery img {
  height: 120px;
  width: 120px;
  object-fit: cover;
  cursor: zoom-in;
  flex-shrink: 0;
  filter: grayscale(100%);
  transition: filter 0.2s ease;
}

.process-gallery img:hover {
  filter: grayscale(0%);
}

/* ==========================================================================
   Tech Section Extended
   ========================================================================== */

.tech-description {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.52;
  color: #d0d0d0;
  margin-bottom: var(--space-lg);
  white-space: pre-line;
}

.tech-diagram {
  margin-bottom: var(--space-lg);
  background: #111111;
  padding: var(--space-lg);
}

.tech-diagram img {
  max-width: 100%;
  object-fit: contain;
}

/* ==========================================================================
   HTMX Transitions
   ========================================================================== */

.htmx-request {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.htmx-settling {
  opacity: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1400px) {
  :root {
    --side-pad: 60px;
  }

  .about-photo {
    width: 300px;
  }
}

@media (max-width: 900px) {
  :root {
    --side-pad: 20px;
  }

  .home-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .home-card__info {
    align-items: flex-start;
    text-align: left;
  }

  .home-card__title {
    font-size: 28px;
  }

  .home-card__type,
  .home-card__year {
    font-size: 18px;
  }

  .home-card__image {
    height: 300px;
  }

  .work-hero__title {
    font-size: 48px;
  }

  .work-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .media-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .about-main {
    flex-direction: column;
    gap: 30px;
  }

  .about-section-row {
    flex-direction: column;
    gap: 20px;
  }

  .about-section-row__label {
    width: auto;
    text-align: left;
  }

  .about-section-row__label h2 {
    font-size: 28px;
  }

  .about-bio {
    font-size: 18px;
  }

  .about-photo {
    width: 100%;
    max-width: 400px;
  }

  .education-item {
    flex-direction: column;
    gap: 4px;
    font-size: 18px;
  }

  .education-item__period {
    width: auto;
  }

  .contact-item {
    flex-direction: column;
    gap: 4px;
    font-size: 18px;
  }

  .contact-item__type {
    width: auto;
  }
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }

  .nav-links {
    gap: 12px;
  }

  .nav-links a {
    font-size: 14px;
  }

  .home-card__title {
    font-size: 22px;
  }

  .work-hero__title {
    font-size: 32px;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }

  .home-cards {
    gap: 50px;
  }
}
