/* Edgars Romanovskis — portfolio carousel (vanilla) */
:root {
  --bg: #f7f6f3;
  --fg: #111;
  --muted: #888;
  --muted-soft: #bbb;
  --border: #e0ddd8;
  --border-soft: #e8e5e0;
  --line: #d5d2cc;
  --pill-border: #d5d2cc;
  --tab-muted: #999;
  --italic-desc: #b0aba4;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --ribbon-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --fade-ease: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overscroll-behavior-x: none;
}

@media (max-width: 767px) {
  html, body {
    height: auto;
  }
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.portfolio-root {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  user-select: none;
  overflow: hidden;
}

@media (max-width: 767px) {
  .app-shell {
    height: auto;
    overflow: visible;
  }
  .portfolio-root {
    height: auto;
    overflow: visible;
  }
}

/* ─── Desktop ─── */
.layout-desktop {
  display: none;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

@media (min-width: 768px) {
  .layout-desktop {
    display: flex;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 32%;
  height: 100vh;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 2.25rem 2rem 1.75rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.sidebar-brand-line {
  width: 1px;
  height: 0.875rem;
  background: var(--fg);
}

.sidebar-brand-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #aaa;
}

.sidebar-headline {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
  color: var(--fg);
  margin: 0 0 0.75rem;
  max-width: 220px;
}

.sidebar-intro {
  font-size: 11px;
  line-height: 1.85;
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 230px;
}

.sidebar-cta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid #d0cdc8;
  color: #444;
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s;
}

.btn-contact:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.btn-contact svg {
  transition: transform 0.2s;
}

.btn-contact:hover svg {
  transform: translateX(2px);
}

.section-label {
  padding: 1.25rem 2rem 0.5rem;
  flex-shrink: 0;
}

.section-label-inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.section-label-line {
  width: 0.75rem;
  height: 1px;
  background: var(--line);
}

.section-label-text {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #bbb;
}

.timeline-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 2rem;
}

.timeline-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline-stem {
  position: absolute;
  left: 5px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--border);
  pointer-events: none;
}

.timeline-item {
  position: relative;
  padding-left: 1.75rem;
  margin: 0;
}

.timeline-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.timeline-btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.timeline-node {
  position: absolute;
  left: 0;
  top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s, height 0.3s, transform 0.3s;
}

.timeline-node-dot {
  display: block;
  border-radius: 9999px;
  transition: width 0.3s, height 0.3s, background 0.3s, box-shadow 0.3s;
}

.timeline-item:not(.is-active) .timeline-node {
  width: 7px;
  height: 7px;
  transform: translateX(2px);
}

.timeline-item:not(.is-active) .timeline-node-dot {
  width: 7px;
  height: 7px;
  background: #ccc;
}

.timeline-item:not(.is-active) .timeline-btn:hover .timeline-node-dot {
  background: #888;
}

.timeline-item.is-active .timeline-node {
  width: 11px;
  height: 11px;
  transform: translateX(0);
}

.timeline-item.is-active .timeline-node-dot {
  width: 11px;
  height: 11px;
  background: var(--fg);
  box-shadow: 0 0 0 2px var(--bg);
}

.timeline-entry {
  padding-top: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.timeline-item.is-active .timeline-entry {
  border-color: var(--border);
}

.timeline-item:not(.is-active) .timeline-btn:hover .timeline-entry {
  border-color: #eee;
}

.year-label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 0.125rem;
  transition: color 0.2s;
}

.timeline-item.is-active .year-label {
  color: #bbb;
}

.timeline-item:not(.is-active) .year-label {
  color: #d5d2cc;
}

.timeline-item:not(.is-active) .timeline-btn:hover .year-label {
  color: #bbb;
}

.cat-row {
  margin-bottom: 0.125rem;
}

.cat-label {
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-right: 0.375rem;
  transition: color 0.2s;
}

.timeline-item.is-active .cat-label {
  color: #bbb;
}

