/* =========================================================
   Cavalier — live blocks: generator, feed, projects, news,
   artists, language switch, new logo, mobile fixes
   ========================================================= */

/* hero: .hero__inner is a stretched flex item, so the .container width never applied (text touched the edges on phones) */
.hero .hero__inner {
  width: 100%;
  margin-inline: 0;
  padding-inline: max(var(--gutter), calc((100% - var(--container)) / 2));
}

/* ---------- Logo ---------- */
.brand__mark.brand__mark--dog { width: auto; height: 30px; display: block; }
.footer .brand__mark--dog { height: 34px; }

/* ---------- Language switch ---------- */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.lang-switch button {
  padding: 6px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.lang-switch button[aria-pressed="true"] { background: var(--bone); color: var(--ink); }
.mobile-menu__foot .lang-switch { align-self: flex-start; }

/* ---------- Generator ---------- */
.gen__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(20px, 3vw, 40px);
  margin-top: clamp(36px, 5vw, 60px);
  align-items: start;
}
.gen__panel {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  padding: clamp(18px, 2.4vw, 28px);
}
.gen__tabs { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.gen__tabs button {
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}
.gen__tabs button[aria-pressed="true"] { background: var(--bone); color: var(--ink); }
.gen__prompt {
  display: block;
  width: 100%;
  min-height: 132px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg);
  color: var(--bone);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}
.gen__prompt:focus { outline: none; border-color: var(--bone); }
.gen__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.gen__aspects { display: flex; gap: 6px; }
.gen__aspects button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.gen__aspects button[aria-pressed="true"] { border-color: var(--bone); color: var(--bone); }
.gen__ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.gen__ideas button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
}
.gen__ideas button:hover { border-color: var(--line-strong); color: var(--bone); }
.gen__meta { margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted-2); }
.gen__error { margin-top: 10px; font-size: 13px; color: var(--accent-soft); min-height: 1em; }
.gen__stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: radial-gradient(120% 90% at 50% 40%, #151515 0%, var(--bg) 70%);
  overflow: hidden;
}
.gen__stage img, .gen__stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.gen__stage-empty { max-width: 30ch; padding: 24px; text-align: center; color: var(--muted-2); font-size: 14px; line-height: 1.5; }
.gen__progress { display: grid; gap: 14px; justify-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.gen__spinner {
  width: 38px; height: 38px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cv-spin 0.9s linear infinite;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }
.gen__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Feed ---------- */
.feed__filters { display: inline-flex; gap: 6px; }
.feed__filters button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
}
.feed__filters button[aria-pressed="true"] { border-color: var(--bone); color: var(--bone); }
.feed__grid {
  columns: 4 240px;
  column-gap: 12px;
  margin-top: clamp(30px, 4vw, 48px);
}
.feed-item {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 12px;
  break-inside: avoid;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  text-align: left;
}
.feed-item img, .feed-item video { display: block; width: 100%; height: auto; }
.feed-item__cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
  font-size: 12px;
  line-height: 1.4;
  color: var(--bone-dim);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.feed-item:hover .feed-item__cap, .feed-item:focus-visible .feed-item__cap { opacity: 1; }
.feed-item__kind {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--bone);
}
.feed__more { display: flex; justify-content: center; margin-top: 26px; }
.feed__empty { color: var(--muted-2); font-size: 14px; margin-top: 30px; }

/* viewer */
.cv-viewer {
  position: fixed; inset: 0; z-index: 400;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(5, 5, 5, 0.92);
}
.cv-viewer.is-open { display: grid; }
.cv-viewer__box { width: min(1000px, 100%); max-height: 100%; display: grid; gap: 14px; }
.cv-viewer__media { max-height: 72vh; display: grid; place-items: center; }
.cv-viewer__media img, .cv-viewer__media video { max-width: 100%; max-height: 72vh; border-radius: 12px; }
.cv-viewer__prompt { color: var(--bone-dim); font-size: 14px; line-height: 1.5; }
.cv-viewer__row { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-viewer__close { position: absolute; top: 16px; right: 16px; }

/* ---------- Projects ---------- */
.proj__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: clamp(30px, 4vw, 48px);
}
.proj-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-2); }
.proj-card__media { position: relative; aspect-ratio: 16 / 9; background: #000; }
.proj-card__media img, .proj-card__media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.proj-card__media video { opacity: 0; transition: opacity 0.4s var(--ease); }
.proj-card:hover .proj-card__media video, .proj-card.is-playing .proj-card__media video { opacity: 1; }
.proj-card__body { padding: 16px 18px 18px; }
.proj-card__tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); }
.proj-card h3 { margin-top: 8px; font-size: 19px; font-weight: 500; letter-spacing: -0.02em; }
.proj-card p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- News ---------- */
.news__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: clamp(30px, 4vw, 48px);
}
.news-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.news-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.news-card__src { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.news-card h3 { font-size: 17px; font-weight: 500; line-height: 1.3; letter-spacing: -0.015em; }
.news-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- Artists ---------- */
.art__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: clamp(30px, 4vw, 48px);
}
.art-card { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
.art-card__head { display: flex; align-items: center; gap: 14px; }
.art-card__avatar {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  overflow: hidden;
}
.art-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.art-card h3 { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.art-card__role { font-size: 13px; color: var(--accent-soft); }
.art-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.art-card__links { display: flex; flex-wrap: wrap; gap: 6px; }
.art-card__links a { padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--bone-dim); }
.art-card__links a:hover { border-color: var(--bone); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .gen__grid { grid-template-columns: 1fr; }
  .gen__stage { aspect-ratio: 4 / 3; }
}
@media (max-width: 720px) {
  .brand__mark.brand__mark--dog { height: 26px; }
  .header-actions .lang-switch { display: none; }
  .feed__grid { columns: 2 150px; column-gap: 8px; }
  .feed-item { margin-bottom: 8px; border-radius: 10px; }
  .feed-item__cap { display: none; }
  .gen__prompt { min-height: 110px; font-size: 16px; } /* 16px stops iOS from zooming into the field */
  .gen__row { flex-direction: column; align-items: stretch; }
  .gen__row .btn { width: 100%; }
  .gen__aspects { justify-content: space-between; }
  .gen__aspects button { flex: 1; }
  .proj__grid, .news__grid, .art__grid { grid-template-columns: 1fr; }
}

/* the .btn display rule beat the hidden attribute */
[data-cv-dyn] [hidden], .cv-viewer [hidden] { display: none !important; }

/* ---------- Shader layers ---------- */
.cv-fx-hero {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
}
.cv-fx-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gen__progress { position: relative; z-index: 1; }
.gen__progress p, .gen__progress .gen__meta { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9); }

