/* ===========================================================
   Café Politique — theme
   Palette:
     black  #373737   red  #c64639   white(cream)  #edddbb
   =========================================================== */

:root {
  --red: #c64639;
  --red-hover: #d75649;
  --black: #373737;
  --cream: #edddbb;

  --radius: 14px;
  --maxw: 1100px;
  --ease: cubic-bezier(.4, 0, .2, 1);

  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

/* ---- Dark theme (default: "the theme of the black") ---- */
:root,
[data-theme="dark"] {
  --bg: #2b2b2b;
  --surface: #373737;
  --surface-2: #424242;
  --text: #edddbb;
  --text-dim: #b8ab90;
  --border: #4d4d4d;
  --accent: var(--red);
  --shadow: 0 18px 45px rgba(0, 0, 0, .45);
}

/* ---- Light theme ---- */
[data-theme="light"] {
  --bg: #edddbb;
  --surface: #f6ecd4;
  --surface-2: #e3d2ab;
  --text: #373737;
  --text-dim: #6b6353;
  --border: #d4c39c;
  --accent: var(--red);
  --shadow: 0 18px 40px rgba(55, 55, 55, .18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  transition: background .35s var(--ease), color .35s var(--ease);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.1;
  margin: 0;
}

a { color: inherit; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--surface-2);
  padding: .1em .4em;
  border-radius: 5px;
  font-size: .9em;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: .85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  font-weight: 600;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--cream);
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-name { font-size: 1.05rem; letter-spacing: .2px; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .2s var(--ease), transform .12s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(.96); }

.theme-toggle-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
  transition: box-shadow .25s var(--ease), background .25s var(--ease);
}
[data-theme="light"] .theme-toggle-icon {
  box-shadow: inset -4px -4px 0 0 var(--accent);
  background: transparent;
}

/* ---------------- Sections ---------------- */
section { padding-block: clamp(2.5rem, 7vw, 5rem); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 .5rem;
}

.next-heading { font-size: clamp(2rem, 6vw, 3.4rem); margin-bottom: 2rem; }

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 2rem;
  position: relative;
  padding-bottom: .6rem;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 60px; height: 4px;
  background: var(--accent);
  border-radius: 2px;
}

/* ---------------- Next event (featured) ---------------- */
.next-event {
  display: grid;
  /* Poster is the FIRST column, info the second. Give the poster the lion's
     share so the featured landscape hero renders slightly bigger than the
     past-event landscape posters (which are 2/3 of their row). */
  grid-template-columns: minmax(0, 2fr) minmax(0, 0.8fr);
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  box-shadow: var(--shadow);
}
.next-event.is-empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--text-dim);
}

.next-event .poster-pair { margin: 0; }

/* Next event: landscape poster on desktop, portrait on mobile.
   Scoped to .next-event so past events + gallery still show both. */
.next-event .poster-pair .slot-portrait { display: none; }
.next-event .poster-pair .slot-landscape { flex: 1 1 auto; }

/* placeholder when the next event has no poster yet */
.poster-soon {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: .03em;
}

.next-event .event-info { display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }

.next-event h3 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }

.next-event .event-meta { font-size: 1rem; }

.next-event .event-desc { color: var(--text-dim); }

/* ---------------- Poster frame (orientation aware) ---------------- */
.poster-frame {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.poster-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
/* aspect ratios driven by detected orientation */
.poster-frame.is-portrait { aspect-ratio: 3 / 4; }
.poster-frame.is-landscape { aspect-ratio: 16 / 9; }
.poster-frame.is-square { aspect-ratio: 1 / 1; }
/* before detection, reserve space to avoid layout jump */
.poster-frame.is-loading { aspect-ratio: 3 / 4; }
.poster-frame.is-loading::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---- poster pair: portrait + landscape side by side ---- */
.poster-pair {
  display: flex;
  gap: .6rem;
  align-items: flex-end; /* align bottoms; different heights look intentional */
}
.poster-pair .poster-frame {
  flex: 1 1 0;
  min-width: 0;
}
/* landscape = 2/3 (shown first), portrait = final 1/3 */
.poster-pair .poster-frame.is-landscape { flex: 2 1 0; order: 0; }
.poster-pair .poster-frame.is-portrait,
.poster-pair .poster-frame.is-square    { flex: 1 1 0; order: 1; }

/* title + date overlaid on the landscape poster */
.poster-caption {
  position: absolute;
  left: 0; right: 0; top: 0;
  padding: 1rem 1.2rem;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--black) 82%, transparent),
    transparent
  );
  color: var(--cream);
  pointer-events: none;
}
.poster-caption h3 {
  font-size: clamp(1.1rem, 2.4vw, 1.9rem);
  line-height: 1.1;
  margin: 0 0 .25rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.poster-caption-date {
  margin: 0;
  font-size: .85rem;
  font-weight: 500;
  opacity: .95;
}
.poster-caption-date .dot { color: var(--accent); }

/* orientation badge */
.poster-badge {
  position: absolute;
  top: .6rem; left: .6rem;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--black) 75%, transparent);
  color: var(--cream);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ---------------- Past events grid ---------------- */
