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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  overflow-x: hidden;
}

img, video {
  max-width: 100%;
  display: block;
}

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

/* ============================
   TYPOGRAPHY COMPONENTS
============================ */

/* Display headings — Playfair Display */
.t-display-hero {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

.t-display-1 {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

.t-display-2 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

.t-heading-1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-wide);
}

.t-heading-2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
}

.t-heading-3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
}

/* Body text — Inter */
.t-body-lg {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
}

.t-body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
}

.t-body-sm {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
}

/* Labels & captions */
.t-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: var(--leading-normal);
}

.t-caption {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
}

.t-overline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

/* ============================
   LAYOUT COMPONENTS
============================ */
.container {
  width: 100%;
  max-width: var(--grid-max-width);
  margin-inline: auto;
  padding-inline: var(--section-padding-x);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

.section {
  padding-block: var(--section-padding-y);
  padding-inline: var(--section-padding-x);
}

.grid {
  display: grid;
  gap: var(--grid-gutter);
}

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

.flex {
  display: flex;
}

.flex--center {
  align-items: center;
  justify-content: center;
}

.flex--column {
  flex-direction: column;
}

/* ============================
   DIVIDER — curved section transition
============================ */
.divider-curve {
  position: relative;
}

.divider-curve::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 120px;
  border-radius: 0 0 50% 50%;
  z-index: var(--z-raised);
}

/* ============================
   MEDIA CARD
============================ */
.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-surface-mid);
  transition: var(--transition-transform);
}

.card:hover {
  transform: translateY(-2px);
}

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

.card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.7) 100%);
  opacity: 0;
  transition: var(--transition-opacity);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-6);
}

.card:hover .card__overlay {
  opacity: 1;
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--color-text-primary);
}

.card__meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* Aspect ratios */
.card--portrait { aspect-ratio: 4/5; }
.card--painting { aspect-ratio: 3/4; }
.card--landscape { aspect-ratio: 16/9; }
.card--square { aspect-ratio: 1/1; }

/* ============================
   BUTTON
============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: var(--space-3) var(--space-8);
  border: var(--border-thin) solid transparent;
  border-radius: var(--radius-none);
  cursor: pointer;
  transition: var(--transition-all);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.btn--primary:hover {
  background: var(--color-accent-light);
  box-shadow: var(--shadow-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.btn--ghost:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-text-primary);
}

.btn--text {
  background: transparent;
  color: var(--color-accent);
  padding: var(--space-1) var(--space-2);
}

.btn--text:hover {
  color: var(--color-accent-light);
}

/* ============================
   NAV LINK (hero menu style)
============================ */
.nav-link {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text-primary);
  opacity: 0.55;
  transition: opacity var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-out);
  letter-spacing: var(--tracking-wide);
}

.nav-link:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* ============================
   TAG / BADGE
============================ */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border: var(--border-thin) solid var(--color-border-default);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
}

.tag--accent {
  border-color: var(--color-border-accent);
  color: var(--color-accent);
}

/* ============================
   DIVIDER LINE
============================ */
.divider {
  width: 100%;
  height: var(--border-thin);
  background: var(--color-border-subtle);
  border: none;
}

.divider--accent {
  background: var(--color-accent);
  width: 60px;
  height: var(--border-default);
}

/* ============================
   RESPONSIVE UTILITIES
============================ */
@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--4 {
    grid-template-columns: 1fr;
  }

  .hide-mobile { display: none; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none; }
}

/* ============================
   COLLAGE — draggable photo layout
============================ */
.collage {
  position: relative;
  width: 100%;
  height: 2400px;
}

.collage__item {
  position: absolute;
  cursor: grab;
  user-select: none;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--duration-fast) var(--ease-smooth);
}

.collage__item:active {
  cursor: grabbing;
}

.collage__item img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.collage__item.selected {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-selected);
}

.collage__handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border: 2px solid var(--color-bg-primary);
  border-radius: 2px;
  display: none;
  z-index: var(--z-raised);
}

.collage__item.selected .collage__handle {
  display: block;
}

.collage__handle--tl { top: -7px; left: -7px; cursor: nw-resize; }
.collage__handle--tr { top: -7px; right: -7px; cursor: ne-resize; }
.collage__handle--bl { bottom: -7px; left: -7px; cursor: sw-resize; }
.collage__handle--br { bottom: -7px; right: -7px; cursor: se-resize; }

.collage__rotate-handle {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  border: 2px solid var(--color-bg-primary);
  border-radius: 50%;
  cursor: crosshair;
  display: none;
  z-index: var(--z-raised);
}

.collage__rotate-handle::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 16px;
  background: var(--color-accent);
}

.collage__item.selected .collage__rotate-handle {
  display: block;
}

.collage-toolbar {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toolbar);
  display: none;
  gap: var(--space-2);
  align-items: center;
  background: var(--color-bg-overlay-heavy);
  backdrop-filter: blur(12px);
  border: var(--border-thin) solid var(--color-border-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.edit-mode .collage-toolbar {
  display: flex;
}

.collage-toolbar .status {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.collage-toolbar .sep {
  width: 1px;
  height: 20px;
  background: var(--color-border-default);
}

.collage-toolbar button {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-smooth),
              background var(--duration-fast) var(--ease-smooth);
}

.collage-toolbar button:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

/* ========================
   SIDE NAVIGATION
======================== */
.side-nav {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-8);
  z-index: var(--z-sidenav);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-4);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-smooth);
  pointer-events: none;
}

.side-nav.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-nav__link {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(210, 205, 195, 0.85);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-smooth);
  -webkit-text-stroke: 2px rgba(0,0,0,0.9);
  paint-order: stroke fill;
  text-shadow: 0 0 8px rgba(0,0,0,0.7);
  user-select: none;
  cursor: pointer;
}

.side-nav__link:hover {
  color: var(--color-text-secondary);
}

.side-nav__link.active {
  color: var(--color-accent);
}

/* Nav controls — button row at bottom of side-nav */
.nav-controls {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  justify-content: flex-end;
}

.nav-controls__btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color var(--duration-normal) var(--ease-smooth),
              opacity var(--duration-normal) var(--ease-smooth);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.nav-controls__btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 1px rgba(0,0,0,1)) drop-shadow(0 0 2px rgba(0,0,0,1)) drop-shadow(0 0 6px rgba(0,0,0,0.7));
}

.nav-controls__btn:hover:not(:disabled) {
  color: var(--color-accent);
}

.nav-controls__btn:disabled {
  opacity: 0.2;
  cursor: default;
}

@media (max-width: 768px) {
  .side-nav {
    right: var(--space-3);
    bottom: var(--space-5);
    gap: var(--space-3);
  }

  .side-nav__link {
    font-size: var(--text-xs);
  }
}
