/*
 * WordPress-specific layer on top of the prototype styles (loaded last).
 * Covers markup that differs from the React prototype: server-rendered route variants,
 * the Work tabs/stack, menu output, the no-JS form and free-text pages.
 */

/* ---------- Route: both geometries are in the HTML, CSS picks one ---------- */
.route--tall {
  display: none;
}
@media (max-width: 1099px) {
  .route--wide {
    display: none;
  }
  .route--tall {
    display: block;
  }
}

/* ---------- Header menu output ---------- */
.header__menu {
  display: flex;
  gap: clamp(20px, 2.4vw, 40px);
}
.menu__list .menu__link[aria-current='page']::after {
  margin-left: 0;
}
.footer__menu li {
  padding: 4px 0;
}
.footer__menu a {
  text-decoration: none;
}
.footer__menu a:hover {
  text-decoration: underline;
}
.footer__brand img {
  height: auto;
}

/* ---------- Selected work ---------- */
/* Default (mobile, or no JS): panels stacked, each with its own title. */
.work__stage:not(.is-tabs) {
  display: flex;
  flex-direction: column;
}
/* Stacked: projects first, "all projects" link after them. */
.work__stage:not(.is-tabs) .work__index {
  order: 2;
  margin: var(--s-6) 0 0;
}
.work__tabs {
  display: none;
}
.work__panels {
  display: grid;
  gap: var(--s-8);
}
.work__meta {
  margin-top: var(--s-5);
}
.work__panel-client {
  display: none;
}
.work__panel-title a {
  text-decoration: none;
}
/* Desktop tab mode (set by main.js) */
.work__stage.is-tabs {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
}
.is-tabs .work__index {
  grid-column: 1 / span 4;
  margin-bottom: 0;
}
.is-tabs .work__tabs {
  display: grid;
}
.is-tabs .work__panels {
  grid-column: 5 / -1;
  display: block;
  padding-left: clamp(16px, 2vw, 40px);
}
.is-tabs .work__panel-cat,
.is-tabs .work__panel-title {
  display: none;
}
.is-tabs .work__panel-client {
  display: block;
}
.work__tab:last-child {
  border-bottom: var(--hair) solid var(--line);
  margin-bottom: var(--s-5);
}
@media (prefers-reduced-motion: no-preference) {
  .is-tabs .work__panel:not([hidden]) .work__media {
    animation: iris 900ms var(--ease) both;
  }
  .is-tabs .work__panel:not([hidden]) .work__meta {
    animation: fadeUp 600ms 180ms var(--ease) both;
  }
}

/* ---------- Projects filter: only useful with JS ---------- */
.filters:not(.is-ready) {
  display: none;
}

/* ---------- Contact form (no-JS + states) ---------- */
.form__hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form {
  position: relative;
}
.form[aria-busy='true'] {
  opacity: 0.7;
  pointer-events: none;
}
.form__alert {
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--accent);
  background: rgba(244, 244, 244, 0.06);
  color: var(--fg);
}
.contact__done {
  outline: none;
}