/* one event per row */
.event-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.event-card {
  /* layout:
       title  | portrait
       landscape | portrait   (portrait spans both rows)            */
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto 1fr;
  gap: .6rem 1rem;           /* row-gap | column-gap (space between the two photos) */
  padding: 1.5rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.event-card .card-head {
  grid-column: 1; grid-row: 1;
  padding: .2rem .3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* vertically centered */
  align-items: flex-start;   /* left of the component */
  text-align: left;
}
.card-num {
  font-family: "Fraunces", Georgia, serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
}
.event-card .card-landscape { grid-column: 1; grid-row: 2; align-self: end; }
.event-card .card-portrait {
  grid-column: 2;
  grid-row: 1 / span 2;     /* fill the full height on the right */
  aspect-ratio: auto;
  height: 100%;
}
.event-card .card-portrait img { object-fit: cover; }
.event-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.poster-frame:hover img { transform: scale(1.04); }
.event-card { cursor: pointer; }
.event-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* title + date in the top-left of the card */
.card-head { padding: 1.1rem 1.2rem .25rem; }
.card-head h3 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); margin-bottom: .25rem; }
.card-date { color: var(--text-dim); font-weight: 500; margin: 0; }
.card-date .dot { color: var(--accent); }

.event-card .poster-pair { padding: .6rem .9rem .9rem; }

.event-card .card-body {
  padding: 1.1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.event-card h3 { font-size: 1.2rem; }
.event-card .event-meta { font-size: .85rem; }
.event-card .event-desc {
  font-size: .9rem;
  color: var(--text-dim);
  margin: 0;
}

/* meta row with date pill */
.event-meta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-dim);
  font-weight: 500;
}
.event-meta .dot { color: var(--accent); }

/* "Vezi detalii" button */
.btn-details {
  margin-top: .35rem;
  padding: .6rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--cream);
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s var(--ease), transform .12s var(--ease);
}
.btn-details:hover { background: var(--red-hover); }
.btn-details:active { transform: scale(.96); }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--black) 78%, transparent);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .28s var(--ease);
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.open { opacity: 1; }

.modal {
  position: relative;
  width: auto;
  max-width: min(95vw, 1280px);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  /* leave room at the top so the close button never overlaps content */
  padding-top: 3.75rem;
  transform: translateY(16px) scale(.98);
  transition: transform .28s var(--ease);
}
/* content: big text space on the left, portrait poster on the right */
.modal-content {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: stretch;
}
.modal-text {
  flex: 1 1 320px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: .75rem; right: .9rem;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.modal-close:hover { background: var(--accent); color: var(--cream); }
.modal-close:active { transform: scale(.92); }

.modal-head { margin-bottom: 1.25rem; }
.modal-head h3 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: .4rem; }
.modal-date { color: var(--text-dim); font-weight: 500; }
.modal-date .dot { color: var(--accent); }

.modal-desc {
  margin-top: 1.25rem;
  font-size: 1.05rem;
}
.modal-desc p { margin: 0; }

/* portrait poster on the right — the popup sizes to it */
.modal-poster { flex: 0 0 auto; display: flex; align-items: flex-start; }
.modal-poster .poster-frame {
  aspect-ratio: auto !important;
  width: auto;
  background: var(--surface-2);
}
.modal-poster .poster-frame img {
  display: block;
  width: auto;
  height: auto;
  max-height: 62vh;
  object-fit: contain;
}

@media (max-width: 760px) {
  .modal { width: 100%; }
  .modal-content { flex-direction: column; }
  .modal-poster { justify-content: center; }
  .modal-poster .poster-frame img { max-height: 60vh; max-width: 100%; }
}

