/* atu.ee rebuild — imitates the original site's Seedlet (WP theme) look:
   Playfair Display headings, Fira Sans body/nav, 790px "alignwide" content
   column, top nav with hover dropdowns. Color/size tokens copied from the
   original theme's style.css. */

@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,400;0,500;1,400&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --font-headings: "Playfair Display", Georgia, Times, serif;
  --font-base: "Fira Sans", Helvetica, Arial, sans-serif;
  --color-primary: #000000;
  --color-primary-hover: #69848c;
  --color-foreground: #333333;
  --color-foreground-low: #444444;
  --color-border: #efefef;
  --elevation: 1px 1px 3px 0px rgba(0, 0, 0, 0.2);
  --spacing-horizontal: 25px;
  --content-width: 790px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-foreground);
  background: #fff;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: normal;
  line-height: 1.3;
  color: var(--color-primary);
}

h1 { font-size: 48px; }
h2 { font-size: 32px; }
h3 { font-size: 28px; }

main a { color: var(--color-primary); }
main a:hover { color: var(--color-primary-hover); }

/* ---- header / primary nav ---- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: center; /* logo sits immediately left of the centered menu */
  gap: 34px;
  padding: 28px var(--spacing-horizontal) 20px;
}

.site-logo { flex: none; display: block; }
.site-logo img { display: block; width: auto; height: 44px; }

/* hamburger toggle (hidden on desktop) */
.menu-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 0;
  padding: 12px;
  color: var(--color-primary);
  cursor: pointer;
}

.menu-toggle .bars,
.menu-toggle .bars::before,
.menu-toggle .bars::after {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform 0.15s ease, top 0.15s ease, background 0.15s ease;
}

.menu-toggle .bars { position: relative; }
.menu-toggle .bars::before,
.menu-toggle .bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle .bars::before { top: -7px; }
.menu-toggle .bars::after { top: 7px; }

body.nav-open .menu-toggle .bars { background: transparent; }
body.nav-open .menu-toggle .bars::before { top: 0; transform: rotate(45deg); }
body.nav-open .menu-toggle .bars::after { top: 0; transform: rotate(-45deg); }

.site-nav { flex: 0 1 auto; }

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 42px;
  row-gap: 6px;
  font-size: 16px;
}

.menu li { position: relative; }

.menu a, .menu .menu-label {
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
}

.menu a:hover, .menu .menu-label:hover,
.menu li.current > a { text-decoration: underline; }
.menu a:hover { color: var(--color-primary); }

/* chevron on items with a dropdown */
.menu li.has-children > a::after,
.menu li.has-children > .menu-label::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
}

/* dropdown panel */
.menu > li > .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -14px;
  z-index: 10;
  min-width: 150px;
  margin: 0;
  padding: 10px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--elevation);
}

.menu > li:hover > .sub-menu,
.menu > li:focus-within > .sub-menu { display: block; }

.sub-menu li { position: static; }

.sub-menu a, .sub-menu .menu-label {
  display: block;
  padding: 8px 14px;
  white-space: nowrap;
}

/* third level: shown indented inside the same panel (as on the original) */
.sub-menu .sub-menu {
  display: block;
  position: static;
  margin: 0;
  padding: 0 0 0 18px;
  list-style: none;
  border: 0;
  box-shadow: none;
  background: none;
}

.sub-menu .sub-menu a { padding-top: 6px; padding-bottom: 6px; }
.sub-menu li.has-children > a::after,
.sub-menu li.has-children > .menu-label::after { content: none; }

/* ---- content column (Seedlet alignwide) ---- */

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px var(--spacing-horizontal) 60px;
}

figure.image-block {
  margin: 30px 0;
}

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

figure.image-block figcaption,
figure.video-block figcaption {
  font-size: 16px;
  color: var(--color-foreground-low);
  text-align: center;
  margin-top: 8px;
}

figure.video-block {
  margin: 30px 0;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

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

.duration { color: var(--color-foreground-low); }
.duration::before { content: "["; }
.duration::after { content: "]"; }

/* ---- Modula custom-grid approximation ----
   12-column grid; grid_width/grid_height from the DB are column/row spans.
   The row unit equals the column width (square grid units), realised with
   container-query units so it tracks the gallery's actual rendered width. */

.gallery {
  container-type: inline-size;
  margin: 20px 0 40px;
}

.modula-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: row dense;
  gap: var(--gutter, 5px);
  grid-auto-rows: calc((100cqw - 11 * var(--gutter, 5px)) / 12);
}

.modula-grid .cell {
  display: block;
  overflow: hidden;
  background: #f2f2f2;
}

.modula-grid .cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* The grid keeps its 12-column span layout at every viewport width and zoom
   level: cqw-based row sizing scales the whole arrangement proportionally.
   (The original Modula tablet/mobile column collapse was dropped on request.) */

@media (max-width: 640px) {
  h1 { font-size: 36px; }
}

/* ---- mobile nav: hamburger + full-screen overlay (as in Seedlet) ---- */
@media (max-width: 640px) {
  .site-header {
    padding-top: 16px;
    padding-bottom: 12px;
  }

  /* the overlay is a sibling inside the header, so the logo and the
     toggle need their own stacking level to stay clickable above it */
  .site-logo, .menu-toggle {
    position: relative;
    z-index: 55;
  }

  /* while open, a solid white bar behind the logo/close button so menu
     items scroll cleanly underneath; drawn as a header child so it stacks
     between the overlay (z-50) and the logo/toggle (z-55) */
  body.nav-open .site-header::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    background: #fff;
    z-index: 52;
  }

  .menu-toggle { display: block; }

  .site-nav { display: none; }

  body.nav-open .site-nav {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: #fff;
    overflow-y: auto;
    padding: 90px var(--spacing-horizontal) 40px;
  }

  body.nav-open { overflow: hidden; }

  /* stacked menu, headings font — Seedlet's mobile nav style */
  .menu {
    display: block;
    font-family: var(--font-headings);
    font-size: 32px;
    line-height: 1.3;
  }

  .menu > li { margin: 20px 0; }

  .menu li.has-children > a::after,
  .menu li.has-children > .menu-label::after { content: none; }

  /* sub-menus always expanded, indented, italic */
  .menu > li > .sub-menu,
  .sub-menu .sub-menu {
    display: block;
    position: static;
    min-width: 0;
    margin: 0;
    padding: 4px 0 0 22px;
    border: 0;
    box-shadow: none;
    background: none;
  }

  .sub-menu a, .sub-menu .menu-label {
    padding: 5px 0;
    font-size: 22px;
    font-style: italic;
    white-space: normal;
  }
}

/* ---- lightbox ---- */

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

.lightbox.open { display: flex; }

.lightbox img {
  max-width: calc(100vw - 7rem);
  max-height: calc(100vh - 5rem);
  object-fit: contain;
}

.lightbox .lb-caption {
  color: #ddd;
  font-size: 16px;
  margin-top: 10px;
  min-height: 1.4em;
  text-align: center;
  padding: 0 1em;
}

.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  font-size: 2.2em;
  line-height: 1;
  cursor: pointer;
  padding: 0.3em 0.45em;
  opacity: 0.8;
}

.lightbox button:hover { opacity: 1; }

.lb-close { top: 0.2em; right: 0.3em; }
.lb-prev { left: 0.1em; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.1em; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox img { max-width: 100vw; max-height: calc(100vh - 7rem); }
  .lb-prev { top: auto; bottom: 0.5em; transform: none; }
  .lb-next { top: auto; bottom: 0.5em; transform: none; }
}