.timeline-item:not(.is-active) .cat-label {
  color: #d5d2cc;
}

.timeline-item:not(.is-active) .timeline-btn:hover .cat-label {
  color: #bbb;
}

.cat-slash {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d0ccc8;
}

.timeline-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin: 0;
  transition: color 0.2s;
}

.timeline-item.is-active .timeline-title {
  color: var(--fg);
}

.timeline-item:not(.is-active) .timeline-title {
  color: #aaa;
}

.timeline-item:not(.is-active) .timeline-btn:hover .timeline-title {
  color: #444;
}

.timeline-sub {
  font-size: 11px;
  line-height: 1.375;
  margin: 0.125rem 0 0;
  transition: color 0.2s;
}

.timeline-item.is-active .timeline-sub {
  color: var(--muted);
}

.timeline-item:not(.is-active) .timeline-sub {
  color: #bbb;
}

.timeline-item:not(.is-active) .timeline-btn:hover .timeline-sub {
  color: #999;
}

.timeline-expanded {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s var(--fade-ease), opacity 0.3s;
}

.timeline-item.is-active .timeline-expanded {
  max-height: 1200px;
  opacity: 1;
}

.timeline-desc {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin: 1rem 0 0;
  max-width: 230px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--pill-border);
  border-radius: 9999px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tab-muted);
  font-weight: 500;
}

.tab-desc {
  font-size: 11px;
  line-height: 1.8;
  color: var(--italic-desc);
  margin: 0.75rem 0 0;
  max-width: 230px;
  font-style: italic;
  transition: opacity 0.2s;
}

.tab-list {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tab-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s, color 0.2s;
  color: var(--tab-muted);
}

.tab-list button:hover {
  background: #f0ede8;
  color: #333;
}

.tab-list button.is-active {
  background: var(--fg);
  color: #fff;
}

.tab-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  flex-shrink: 0;
  color: #ccc;
}

.tab-list button.is-active .tab-num {
  color: rgba(255, 255, 255, 0.5);
}

.tab-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

.tab-indicator {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-counter {
  font-family: var(--mono);
  font-size: 11px;
  color: #bbb;
}

.footer-counter strong {
  color: var(--fg);
  font-weight: 600;
}

.footer-counter span.sep {
  margin: 0 0.25rem;
  color: #ddd;
}

.nav-arrows {
  display: flex;
  gap: 0.25rem;
}

.nav-arrows button {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d0cdc8;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  padding: 0;
}

.nav-arrows button:hover:not(:disabled) {
  border-color: var(--fg);
  color: var(--fg);
}

.nav-arrows button:disabled {
  border-color: #eee;
  color: #ddd;
  cursor: not-allowed;
}

/* Desktop media */
.desktop-media {
  display: flex;
  flex: 1;
  height: 100vh;
  overflow: hidden;
}

.ribbon-wrap {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.ribbon-strip {
  display: flex;
  flex-direction: row;
  height: 100%;
  will-change: transform;
  transition: transform 0.52s var(--ribbon-ease);
}

.ribbon-cell {
  position: relative;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

/* display: non forzare su [hidden]: altrimenti il video “sopra” nel DOM copre le altre slide */
.ribbon-cell img:not([hidden]),
.ribbon-cell video:not([hidden]) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.38s ease-in-out;
}

.ribbon-cell img.is-fading {
  opacity: 0.85;
}

.preview-strip {
  position: relative;
  width: 5%;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  padding: 0;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
}

.preview-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  pointer-events: none;
  z-index: 1;
}

.preview-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
  filter: brightness(0.16);
  transition: filter 0.3s ease;
}

.preview-strip:hover img {
  transform: none;
  filter: brightness(0.46);
}

.preview-strip-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  pointer-events: none;
  z-index: 2;
}

.preview-strip-inner .vline {
  width: 1px;
  height: 1.5rem;
  background: rgba(255, 255, 255, 0.6);
}