/* ---------------- About ---------------- */
.about-body { max-width: 60ch; font-size: 1.05rem; }
.about-body p { margin: 0 0 1rem; }
.conduct-rules { margin: 0; padding-left: 1.2rem; display: grid; gap: .6rem; }
.conduct-rules li { line-height: 1.5; }
.conduct-rules li::marker { color: var(--accent); }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.5rem;
  font-size: .85rem;
  color: var(--text-dim);
}
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

/* ---------------- Pages (tab switching) ---------------- */
.page { display: none; }
.page.is-active {
  display: block;
  animation: page-in .35s var(--ease);
}
@keyframes page-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------------- Header nav ---------------- */
.site-nav {
  display: flex;
  gap: clamp(.75rem, 2.5vw, 1.75rem);
  margin-left: auto;
  margin-right: 1.25rem;
}
.site-nav a {
  text-decoration: none;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-dim);
  padding: .25rem 0;
  position: relative;
  transition: color .2s var(--ease);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width .22s var(--ease);
}
.site-nav a:hover,
.site-nav a.active { color: var(--text); }
.site-nav a:hover::after,
.site-nav a.active::after { width: 100%; }

/* ---------------- Gallery ---------------- */
.gallery-intro { color: var(--text-dim); margin: -1rem 0 2rem; }

/* two sections: landscape (60%) + portrait (rest) */
.gallery-cols {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: flex-start;
}
.gallery-landscape { flex: 0 0 60%; min-width: 0; }
.gallery-portrait  { flex: 1 1 0; min-width: 0; }
.gallery-col-title {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .12em;
}
@media (max-width: 720px) {
  .gallery-cols { flex-direction: column; }
  .gallery-landscape, .gallery-portrait { flex: 1 1 auto; width: 100%; }
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(.6rem, 1.5vw, 1rem);
}
/* landscape thumbs are wider, fewer per row; portrait thumbs taller */
.gallery-landscape .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery-landscape .gallery-item { aspect-ratio: 16 / 9; }
.gallery-portrait  .gallery-item { aspect-ratio: 3 / 4; }

.gallery-item {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.gallery-item img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.gallery-item:hover { border-color: var(--accent); }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- About blocks ---------------- */
.about-block { margin-bottom: clamp(3rem, 7vw, 5rem); }
.about-block:last-child { margin-bottom: 0; }
.about-block > h3 {
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  margin-bottom: 1rem;
  color: var(--text);
}

/* image-beside-text layout */
.about-split {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: flex-start;
}
.about-split .about-body { flex: 1 1 auto; }
.about-media {
  flex: 0 0 auto;
  width: clamp(180px, 32%, 320px);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.organizer-photo {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
  letter-spacing: .05em;
}
@media (max-width: 620px) {
  .about-split { flex-direction: column; }
  .about-media { width: 100%; max-width: 360px; }
}
.locations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.location-card {
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
}
.location-card h4 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  margin: 0 0 .4rem;
}
.location-card p { margin: 0; color: var(--text-dim); }

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--black) 90%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .28s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }

.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.lightbox-img {
  max-width: min(90vw, 1100px);
  max-height: 82vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: scale(.97);
  transition: transform .28s var(--ease);
}
.lightbox.open .lightbox-img { transform: scale(1); }
.lightbox-caption {
  color: var(--cream);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--cream) 30%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--black) 60%, transparent);
  color: var(--cream);
  cursor: pointer;
  transition: background .2s var(--ease), transform .12s var(--ease);
}
.lightbox-close:hover,
.lightbox-nav:hover { background: var(--accent); }
.lightbox-close:active { transform: scale(.92); }
.lightbox-nav:active { transform: translateY(-50%) scale(.92); }

.lightbox-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 46px; height: 46px;
  font-size: 1.8rem; line-height: 1;
}
/* arrows pinned to the sides, vertically centered on screen */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
}
.lightbox-nav svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lightbox-prev { left: clamp(.75rem, 3vw, 2rem); }
.lightbox-next { right: clamp(.75rem, 3vw, 2rem); }

@media (max-width: 640px) {
  .lightbox-nav {
    top: auto; bottom: 1.5rem; transform: none;
    width: 46px; height: 46px;
  }
  .lightbox-nav:active { transform: scale(.92); }
  .lightbox-prev { left: 1.5rem; }
  .lightbox-next { right: 1.5rem; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .next-event { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  /* Next event: swap to the portrait poster on mobile. */
  .next-event .poster-pair .slot-landscape { display: none; }
  .next-event .poster-pair .slot-portrait { display: block; flex: 1 1 auto; }
}
@media (max-width: 560px) {
  .site-nav { gap: .9rem; margin-right: .75rem; }
  .site-nav a { font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
