/* ════════════════════════════════════════════════════════════════
   veretrir.art — Minimal Portfolio Style
════════════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 200px;
  --content-padding: 40px;
  --font: 'EB Garamond', Georgia, serif;
  --text: #222;
  --dim: #666;
  --faint: #999;
  --border: #e0e0e0;
  --bg: #fff;
}

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

html, body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

/* ═══════════════════════════════════════════
   HERO SLIDER (Fullscreen Entry)
═══════════════════════════════════════════ */
.hero-slider {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
}

.hero-slides {
  position: absolute;
  inset: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.hero-slide.active {
  opacity: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.hero-name {
  font-size: 42px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.1em;
  margin-bottom: 40px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-enter {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.6);
  color: #fff;
  padding: 12px 40px;
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.3s;
}

.hero-enter:hover {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}

/* ═══════════════════════════════════════════
   LAYOUT: Site Wrapper with Fade In
═══════════════════════════════════════════ */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.site-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
}

.main-content {
  flex: 1;
  padding: var(--content-padding);
  padding-right: calc(var(--sidebar-width) + var(--content-padding));
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 100;
}

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar-name {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 40px;
  letter-spacing: 0.02em;
}

.sidebar-name a {
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav > a {
  font-size: 14px;
  color: var(--dim);
  transition: color 0.2s;
  padding: 3px 0;
}

.sidebar-nav > a:hover,
.sidebar-nav > a.active {
  color: var(--text);
}

/* Nav item with toggle arrow */
.nav-item-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}

.nav-main {
  font-size: 14px;
  color: var(--dim);
  transition: color 0.2s;
  cursor: default;
}

a.nav-main {
  cursor: pointer;
}

.nav-main:hover,
.nav-main.active {
  color: var(--text);
}

/* Toggle button (arrow) */
.nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 9px;
  color: var(--faint);
  transition: transform 0.3s ease, color 0.2s;
  line-height: 1;
}

.nav-toggle:hover {
  color: var(--text);
}

.nav-toggle.open {
  transform: rotate(180deg);
}

/* Sub dropdown (series, simulations) */
.sub-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  margin-bottom: 0;
}

.sub-dropdown.open {
  max-height: 300px;
  opacity: 1;
  margin-top: 6px;
  margin-bottom: 8px;
}

.sub-link {
  font-size: 12px;
  color: var(--faint);
  transition: color 0.2s;
  padding: 2px 0;
}

.sub-link:hover {
  color: var(--dim);
}

.sub-link.active {
  color: var(--text);
}

/* Sidebar bottom */
.sidebar-bottom {
  margin-top: auto;
}

.lang-switch {
  display: flex;
  gap: 10px;
}

.lang-switch button {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  color: var(--faint);
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.2s;
}

.lang-switch button.active,
.lang-switch button:hover {
  color: var(--text);
}

/* ═══════════════════════════════════════════
   MASONRY GALLERY (CSS Columns)
═══════════════════════════════════════════ */
.gallery-grid {
  column-count: 4;
  column-gap: 25px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 25px;
  cursor: pointer;
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s;
}

.gallery-item:hover img {
  opacity: 0.85;
}

.gallery-item-info {
  padding: 10px 0 5px;
}

.gallery-item-title {
  font-size: 14px;
  font-style: italic;
  margin-bottom: 2px;
}

.gallery-item-meta {
  font-size: 12px;
  color: var(--dim);
}

@media (max-width: 1200px) {
  .gallery-grid { column-count: 3; }
}

@media (max-width: 900px) {
  .gallery-grid { column-count: 2; }
}

@media (max-width: 600px) {
  .gallery-grid { column-count: 1; }
}

/* ═══════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: none;
  overflow-y: auto;
}

.lightbox.open {
  display: block;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 25px;
  background: var(--bg);
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--dim);
  line-height: 1;
  z-index: 1001;
  padding: 5px 10px;
}

.lightbox-close:hover {
  color: var(--text);
}

.lightbox-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 40px 80px;
}

.lightbox-image-wrap {
  margin-bottom: 30px;
}

.lightbox-image {
  max-width: 100%;
  height: auto;
  display: block;
}

.lightbox-info {
  max-width: 700px;
}

.lightbox-title {
  font-size: 22px;
  font-style: italic;
  margin-bottom: 10px;
}

.lightbox-meta {
  font-size: 14px;
  color: var(--dim);
  line-height: 1.8;
  margin-bottom: 25px;
}

.lightbox-desc {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

.lightbox-desc p {
  margin-bottom: 1em;
}

.lightbox-gallery {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

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

.lightbox-materials {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.material-section {
  margin-bottom: 30px;
}

.material-label {
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 10px;
  text-transform: lowercase;
}

.material-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.material-images img,
.material-media img {
  max-width: 100%;
  height: auto;
}

.material-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg);
  border: none;
  font-size: 40px;
  cursor: pointer;
  color: var(--faint);
  padding: 20px;
  transition: color 0.2s;
  z-index: 1001;
}

.lightbox-nav:hover {
  color: var(--text);
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* Action buttons (3D, PDF) */
.btn-action {
  margin-top: 15px;
  margin-right: 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--dim);
  padding: 10px 20px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ═══════════════════════════════════════════
   3D VIEWER OVERLAY