.preview-title {
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.preview-strip .preview-arrow {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
}

.preview-strip:hover .preview-arrow {
  opacity: 1;
}

/* ─── Mobile ─── */
.layout-mobile {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

@media (min-width: 768px) {
  .layout-mobile {
    display: none;
  }
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  transform: translateY(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-header.is-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.mobile-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mobile-header-name {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--fg);
  font-weight: 600;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.mobile-header-line {
  width: 1px;
  align-self: stretch;
  background: var(--fg);
}

.mobile-header-title {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #999;
}

.mobile-ribbon {
  width: 100%;
  height: auto !important;
  flex: none !important;
  overflow: hidden;
}

.mobile-ribbon .ribbon-strip {
  height: auto !important;
  align-items: flex-start;
}

.mobile-ribbon .ribbon-cell {
  height: auto;
}

.mobile-ribbon .ribbon-cell img:not([hidden]),
.mobile-ribbon .ribbon-cell video:not([hidden]) {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  object-fit: unset;
  display: block;
  background: #0a0a0a;
}

.mobile-info {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.25rem 0.75rem;
  flex-shrink: 0;
}

.mobile-info-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mobile-info h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.mobile-meta {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #bbb;
  display: block;
  margin-bottom: 0.125rem;
}

.mobile-cat-row {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.mobile-cat {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #bbb;
}

.mobile-slash {
  font-size: 9px;
  color: #d5d2cc;
}

.mobile-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 0.125rem 0 0;
  line-height: 1.375;
}

.mobile-desc {
  font-size: 11px;
  line-height: 1.75;
  color: var(--muted);
  margin: 0.75rem 0 0.5rem;
}

.mobile-tab-desc {
  font-size: 11px;
  line-height: 1.75;
  color: var(--italic-desc);
  font-style: italic;
  margin: 0 0 1rem;
}

.mobile-tab-list {
  margin: 0 0 0.25rem;
  padding: 0;
  list-style: none;
}

.mobile-tab-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.75rem;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--tab-muted);
  transition: background 0.2s, color 0.2s;
}

.mobile-tab-list button:hover {
  background: #f0ede8;
}

.mobile-tab-list button.is-active {
  background: var(--fg);
  color: #fff;
}

.mobile-tab-list .tab-num {
  font-size: 9px;
}

.mobile-tab-list .tab-label {
  font-size: 10px;
}

.mobile-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
}

@media (min-width: 768px) {
  .mobile-nav { display: none; }
}

.layout-mobile {
  padding-bottom: 3.5rem;
}

.mobile-footer {
  padding: 1.75rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-footer-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-footer-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.mobile-footer-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mobile-footer-role {
  display: block;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

.mobile-dots {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-dots button {
  padding: 0;
  border: none;
  background: #ddd;
  border-radius: 9999px;
  cursor: pointer;
  transition: width 0.3s, height 0.3s, background 0.3s;
}

.mobile-dots button:not(.is-active) {
  width: 5px;
  height: 5px;
}

.mobile-dots button.is-active {
  width: 1.25rem;
  height: 3px;
  background: var(--fg);
  border-radius: 2px;
}

.mobile-nav .nav-arrows button {
  width: 2.25rem;
  height: 2.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

img.broken-image-fallback {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  object-fit: none;
}

/* Ribbon: più immagini per progetto nello stesso slot (SEO: tutte nel DOM) */
.ribbon-cell {
  position: relative;
}

.ribbon-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ribbon-slide:not([hidden]) {
  display: block;
  z-index: 2;
}

.ribbon-slide[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: 0;
}

.ribbon-cell video.ribbon-slide {
  background: #0a0a0a;
}

.mobile-cat-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #111;
}

.noscript-fallback {
  padding: 2rem;
  background: #fff;
  border-top: 1px solid var(--border);
}

.noscript-fallback ul {
  line-height: 1.6;
}
