/* ============================================================
   Sian Services — product hub
   Flat-modern · Fraunces + Hanken Grotesk + Space Mono
   ============================================================ */

:root {
  --bg:        #0a0a0e;
  --surface:   #131318;
  --surface-2: #1a1a21;
  --surface-3: #23232c;
  --ink:       #f4f2ee;
  --ink-dim:   #a4a1b1;
  --ink-faint: #6d6a7b;
  --line:      rgba(255,255,255,.08);
  --line-2:    rgba(255,255,255,.14);

  --accent:    #8b7cff;        /* default; overridden per card */
  --accent-2:  #b89bff;

  --ok:        #34d399;

  --display: "Fraunces", Georgia, serif;
  --body:    "Hanken Grotesk", system-ui, sans-serif;
  --mono:    "Space Mono", ui-monospace, monospace;

  --maxw: 1200px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
::selection { background: var(--accent); color: #0b0a0e; }

/* one static, flat tint at the top — no drift, no grain */
.atmosphere {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 38% at 50% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

/* ---------- Shared layout ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(56px, 9vw, 120px) 24px; }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-dim);
  margin: 0 0 16px; display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow__tick { color: var(--accent); }
.section--services { --accent: #8b7cff; }

.section__head { max-width: 820px; margin-bottom: clamp(28px, 4vw, 48px); }
.section__title {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.9rem, 4.4vw, 3.2rem); line-height: 1.05;
  letter-spacing: -.02em; margin: 0;
}
.section__sub { color: var(--ink-dim); font-size: 1.06rem; margin: 16px 0 0; max-width: 56ch; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  max-width: var(--maxw); margin: 0 auto; padding: 16px 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nav::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 0; height: 1px; background: var(--line); }
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.nav__mark { color: var(--accent); font-size: 1.05rem; transform: translateY(1px); }
.nav__name { font-size: 1.05rem; letter-spacing: -.01em; }
.nav__name-dim { color: var(--ink-faint); margin-left: 2px; }
.nav__links { margin-left: auto; display: flex; gap: 28px; }
.nav__links a { font-size: .94rem; color: var(--ink-dim); position: relative; padding: 4px 0; transition: color .2s var(--ease); }
.nav__links a::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px; background: var(--accent); transition: width .25s var(--ease); }
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }
.nav__status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .04em; color: var(--ink-dim);
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 100px; background: var(--surface);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.5); }
  70% { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* ---------- Hero ---------- */
.hero { max-width: var(--maxw); margin: 0 auto; padding: clamp(44px, 8vw, 96px) 24px clamp(32px, 5vw, 56px); }
.hero__title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.6rem, 7.6vw, 5.6rem); line-height: .98;
  letter-spacing: -.035em; margin: 0 0 26px; max-width: 17ch;
}
.hero__title span { display: block; }
.hero__title em {
  font-style: italic;
  background: linear-gradient(100deg, #b89bff, #22d3ee 55%, #f5a524);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero__lead { max-width: 52ch; font-size: 1.16rem; color: var(--ink-dim); margin: 0 0 34px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px; border-radius: var(--r-md);
  font-weight: 600; font-size: .96rem;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.btn__arrow { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.btn--primary { background: var(--ink); color: #0b0a0e; }
.btn--primary:hover { transform: translateY(-2px); }
.btn--primary:hover .btn__arrow { transform: translateX(4px); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--line-2); transform: translateY(-2px); }

.hero__stats {
  display: flex; flex-wrap: wrap; gap: clamp(26px, 5vw, 56px);
  margin: clamp(40px, 6vw, 64px) 0 0; padding-top: 28px; border-top: 1px solid var(--line);
}
.hero__stats div { display: flex; flex-direction: column; }
.hero__stats dt { font-family: var(--display); font-size: 2rem; font-weight: 500; line-height: 1; }
.hero__stats dd { margin: 6px 0 0; font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- Apps toolbar (search · filters · view) ---------- */
.apps-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.search {
  display: flex; align-items: center; gap: 9px;
  padding: 0 14px; height: 42px; min-width: 230px; flex: 1 1 230px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .2s var(--ease);
}
.search:focus-within { border-color: var(--line-2); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--ink-faint); stroke-width: 2; flex-shrink: 0; }
.search input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--ink); font-family: var(--body); font-size: .95rem;
}
.search input::placeholder { color: var(--ink-faint); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .02em;
  height: 42px; padding: 0 15px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-dim);
  cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.filter:hover { color: var(--ink); border-color: var(--line-2); }
.filter.is-active { background: var(--ink); color: #0b0a0e; border-color: transparent; font-weight: 700; }

.viewtoggle { display: flex; gap: 4px; margin-left: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.viewtoggle button {
  display: grid; place-items: center; width: 34px; height: 32px;
  background: none; border: none; border-radius: 8px; cursor: pointer; color: var(--ink-faint);
  transition: background .15s, color .15s;
}
.viewtoggle button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.viewtoggle button:hover { color: var(--ink-dim); }
.viewtoggle button.is-active { background: var(--surface-3); color: var(--ink); }

/* ---------- Apps grid (flat) ---------- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
}
.apps-grid.is-list { grid-template-columns: 1fr; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; isolation: isolate;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--surface-2); }
.card__link { position: absolute; inset: 0; z-index: 5; }

.card__art {
  position: relative;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border-bottom: 1px solid var(--line);
  padding: 8px 18px;
}
.motif { display: block; width: 100%; height: auto; max-height: 132px; }

.card__inner { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; gap: 0; }
.card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__tag {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-2);
  padding: 4px 9px; border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.card__badge {
  margin-left: auto;
  font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 7px; font-weight: 700;
  background: linear-gradient(var(--accent), var(--accent-2)); color: #0b0a0e;
}
.card__name { font-family: var(--display); font-weight: 500; font-size: 1.5rem; letter-spacing: -.015em; margin: 0 0 5px; }
.card__tagline { color: var(--ink); font-weight: 600; font-size: 1rem; margin: 0 0 9px; }
.card__desc { color: var(--ink-dim); font-size: .93rem; margin: 0; }
.card__desc em { color: var(--ink); font-style: italic; }

.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; }
.card__url { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); }
.card__open { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--accent-2); }
.card__open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.card:hover .card__open svg { transform: translate(3px, -3px); }

/* ---------- List view ---------- */
.apps-grid.is-list .card { flex-direction: row; align-items: stretch; }
.apps-grid.is-list .card__art { width: 200px; flex-shrink: 0; border-bottom: none; border-right: 1px solid var(--line); display: flex; align-items: center; }
.apps-grid.is-list .card__inner { padding: 18px 22px; }
.apps-grid.is-list .card__foot { padding-top: 14px; }
@media (max-width: 640px) {
  .apps-grid.is-list .card { flex-direction: column; }
  .apps-grid.is-list .card__art { width: auto; border-right: none; border-bottom: 1px solid var(--line); }
}

.apps-empty {
  grid-column: 1 / -1; text-align: center; color: var(--ink-faint);
  font-family: var(--mono); font-size: .9rem; padding: 50px 0;
}
.apps-empty[hidden] { display: none; }

/* ---------- Motif drawing styles ---------- */
.motif .ring { fill: none; stroke: var(--accent-2); stroke-width: 1.5; opacity: .5; }
.motif .ring--faint { opacity: .25; }
.motif .bubble rect { fill: none; stroke: var(--accent-2); stroke-width: 2; }
.motif .bubble path { fill: var(--accent-2); }
.motif .bubble--alt rect { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); }
.motif .bubble--alt path { fill: var(--accent); }
.motif .dot { fill: var(--accent-2); }

.motif--mini .tiles rect { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.motif--mini .t2 { fill: color-mix(in srgb, var(--accent) 30%, transparent); }
.motif--mini .t3 { fill: color-mix(in srgb, var(--accent) 46%, transparent); }
.motif--mini .spark { fill: var(--accent-2); }

.motif--dub .wave rect { fill: var(--accent); opacity: .85; }
.motif--dub .play-ring { fill: var(--surface); stroke: var(--accent-2); stroke-width: 2; }
.motif--dub .play { fill: var(--accent-2); }

.motif--pmcr .bars rect { fill: color-mix(in srgb, var(--accent) 28%, transparent); }
.motif--pmcr .b2 { fill: color-mix(in srgb, var(--accent) 50%, transparent); }
.motif--pmcr .trend { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.motif--pmcr .trend-dot { fill: var(--accent-2); }

.motif--tlx .branch { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linecap: round; opacity: .7; }
.motif--tlx .leaf { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--accent); stroke-width: 1.6; }
.motif--tlx .core { fill: var(--accent); }

/* ---------- Services ---------- */
.services {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.service { background: var(--bg); padding: 28px 22px 32px; position: relative; transition: background .2s var(--ease); }
.service:hover { background: var(--surface); }
.service__num { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); letter-spacing: .1em; }
.service__icon { display: block; width: 30px; height: 30px; margin: 16px 0 14px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.service h3 { font-family: var(--display); font-weight: 500; font-size: 1.22rem; margin: 0 0 8px; letter-spacing: -.01em; }
.service p { color: var(--ink-dim); font-size: .92rem; margin: 0; }

/* ---------- Contact ---------- */
.section--contact { padding-bottom: clamp(64px, 9vw, 120px); }
.contact {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 5vw, 64px); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(32px, 5vw, 60px);
}
.contact__title { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.04; letter-spacing: -.025em; margin: 0 0 16px; }
.contact__title em { font-style: italic; background: linear-gradient(100deg, #b89bff, #22d3ee); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.contact__lead { color: var(--ink-dim); font-size: 1.04rem; margin: 0; max-width: 46ch; }
.contact__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease); }
a.contact-card:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-3); }
.contact-card__label { font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.contact-card__value { font-weight: 600; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; word-break: break-word; }
.contact-card__value svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-card--static { opacity: .92; }

/* ---------- Footer ---------- */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 48px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.footer__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer__apps { margin-left: auto; display: flex; flex-wrap: wrap; gap: 20px; }
.footer__apps a { color: var(--ink-dim); font-size: .9rem; transition: color .2s var(--ease); }
.footer__apps a:hover { color: var(--ink); }
.footer__legal { width: 100%; margin: 4px 0 0; font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); letter-spacing: .04em; }

/* ---------- Reveal animation ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease) var(--d, 0s), transform .6s var(--ease) var(--d, 0s); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .nav__links { display: none; }
  .services { grid-template-columns: repeat(2, 1fr); }
  .contact { grid-template-columns: 1fr; }
  .viewtoggle { display: none; }
}
@media (max-width: 520px) {
  .services { grid-template-columns: 1fr; }
  .contact__cards { grid-template-columns: 1fr; }
  .hero__stats { gap: 26px; }
  .search { max-width: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none; }
  html { scroll-behavior: auto; }
}