/* ---------- Free-text pages (privacy, cookies …) ---------- */
.prose {
  max-width: calc(72ch + 2 * var(--margin));
  padding-bottom: var(--section);
  font-size: 1.0625rem;
}
.prose > * + * {
  margin-top: var(--s-4);
}
.prose h2,
.prose h3 {
  margin-top: var(--s-7);
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.prose h2 {
  font-size: var(--t-h3);
}
.prose ul,
.prose ol {
  padding-left: 1.2em;
  list-style: revert;
}
.prose a {
  text-decoration-color: var(--accent);
}

/* ---------- WordPress core niceties ---------- */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
body.admin-bar .header {
  top: var(--wp-admin--admin-bar--height, 32px);
}
@media (max-width: 600px) {
  body.admin-bar .header {
    top: 0;
  }
}

/* ======================================================================
 * IT361 Core integration (2.0): elements that exist in the Core data model
 * ====================================================================== */

/* ---------- Language switcher (Polylang, ≥ 2 languages) ---------- */
.lang__list {
  display: flex;
  gap: 2px;
}
.lang__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 44px;
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--fg-soft);
}
.lang__link:hover {
  color: var(--fg);
}
.lang__link[aria-current='true'] {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.header__lang {
  margin-left: calc(-1 * var(--s-4));
}
.menu__lang {
  margin-top: var(--s-6);
}
.footer__lang {
  margin-top: var(--s-2);
}
@media (max-width: 899px) {
  .header__lang {
    display: none;
  }
}

/* ---------- Testimonials (only rendered when real quotes exist) ---------- */
.quotes {
  border-top: var(--hair) solid var(--line);
}
.quotes__title {
  margin-bottom: var(--s-7);
  max-width: 24ch;
}
.quotes__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--s-7) var(--gutter);
}
.quote {
  margin: 0;
  padding-top: var(--s-5);
  border-top: 2px solid var(--c-graphite);
}
.quote__text {
  margin: 0;
  font-family: var(--f-display);
  font-size: var(--t-h3);
  line-height: 1.35;
}
.quote__text p::before {
  content: '“';
  color: var(--accent);
}
.quote__text p::after {
  content: '”';
  color: var(--accent);
}
.quote__by {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.quote__photo img {
  width: 48px;
  height: 48px;
  border-radius: var(--r-circle);
  object-fit: cover;
}
.quote__name {
  display: block;
  font-weight: 600;
}
.quote__role {
  display: block;
  font-size: var(--t-small);
  color: var(--fg-soft);
}
.quotes--project {
  padding-block: clamp(48px, 6vw, 96px);
}

/* ---------- Studio / about ---------- */
.principles__label {
  margin-bottom: var(--s-4);
}
.studio--page {
  padding-top: 0;
}
.prose-inline > * + * {
  margin-top: var(--s-4);
}
.prose-inline a {
  text-decoration-color: var(--accent);
}
.studio--page .studio__body > p:first-child {
  font-family: var(--f-display);
  font-size: var(--t-h3);
  line-height: 1.35;
}
.portrait__img {
  width: 100%;
  height: 100%;
  border-radius: var(--r-circle);
  object-fit: cover;
}

/* ---------- Services page ---------- */
.svcpage__problems {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--s-3) var(--gutter);
}
.svcpage__problems li {
  position: relative;
  padding: 12px 0 12px 20px;
  border-top: var(--hair) solid var(--line);
}
.svcpage__problems li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.2em;
  width: 8px;
  height: 8px;
  border-radius: var(--r-circle);
  border: 1.5px solid var(--c-graphite);
}
.svcpage__content {
  margin-top: var(--s-3);
  color: var(--fg-soft);
}
.svcpage__cta {
  align-self: end;
}
.stack__body {
  margin-top: var(--s-4);
  color: var(--fg-soft);
  max-width: 46ch;
}

/* ---------- Project archive / case ---------- */
.plist__row--nolink .plist__link,
.plist__row--nolink:hover {
  cursor: default;
}
.pfig__empty-note {
  font-size: var(--t-small);
  color: var(--fg-soft);
}
.case__screens {
  margin-top: clamp(56px, 7vw, 112px);
}
.case__screens .label {
  margin-bottom: var(--s-4);
}
.case__screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: var(--gutter);
}
.case__services {
  display: grid;
  gap: var(--s-3);
  margin-top: clamp(48px, 6vw, 96px);
  max-width: 40rem;
}
.case__block .stack__list {
  margin-bottom: var(--s-3);
}

/* ---------- Contact form: selects, Turnstile, page content ---------- */
.field__select {
  width: 100%;
  min-height: 48px;
  padding: 10px 32px 10px 0;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23f4f4f4' stroke-width='1.5'/%3E%3C/svg%3E")
    no-repeat right 4px center;
  border: 0;
  border-bottom: 1.5px solid rgba(244, 244, 244, 0.4);
  border-radius: var(--r-0);
  color: var(--fg);
  font-size: 1.0625rem;
  appearance: none;
}
.field__select:focus {
  outline: none;
  border-color: var(--c-on-night);
  box-shadow: 0 1.5px 0 var(--c-on-night);
}
.field__select option {
  color: #1f1f21;
}
.cf-turnstile {
  min-height: 65px;
}
.contact__content {
  margin-top: var(--s-6);
  color: var(--fg-soft);
}
.field--choice .field__error {
  margin-top: var(--s-2);
}

/* Long compound words (Swedish/Croatian) must never push the page sideways on phones. */
.h1,
.h2,
.h3,
.hero__title,
.case__next-link,
.work__tab-title,
.products__name {
  overflow-wrap: break-word;
  hyphens: auto;
}
@media (max-width: 599px) {
  .h1,
  .case__next-link {
    overflow-wrap: anywhere;
  }
}

/* Tables in free-text pages (e.g. the IT361 Cookies table) scroll inside themselves on phones. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--t-small);
}
.prose th,
.prose td {
  padding: 10px 12px 10px 0;
  border-bottom: var(--hair) solid var(--line);
  text-align: left;
  vertical-align: top;
}
.prose th {
  font-weight: 600;
  white-space: nowrap;
}
