/* =============================================================================
   Celas Studio — public site (marketing + forum)
   Artwall and Admin have their own sheets: artwall.css, admin.css
   ========================================================================== */

:root {
  --bg:        #f1f4f8;
  --bg-header: rgba(243, 246, 250, .85);
  --ink:       #14160f;
  --ink-2:     #2c3026;
  --ink-3:     #4a4e43;
  --muted:     #a6a99d;
  --line:      rgba(20, 22, 15, .08);
  --line-2:    rgba(20, 22, 15, .14);

  --accent:      #00d677;   /* brand green — same value the desktop app uses */
  --accent-deep: #00a15a;

  --foot-bg:    #0f1210;
  --foot-ink:   #9aa39c;
  --foot-dim:   #6b7268;
  --foot-label: #5f655c;
  --foot-line:  #232823;

  --wrap: 1240px;
  --font: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); font-family: var(--font); color: var(--ink); }
a { color: inherit; }

/* ---------------------------------------------------------- fluid media -- */
/* Every replaced element scales down with its column and never forces a
   horizontal scrollbar. `height:auto` lets the width/height attributes on the
   tag reserve the right box (no layout shift) while still being responsive. */
img, svg, video, canvas, iframe, embed, object {
  max-width: 100%;
}
img, video, canvas {
  height: auto;
}
img {
  /* A broken/missing image should not collapse the layout it was sizing. */
  vertical-align: middle;
}

