/**
 * @file
 * Components for the Task Democracy design.
 */

/* Branding: ring logo + two-line site name in Alga ------------------------ */

.site-branding {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.7vw, 52px);
}

.site-branding__logo { flex: 0 0 auto; }

.site-branding__logo img {
  display: block;
  width: clamp(64px, 9.55vw, 182px);
  height: auto;
}

.site-branding__name {
  font-family: var(--font-h1);
  font-weight: var(--weight-h1);
  font-size: clamp(1.6rem, 0.4rem + 3.6vw, 4.6rem);
  line-height: 1.17;
  max-width: 11em;
  text-wrap: balance;
}

.site-branding__name a {
  color: #000;
  text-decoration: none;
}

@media (max-width: 480px) {
  .site-branding__name { font-size: 1.35rem; max-width: 13em; }
}

.site-branding__slogan {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-top: 0.4em;
}

/* Top links: Contact, Log in ---------------------------------------------- */

.header__utility ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(1rem, 2.4vw, 46px);
}

.header__utility a {
  font-family: var(--font-h2);
  font-weight: var(--weight-h2);
  font-size: clamp(0.95rem, 0.4rem + 1.2vw, 2.1rem);
  color: #000;
}

/* Main menu --------------------------------------------------------------- */

.main-menu-toggle {
  display: none;
  background: transparent;
  color: #000;
  font-size: 1.6rem;
  padding: 0.25em 0.4em;
  border-radius: var(--radius);
}