/* =========================================================
   Phone layout, Higgsfield-style: tools and feed first
   ========================================================= */
.m-tiles, .m-more, .m-bar { display: none; }

@media (max-width: 720px) {
  .section { padding-block: 52px; }

  /* short hero, text there at once */
  .hero { min-height: 58svh; padding-bottom: 18px; }
  .hero__content { padding-top: 2vh; }
  .hero .rise { animation: none; opacity: 1; transform: none; }
  .hero__lede { margin-top: 12px; }
  .hero__actions { margin-top: 18px; }
  .hero__actions .btn:nth-child(2), .hero__rail { display: none; }
  .hero__title { font-size: clamp(2.6rem, 12vw, 3.6rem); }

  /* quick tiles */
  .m-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 14px var(--gutter) 0;
  }
  .m-tile { display: grid; gap: 6px; text-align: center; color: var(--bone); font-size: 12px; }
  .m-tile__img {
    display: block;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #111 center / cover no-repeat;
  }
  .m-tile__img--news {
    background:
      linear-gradient(transparent 0 30%, rgba(242,239,231,.85) 30% 36%, transparent 36% 46%, rgba(242,239,231,.45) 46% 50%, transparent 50% 58%, rgba(242,239,231,.45) 58% 62%, transparent 62%) 22% 0 / 56% 100% no-repeat,
      radial-gradient(120% 120% at 20% 0%, #2a1a14, #0e0e0e 70%);
  }
  .m-tile:active .m-tile__img { transform: scale(0.96); }

  /* generator: compact head, ideas as one swipe row */
  .gen.section { padding-top: 26px; }
  .gen .section-head__side, .gen .lede, .feed .lede { display: none; }
  .gen .h2, .feed .h2 { font-size: clamp(1.9rem, 8.5vw, 2.4rem); }
  .gen__grid { grid-template-columns: minmax(0, 1fr); margin-top: 18px; gap: 12px; }
  .gen__grid > * { min-width: 0; }   /* the swipe row of ideas must not widen the column */
  .gen__panel { padding: 14px; }
  .gen__ideas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
  .gen__ideas::-webkit-scrollbar { display: none; }
  .gen__ideas button { flex: none; white-space: nowrap; }
  .feed.section { padding-top: 20px; }
  .feed__grid { margin-top: 18px; }

  /* long lists become sideways swipes */
  .news__grid, .art__grid, .proj__grid, .films__grid, .plans {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .news__grid::-webkit-scrollbar, .art__grid::-webkit-scrollbar, .proj__grid::-webkit-scrollbar,
  .films__grid::-webkit-scrollbar, .plans::-webkit-scrollbar { display: none; }
  .news__grid > *, .art__grid > *, .proj__grid > *, .films__grid > *, .plans > * {
    flex: 0 0 82%;
    scroll-snap-align: start;
    min-width: 0;
  }
  .news-card { min-height: 100%; }

  /* the studio story folds behind one button */
  body:not(.show-more) #studio, body:not(.show-more) #method,
  body:not(.show-more) #vault, body:not(.show-more) #manifesto { display: none; }
  .m-more { display: block; padding-block: 8px 30px; }

  /* sticky prompt bar */
  .m-bar:not([hidden]) {
    display: flex;
    position: fixed;
    left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 150;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(14, 14, 14, 0.9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  }
  .m-bar__input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--bone);
    font-size: 16px;
  }
  .m-bar__input:focus { outline: none; }
  .m-bar__go {
    flex: none;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #0b0b0b;
    font-weight: 600;
    font-size: 14px;
  }
  body.has-bar .footer { padding-bottom: 90px; }
}

@media (max-width: 720px) {
  /* nothing generated yet: a short placeholder instead of an empty square */
  .gen__stage:has(.gen__stage-empty) { aspect-ratio: auto !important; min-height: 96px; }
}