/* Fixed-ratio box for iframes and videos — see embed() in app/helpers.php. */
.embed {
  position: relative;
  width: 100%;
  aspect-ratio: var(--embed-ratio, 1.7778);
  overflow: hidden;
  border-radius: 12px;
  background: #0f1210;
}
.embed > iframe,
.embed > video,
.embed > object {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Long content must scroll inside itself, never widen the page. */
pre, table { max-width: 100%; overflow-x: auto; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- header -- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--wrap); margin: 0 auto; height: 68px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-header__left  { display: flex; align-items: center; gap: 44px; }
.site-header__right { display: flex; align-items: center; gap: 18px; }
.site-header__logo  { display: inline-flex; align-items: center; text-decoration: none; }
.site-header__logo img { height: 20px; display: block; }

.mainnav { display: flex; gap: 26px; font-size: 15px; font-weight: 500; color: var(--ink-3); }
.mainnav a { text-decoration: none; color: inherit; transition: color .16s ease; }
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.btn-link  { text-decoration: none; color: var(--ink-3); font-size: 14px; font-weight: 600; white-space: nowrap; }
.btn-solid {
  text-decoration: none; background: var(--ink); color: #eef2f7;
  font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 10px;
}
.btn-solid:hover { background: #23261c; }

/* language picker — a real <form>, so it works with JS disabled */
.langpick { position: relative; }
.langpick__toggle {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--ink-3); font-size: 14px; font-weight: 500; cursor: pointer;
}
.langpick__caret { color: var(--muted); font-size: 11px; }
.flag {
  width: 18px; height: 18px; border-radius: 50%; overflow: hidden; flex: none;
  border: 1px solid rgba(20, 22, 15, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flag--lg { width: 20px; height: 20px; }

.langpick__menu {
  position: absolute; top: 34px; right: 0; z-index: 60;
  background: #fff; border: 1px solid rgba(20, 22, 15, .1); border-radius: 12px;
  box-shadow: 0 18px 40px -14px rgba(18, 40, 28, .32);
  padding: 6px; min-width: 210px; max-height: 340px; overflow-y: auto;
}
.langpick__menu[hidden] { display: none; }
.langpick__item { text-decoration: none; color: var(--ink);
  width: 100%; background: none; border: 0; font: inherit; text-align: left;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.langpick__item:hover { background: var(--bg); }
.langpick__name { flex: 1; white-space: nowrap; }
.langpick__code { color: var(--muted); font-size: 12px; letter-spacing: .04em; }

.navtoggle {
  display: none; width: 40px; height: 40px; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
  cursor: pointer; padding: 0; color: var(--ink);
}
.navpanel {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border-bottom: 1px solid rgba(20, 22, 15, .1);
  box-shadow: 0 24px 44px -22px rgba(18, 40, 28, .28);
  padding: 12px 22px 20px; flex-direction: column;
}
.navpanel[hidden] { display: none; }
.navpanel a {
  text-decoration: none; color: var(--ink-2); font-size: 16px; font-weight: 500;
  padding: 13px 4px; border-bottom: 1px solid rgba(20, 22, 15, .06);
}
.navpanel a:last-child { color: var(--accent-deep); font-weight: 600; border-bottom: 0; }

@media (max-width: 900px) {
  .mainnav, .site-header__right .btn-link, .site-header__right .btn-solid { display: none; }
  .navtoggle { display: flex; }
  .navpanel:not([hidden]) { display: flex; }
}

/* ---------------------------------------------------------------- footer -- */
.site-footer {
  background: var(--foot-bg); color: var(--foot-ink);
  padding: 68px 32px 40px;
}
.site-footer__inner { max-width: 1180px; margin: 0 auto; }
.site-footer__top {
  display: flex; justify-content: space-between; gap: 60px; flex-wrap: wrap;
  padding-bottom: 44px; border-bottom: 1px solid var(--foot-line);
}
.site-footer__about { max-width: 380px; }
.site-footer__about img { height: 24px; display: block; }
.site-footer__blurb {
  margin: 14px 0 0; font-size: 14.5px; line-height: 1.55; color: #7c8279; text-wrap: pretty;
}

.socials { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.socials a {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  display: flex; align-items: center; justify-content: center;
  color: var(--foot-ink); text-decoration: none;
}
.socials a svg { width: 15px; height: 15px; }
.socials a:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.site-footer__cols { display: flex; gap: 64px; flex-wrap: wrap; }
.site-footer__coltitle {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--foot-label); font-weight: 600; margin-bottom: 16px;
}
.site-footer__links { display: flex; flex-direction: column; gap: 11px; font-size: 14.5px; }
.site-footer__links a { text-decoration: none; color: var(--foot-ink); }
.site-footer__links a:hover { color: #fff; }

.site-footer__langs {
  padding: 22px 0; border-bottom: 1px solid var(--foot-line);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 18px;
  font-size: 13px; color: var(--foot-dim);
}
.site-footer__langs .label { color: var(--foot-label); margin-right: 6px; }

.site-footer__bottom {
  padding-top: 24px; display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--foot-dim);
}
.site-footer__legal { display: flex; gap: 20px; }
.site-footer__legal a { text-decoration: none; color: var(--foot-dim); }
.site-footer__legal a:hover { color: var(--foot-ink); }

/* --------------------------------------------------------- cookie consent -- */
.cookiebar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 80;
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 48px -20px rgba(18, 40, 28, .34);
  padding: 16px 18px;
}
.cookiebar__text { margin: 0; flex: 1 1 320px; font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.cookiebar__text a { color: var(--accent-deep); }
.cookiebar__actions { display: flex; gap: 10px; flex: none; }
.cookiebar__btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 10px;
  background: #fff; color: var(--ink-3); border: 1px solid var(--line-2);
}
.cookiebar__btn:hover { background: var(--bg); }
.cookiebar__btn--primary { background: var(--ink); color: #eef2f7; border-color: var(--ink); }
.cookiebar__btn--primary:hover { background: #23261c; }

/* ============================================================================
   Modal overlay (partials/modal.php + site.js). Opens /terms, /privacy,
   /forgot-password in place so a half-filled auth form is never lost.
   ========================================================================== */
body.modal-open { overflow: hidden; }
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
}
.modal__overlay { position: absolute; inset: 0; background: rgba(10, 12, 10, .55); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative; z-index: 1; width: min(680px, 100%); max-height: 86vh; overflow: auto;
  background: var(--bg, #fff); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28); padding: 28px 30px;
  animation: modal-in .16s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal__panel:focus { outline: none; }
.modal__close {
  position: sticky; top: -6px; float: right; margin: -8px -8px 0 0;
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg, #fff); color: var(--ink-3); font-size: 22px; line-height: 1; cursor: pointer;
}
.modal__close:hover { color: var(--ink); border-color: var(--line-2); }
.modal__loading, .modal__err { color: var(--ink-3); padding: 24px 4px; text-align: center; }
/* The injected page content: neutralise any full-viewport hero padding. */
.modal__body > * { max-width: 100% !important; }
.modal__body section, .modal__body .inner, .modal__body .legal, .modal__body [class*="__wrap"] {
  padding-left: 0 !important; padding-right: 0 !important;
}
@media (max-width: 560px) { .modal { padding: 12px; } .modal__panel { padding: 22px 18px; } }

/* language link active state */
.langpick__item.is-active { background: var(--bg); }
.langpick__item.is-active .langpick__code { color: var(--accent-deep); }

/* footer language switcher (moved from header) */
.site-footer__langs a.site-footer__lang { color: var(--foot-dim); text-decoration: none; transition: color .15s; }
.site-footer__langs a.site-footer__lang:hover { color: var(--foot-ink); }
.site-footer__langs a.site-footer__lang.is-active { color: #fff; font-weight: 700; }

/* header: signed-in avatar + mobile sign-out */
.site-header__me { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; overflow:hidden; color:#fff; font-size:14px; font-weight:700; text-decoration:none; flex:none; box-shadow:0 0 0 2px #fff, 0 0 0 3px var(--line-2); }
.site-header__me img { width:100%; height:100%; object-fit:cover; display:block; }
.navpanel__signout { display:block; width:100%; text-align:left; background:none; border:0; font:inherit; font-size:16px; font-weight:500; color:var(--accent-deep); padding:13px 4px; cursor:pointer; }

/* Combobox search dropdown (docs + learn) — body-anchored, position set in JS. */
.cx-pop {
  position: fixed; z-index: 200;
  background: #fff; border: 1px solid rgba(20, 22, 15, .12); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(20, 22, 15, .18);
  padding: 6px; max-height: 340px; overflow: auto;
}
.cx-pop[hidden] { display: none; }
.cx-item {
  display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none;
  font-size: 14px; line-height: 1.3; color: #17171b;
}
.cx-item:hover, .cx-item.is-active { background: rgba(20, 22, 15, .07); color: #05130c; }

/* moderation "awaiting review" notice (forum + artwall) */
.mod-pending {
  max-width: 1100px; margin: 16px auto; padding: 12px 16px; border-radius: 12px;
  background: rgba(0,214,119,.10); border: 1px solid rgba(0,214,119,.35);
  color: #0a7a45; font-size: 14px; font-weight: 600; line-height: 1.5;
}

/* newsletter band — shared so the homepage and blog both use it */
.newsletter { padding: 20px 32px 100px; }
.newsletter__box {
  max-width: 1180px; margin: 0 auto;
  background: linear-gradient(120deg, #0f1210, #14201a);
  border-radius: 22px; padding: 56px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 40px; flex-wrap: wrap; position: relative; overflow: hidden;
}
.newsletter__glow {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 214, 119, .2), transparent 62%);
  top: -200px; right: -120px;
}
.newsletter__text { position: relative; z-index: 2; max-width: 520px; }
.newsletter__text h2 {
  margin: 0 0 12px; font-size: 34px; line-height: 1.1; letter-spacing: -.03em;
  font-weight: 700; color: #f4f6f2;
}
.newsletter__text p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--foot-ink); }
.newsletter__form { position: relative; z-index: 2; display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter__input {
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06);
  color: #f4f6f2; font-family: inherit; font-size: 15px; padding: 14px 18px;
  border-radius: 12px; min-width: 240px; outline: none;
}
.newsletter__input::placeholder { color: rgba(244, 246, 242, .5); }
.newsletter__input:focus { border-color: var(--accent); }
.newsletter__btn {
  border: none; cursor: pointer; background: var(--accent); color: #05130c;
  font-family: inherit; font-weight: 700; font-size: 15px; padding: 14px 24px; border-radius: 12px;
}
@media (max-width: 640px) { .newsletter__box { padding: 32px 24px; } }