.main-menu-toggle:hover { background: var(--color-bg-alt); color: #000; }

.main-menu {
  padding: clamp(1.25rem, 3.4vw, 64px) 0 clamp(1.25rem, 2.4vw, 46px);
}

.main-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-menu > ul {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(1.5rem, 5vw, 100px);
  row-gap: 0.5rem;
}

.main-menu li { position: relative; }

.main-menu a {
  display: block;
  color: #000;
  font-family: var(--font-h2);
  font-weight: var(--weight-h2);
  font-size: clamp(1.15rem, 0.35rem + 1.75vw, 2.6rem);
  line-height: 1.3;
  text-decoration: none;
}

.main-menu > ul > li > a {
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.main-menu > ul > li > a:hover,
.main-menu > ul > li > a.is-active,
.main-menu > ul > li.menu-item--active-trail > a {
  border-bottom-color: currentColor;
  color: #000;
}

/* Dropdowns */
.main-menu ul ul {
  position: absolute;
  top: 100%;
  left: -1rem;
  min-width: 240px;
  padding: 0.5rem 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s ease;
  z-index: 60;
}

.main-menu ul ul ul { top: -0.5rem; left: 100%; }

.main-menu li:hover > ul,
.main-menu li:focus-within > ul {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.main-menu ul ul a {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  padding: 0.5em 1rem;
}

.main-menu ul ul a:hover { background: var(--color-bg-alt); }

.submenu-toggle { display: none; }

@media (max-width: 991px) {
  .main-menu-toggle { display: inline-block; }

  .header__top { padding-top: 3rem; }

  .main-menu {
    display: none;
    padding: 0.5rem 0 1.25rem;
  }

  .main-menu.is-open { display: block; }

  .main-menu > ul { display: block; }

  .main-menu a { padding: 0.55em 0; border-bottom: 1px solid var(--color-border); }

  .main-menu > ul > li > a,
  .main-menu > ul > li > a:hover,
  .main-menu > ul > li > a.is-active { border-bottom: 1px solid var(--color-border); }

  .main-menu ul ul,
  .main-menu ul ul ul {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    display: none;
    padding: 0 0 0 1rem;
  }

  .main-menu li.is-open > ul { display: block; }

  .submenu-toggle {
    display: block;
    position: absolute;
    top: 0.25rem;
    right: 0;
    background: transparent;
    color: #000;
    padding: 0.5em 0.75em;
  }

  .submenu-toggle:hover { background: var(--color-bg-alt); color: #000; }
}

/* Search bar: rounded pill with a magnifier ------------------------------- */

.search-pill {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: #fff;
  border: 1px solid #000;
  border-radius: 999px;
}

.search-pill .form-item,
.search-pill .form-actions {
  margin: 0;
}

.search-pill .form-item { flex: 1 1 auto; }

.search-pill input[type="search"] {
  width: 100%;
  height: clamp(46px, 3.5vw, 66px);
  padding: 0 1.4em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.6rem + 0.6vw, 1.35rem);
  color: #000;
  -webkit-appearance: none;
  appearance: none;
}

.search-pill input[type="search"]:focus { outline: none; }

.search-pill:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.search-pill input[type="search"]::placeholder { color: #8a8a8a; }

.search-pill__submit,
.search-pill input[type="submit"] {
  width: clamp(46px, 3.5vw, 66px);
  height: clamp(46px, 3.5vw, 66px);
  margin-right: 0.6em;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  color: transparent;
  background: transparent url("../images/search.svg") center / 52% no-repeat;
}

.search-pill__submit:hover,
.search-pill input[type="submit"]:hover {
  background-color: var(--color-bg-alt);
}

/* Smaller version in the header on inner pages. */
.search-region--header { width: clamp(180px, 22vw, 340px); }
.search-region--header .search-pill input[type="search"],
.search-region--header .search-pill__submit,
.search-region--header .search-pill input[type="submit"] { height: 40px; }
.search-region--header .search-pill__submit,
.search-region--header .search-pill input[type="submit"] { width: 40px; margin-right: 0.25em; }
.search-region--header .search-pill input[type="search"] { font-size: 0.95rem; padding: 0 1em; }

/* Hero: full-width photo, "Welcome..." and search bar at the bottom ------- */

.hero {
  display: flex;
  align-items: flex-end;
  min-height: clamp(340px, 30.7vw, 640px);
  background-color: #6d8199;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero__inner {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 4.6vw, 88px);
  padding-inline: max(20px, 5vw) max(20px, 4.7vw);
  padding-bottom: clamp(1.5rem, 5.1vw, 98px);
}

.hero__title {
  flex: 0 0 auto;
  margin: 0;
  font-family: var(--font-h2);
  font-weight: var(--weight-h2);
  font-size: clamp(2rem, 0.6rem + 3.2vw, 4.4rem);
  line-height: 1;
  color: #000;
}

.search-region--hero { flex: 1 1 auto; }

@media (max-width: 767px) {
  .hero {
    position: relative;
    min-height: 300px;
  }

  /* Soft white fade so the black "Welcome..." stays readable on a phone. */
  .hero::before {
    content: "";
    position: absolute;
    inset: 35% 0 0 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75));
  }

  .hero__inner {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
}

/* Front page: intro text and video + text --------------------------------- */

.front-intro {
  padding: clamp(2.5rem, 4.4vw, 84px) 0 clamp(2rem, 4vw, 80px);
}

.front-intro__text,
.feature__text {
  font-size: var(--text-large);
  line-height: 1.34;
}

.front-intro__text > :last-child,
.feature__text > :last-child { margin-bottom: 0; }

.feature {
  display: grid;
  gap: clamp(1.75rem, 3.8vw, 72px);
  margin-top: clamp(2.5rem, 7.2vw, 137px);
  align-items: start;
}

.front-intro__text:empty + .feature,
.feature:first-child { margin-top: 0; }

@media (min-width: 900px) {
  .feature--split { grid-template-columns: 1.2fr 1fr; }
  .feature__text { padding-top: 0.6em; }
}

/* Video that loads only when played (privacy-friendly facade). */
.video-facade {
  position: relative;
  aspect-ratio: 21 / 10;
  background: #000 center / cover no-repeat;
  overflow: hidden;
}

.video-facade iframe,
.video-facade video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.video-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(64px, 6.4vw, 122px);
  height: clamp(64px, 6.4vw, 122px);
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.video-facade__play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.22em 0 0.22em 0.38em;
  border-color: transparent transparent transparent #000;
  font-size: clamp(64px, 6.4vw, 122px);
}

.video-facade__play:hover,
.video-facade__play:focus-visible {
  background: #fff;
  transform: translate(-50%, -50%) scale(1.06);
}

.video-facade.is-playing .video-facade__play { display: none; }

/* Page titles on inner pages (H1 in Alga) --------------------------------- */

.page-title-wrapper .page-title { margin: 0.2em 0 0; }

/* Blocks ------------------------------------------------------------------ */

.block { margin-bottom: 2rem; }
.block:last-child { margin-bottom: 0; }

.block-title {
  font-size: clamp(1.4rem, 1.1rem + 0.8vw, 2rem);
  margin-bottom: 0.6em;
}

.sidebar .block {
  padding: 1.5rem;
  background: var(--color-bg-alt);
  border-radius: 6px;
}

.sidebar .block ul {
  list-style: none;
  padding: 0;
}

.sidebar .block li {
  padding: 0.35em 0;
  border-bottom: 1px solid var(--color-border);
}

.sidebar .block li:last-child { border-bottom: 0; }

/* Nodes ------------------------------------------------------------------- */

.node { margin-bottom: 3rem; }

.node--view-mode-teaser {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.node__title a { color: #000; }
.node__title a:hover { color: var(--color-accent); }

.node__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

.node__meta img { border-radius: 50%; width: 40px; height: 40px; }

.node__links ul.links {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.field--name-field-tags ul,
.field--name-field-tags .field__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}

.field--name-field-tags .field__item a {
  display: inline-block;
  padding: 0.15em 0.8em;
  border: 1px solid #000;
  border-radius: 2em;
  font-size: 0.85rem;
  color: #000;
}

/* Breadcrumb -------------------------------------------------------------- */

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.breadcrumb a { color: var(--color-muted); }

.breadcrumb li + li::before {
  content: "/";
  padding: 0 0.5em;
  color: var(--color-border);
}

/* Messages ---------------------------------------------------------------- */

.messages {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  border-radius: var(--radius);
}

.messages--status { background: #edf7ee; border-color: #039800; }
.messages--warning { background: #fff6e5; border-color: #fd9802; }
.messages--error { background: #fbeaf0; border-color: #980134; }

/* Tabs -------------------------------------------------------------------- */

ul.tabs {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

ul.tabs a {
  display: block;
  padding: 0.3em 1em;
  border: 1px solid #000;
  border-radius: 999px;
  color: #000;
  font-size: 0.95rem;
}

ul.tabs a.is-active { background: #000; color: #fff; }
ul.tabs a:hover { text-decoration: none; background: var(--color-bg-alt); }
ul.tabs a.is-active:hover { background: #000; }

/* Pager ------------------------------------------------------------------- */

.pager__items {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.pager__item a,
.pager__item.is-active {
  display: block;
  padding: 0.35em 0.85em;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.pager__item.is-active {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* Social icons ------------------------------------------------------------ */

.social-media {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
}

.social-media a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #000;
  border-radius: 50%;
  color: #000;
  transition: background 0.2s ease, color 0.2s ease;
}

.social-media a:hover {
  background: #000;
  color: #fff;
  text-decoration: none;
}

/* Comments ---------------------------------------------------------------- */

.comment {
  padding: 1.25rem 0;
  border-top: 1px solid var(--color-border);
}

/* Scroll to top ----------------------------------------------------------- */

.scrolltop {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #000;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.scrolltop.is-visible { opacity: 1; visibility: visible; }
.scrolltop:hover { color: #fff; background: var(--color-accent); text-decoration: none; }