═══════════════════════════════════════════ */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240, 240, 240, 0.98);
  z-index: 1002;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.viewer-overlay.open {
  display: flex;
}

.viewer-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--dim);
  z-index: 10;
  line-height: 1;
}

.viewer-close:hover {
  color: var(--text);
}

.viewer-container {
  width: 80vw;
  height: 70vh;
  max-width: 1000px;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
}

.viewer-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.viewer-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--faint);
}

/* ═══════════════════════════════════════════
   PDF VIEWER OVERLAY
═══════════════════════════════════════════ */
.pdf-overlay {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  z-index: 1002;
  display: none;
  flex-direction: column;
}

.pdf-overlay.open {
  display: flex;
}

.pdf-toolbar {
  height: 50px;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.pdf-title {
  color: #fff;
  font-size: 14px;
}

.pdf-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdf-controls button {
  background: none;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.pdf-controls button:hover {
  border-color: #666;
  color: #fff;
}

.pdf-controls span {
  color: #888;
  font-size: 12px;
}

.pdf-sep {
  color: #444 !important;
}

.pdf-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px;
  background: #2a2a2a;
}

#pdf-canvas {
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ═══════════════════════════════════════════
   ABOUT PAGE
═══════════════════════════════════════════ */
.about-content {
  max-width: 600px;
}

.about-photo {
  width: 200px;
  height: auto;
  margin-bottom: 30px;
}

.about-text {
  font-size: 15px;
  line-height: 1.8;
}

.about-text p {
  margin-bottom: 1em;
}

/* ═══════════════════════════════════════════
   CONTACT PAGE
═══════════════════════════════════════════ */
.contact-content {
  max-width: 500px;
}

.contact-email {
  font-size: 18px;
  margin-bottom: 20px;
}

.contact-email a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}

.contact-email a:hover {
  border-color: var(--text);
}

.contact-note {
  font-size: 14px;
  color: var(--dim);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════
   WRITINGS PAGE
═══════════════════════════════════════════ */
.writings-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--dim);
  cursor: pointer;
  padding: 5px 0;
  transition: color 0.2s;
}

.tab-btn:hover,
.tab-btn.active {
  color: var(--text);
}

.writings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 30px;
}

.book-item {
  cursor: pointer;
}

.book-cover {
  width: 100%;
  height: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.book-item:hover .book-cover {
  transform: translateY(-3px);
}

.book-title {
  margin-top: 10px;
  font-size: 14px;
  font-style: italic;
}

.book-year {
  font-size: 12px;
  color: var(--dim);
}

.writings-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.writing-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.writing-item:hover {
  background: rgba(0,0,0,0.02);
}

.writing-title {
  font-size: 15px;
  font-style: italic;
}

.writing-year {
  font-size: 13px;
  color: var(--dim);
}

/* Reading overlay */
.reading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: none;
  overflow-y: auto;
}

.reading-overlay.open {
  display: block;
}

.reading-close {
  position: fixed;
  top: 20px;
  right: 25px;
  background: var(--bg);
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--dim);
  z-index: 1001;
}

.reading-content {
  max-width: 650px;
  margin: 0 auto;
  padding: 60px 40px 80px;
}

.reading-title {
  font-size: 24px;
  font-style: italic;
  margin-bottom: 10px;
}

.reading-meta {
  font-size: 14px;
  color: var(--dim);
  margin-bottom: 30px;
}

.reading-body {
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
}

/* Book reader (PDF) */
.book-overlay {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  z-index: 1000;
  display: none;
  flex-direction: column;
}

.book-overlay.open {
  display: flex;
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }
  
  .main-content {
    padding: 20px;
    padding-right: 20px;
    padding-bottom: 100px;
  }
  
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-top: 1px solid var(--border);
  }
  
  .sidebar-name {
    margin-bottom: 0;
  }
  
  .sidebar-nav {
    flex-direction: row;
    gap: 15px;
  }
  
  .nav-item-group {
    gap: 4px;
  }
  
  .sub-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 10px;
    margin: 0;
    border-left: none;
  }
  
  .sidebar-bottom {
    margin-top: 0;
  }
  
  .lightbox-nav {
    padding: 10px;
    font-size: 30px;
  }
  
  .lightbox-content {
    padding: 40px 20px 60px;
  }
}
