/* ============================================================================
   Glassly AI Lab — v3, aligned to the "Luminous Editorial" system in style.css.
   Loads after style.css and only adds Lab-specific components.
   ============================================================================ */

/* ---------- hero ---------- */
.lab-hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px,5vw,64px); align-items: center; padding: clamp(48px,6vw,84px) 0 clamp(32px,4vw,56px); }
.lab-status {
  display: inline-flex; align-items: center; gap: 9px; font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 600; color: var(--ink-2);
  background: transparent; border: 1px solid var(--line-2); padding: 7px 15px; border-radius: 999px; margin-bottom: 24px;
}
.lab-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.lab-status.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.lab-status.ok .dot { background: var(--ok); }
.lab-status.locked { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.lab-status.locked .dot { background: var(--warn); }
.lab-hero h1 { font-size: clamp(2.6rem, 5.6vw, 4.2rem); line-height: 1.03; letter-spacing: -0.035em; margin-bottom: 20px; }
.lab-lead { font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; margin-bottom: 32px; }

/* neural-network visual */
.nn-stage { position: relative; width: 100%; max-width: 440px; margin: 0 auto; aspect-ratio: 4 / 3; }
.nn-svg { width: 100%; height: 100%; overflow: visible; }
.nn-link { stroke: var(--line-2); stroke-width: 1.1; }
.nn-node { fill: var(--surface); stroke: var(--accent); stroke-width: 1.4; }
.nn-core { fill: var(--accent); opacity: .85; animation: pulseDot 3.4s ease-in-out infinite; }
.nn-core:nth-child(even) { animation-delay: -1.7s; }
.nn-badge {
  position: absolute; font-size: 0.62rem; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-2); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.nb-1 { top: 4%; right: 0; } .nb-2 { bottom: 6%; left: 0; }

/* ---------- public sections ---------- */
.lab-sec { position: relative; }
.lab-stats { grid-template-columns: repeat(6, 1fr); }

/* ingredient intelligence */
.ii { max-width: 740px; margin: 0 auto; }
.ii-search {
  width: 100%; padding: 15px 18px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 0.98rem; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ii-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ii-search::placeholder { color: var(--ink-3); }
.ii-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.ii-chip {
  font-family: inherit; font-size: 0.84rem; color: var(--ink-2); cursor: pointer; background: transparent;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 15px;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.ii-chip:hover { border-color: var(--ink); color: var(--ink); }
.ii-chip.on { background: var(--iris-deep); border-color: transparent; color: #fff; }
.ii-detail { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 28px; min-height: 160px; background: var(--surface); }
.ii-empty { color: var(--ink-3); }
.ii-name { font-size: 1.4rem; margin-bottom: 16px; }
.ii-row { display: grid; grid-template-columns: 148px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 0.93rem; }
.ii-row > span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); padding-top: 3px; font-weight: 600; }
.ii-row.ok > span { color: var(--ok); } .ii-row.warn > span { color: var(--warn); } .ii-row.evi > span { color: var(--accent); }
.ii-row p { color: var(--ink-2); }
.ii-blur { filter: blur(4.5px); user-select: none; opacity: .6; }
.ii-unlock { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 600; font-size: 0.85rem; text-decoration: none; }
.ii-unlock:hover { text-decoration: underline; text-underline-offset: 3px; }

/* skin weather */
.wx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.wx-card { text-align: left; }
.wx-ico { font-size: 1.4rem; margin-bottom: 10px; }
.wx-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-3); font-weight: 600; }
.wx-val { font-family: "Fraunces", Georgia, serif; font-size: 1.9rem; margin: 4px 0 14px; }
.wx-val span { font-family: "Inter", sans-serif; font-weight: 600; font-size: 0.8rem; color: var(--accent); margin-left: 7px; }
.wx-bar { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.wx-bar i { display: block; height: 100%; border-radius: 999px; background: var(--iris-deep); }

/* experimental preview cards */
.prev-card { position: relative; overflow: hidden; }
.prev-lock { position: absolute; top: 20px; right: 20px; font-size: 0.85rem; opacity: .4; }
.prev-teaser {
  display: block; margin-top: 0; max-height: 0; overflow: hidden; opacity: 0;
  font-size: 0.86rem; color: var(--accent);
  transition: max-height .35s ease, opacity .35s ease, margin-top .35s ease;
}
.prev-card:hover .prev-teaser, .prev-card:focus-within .prev-teaser { max-height: 72px; opacity: 1; margin-top: 14px; }
@media (hover: none) { .prev-teaser { max-height: 72px; opacity: 1; margin-top: 14px; } }

/* ---------- premium gate ---------- */
.lab-premium { margin-top: 8px; }
.gate-banner { margin-bottom: 8px; }
.gate-locked, .gate-unlocked {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 20px; padding: 28px 30px; border-radius: var(--r-lg);
  background: linear-gradient(150deg, #2A1C33, #1A1224); color: #F6F1F8;
}
.gate-locked::before {
  content: ""; position: absolute; z-index: -1; width: 46%; aspect-ratio: 1; top: -60%; right: -6%;
  border-radius: 50%; background: radial-gradient(circle, var(--iris-1), transparent 66%);
  opacity: .3; filter: blur(46px);
}
.gate-unlocked { display: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
body.lab-unlocked .gate-locked { display: none; }
body.lab-unlocked .gate-unlocked { display: flex; }
.gate-key { font-size: 1.8rem; flex: none; }
.gate-banner h2 { font-size: 1.24rem; text-align: left; margin: 0 0 4px; color: inherit; }
.gate-banner p { color: rgba(246,241,248,0.74); font-size: 0.92rem; }
.gate-unlocked p { color: var(--ink-2); }
.gate-banner .btn { margin-left: auto; flex: none; }
.gate-locked .btn { background: var(--surface); color: var(--ink); border-color: transparent; }
.gate-locked .btn:hover { background: #fff; }

/* gated feature blur + lock badge */
.lab-feature { position: relative; }
.lab-feature .gated { transition: filter .5s ease; }
body:not(.lab-unlocked) .lab-feature .gated { filter: blur(6px); contain: paint; pointer-events: none; user-select: none; }
.lab-sec, .lab-feature { content-visibility: auto; contain-intrinsic-size: 1px 620px; }
.feat-lock {
  display: none; position: absolute; top: 20px; right: 20px; z-index: 6; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-1);
}
body:not(.lab-unlocked) .feat-lock { display: inline-flex; }

/* AI Skin Coach */
.coach { max-width: 700px; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.coach-log { padding: 22px; min-height: 210px; max-height: 370px; overflow-y: auto; display: flex; flex-direction: column; gap: 11px; }
.cb { max-width: 80%; padding: 12px 16px; border-radius: var(--r); font-size: 0.9rem; line-height: 1.55; }
.cb.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--ink); }
.cb.me { align-self: flex-end; background: var(--iris-deep); color: #fff; border-bottom-right-radius: 5px; }
.coach-qs { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.coach-q {
  font-family: inherit; font-size: 0.82rem; color: var(--ink-2); cursor: pointer; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; transition: border-color .15s ease, color .15s ease;
}
.coach-q:hover { border-color: var(--ink); color: var(--ink); }

/* Future Skin Simulator */
.proto {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
  padding: 3px 9px; border-radius: 999px; vertical-align: middle; margin-left: 8px; font-weight: 700;
}
.fs { max-width: 780px; margin: 0 auto; }
.fs-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 28px; flex-wrap: wrap; }
.fs-tab {
  font-family: inherit; font-size: 0.86rem; color: var(--ink-2); cursor: pointer; background: transparent;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 9px 18px; transition: all .16s ease;
}
.fs-tab:hover { border-color: var(--ink); color: var(--ink); }
.fs-tab.active { background: var(--iris-deep); border-color: transparent; color: #fff; }
.fs-stage { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: center; }
.fs-gauge { margin: 0 auto; }
#fsRing { stroke: var(--accent); }
.fs-metrics { display: flex; flex-direction: column; gap: 14px; }
.fs-note { font-size: 0.86rem; color: var(--accent); margin-top: 6px; }

/* Skin Intelligence Timeline */
.lab-tl { position: relative; max-width: 700px; margin: 0 auto; padding-left: 56px; }
.lab-tl-svg { position: absolute; left: 16px; top: 8px; width: 24px; height: 0; overflow: visible; }
.lab-tl-svg path { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.lab-tl-track { stroke: var(--line); }
.lab-tl-draw { stroke: var(--accent); }
.lab-tl-step { position: relative; margin-bottom: 18px; }
.lab-tl-step:last-child { margin-bottom: 0; }
.lab-tl-node {
  position: absolute; left: -28px; top: 28px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--line-2); transform: translate(-50%,0); z-index: 3;
  transition: background .35s ease, border-color .35s ease;
}
.lab-tl-step.lit .lab-tl-node { background: var(--iris-deep); border-color: transparent; box-shadow: 0 0 0 5px var(--accent-soft); }
.lab-tl-step.lit .card { border-color: var(--line-2); }
.tl-no { position: absolute; top: 22px; right: 26px; font-family: "Fraunces", Georgia, serif; font-size: 1.4rem; color: var(--ink-3); opacity: .4; }

/* Product Match Engine */
.pm { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 34px; max-width: 840px; margin: 0 auto; align-items: start; }
.pm-pick label { display: block; font-size: 0.72rem; color: var(--ink-3); margin-bottom: 9px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }
.pm-select {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 0.95rem; outline: none;
}
.pm-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pm-ing { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pm-chip { font-size: 0.78rem; color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px; }
.pm-scores { display: flex; flex-direction: column; gap: 16px; }
.pm-row .pm-top { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 7px; }
.pm-bar { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pm-bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .7s cubic-bezier(.22,1,.36,1); }
.pm-bar i.g-good { background: var(--ok); }
.pm-bar i.g-warn { background: var(--warn); }
.pm-bar i.g-grad { background: var(--iris-deep); }
.pm-verdict { font-size: 0.9rem; color: var(--ink-2); margin-top: 8px; }

/* Personal Research Reports */
.report-card { position: relative; }
.rep-trend { display: inline-block; font-size: 0.73rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
.rep-trend.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); }
.rep-trend.flat { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line-2); }

/* Skin Weather Intelligence */
.wxi { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.wxi-row {
  display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); font-size: 0.92rem; color: var(--ink-2);
}
.wxi-row b { color: var(--ink); }
.wxi-ico { font-size: 1.2rem; flex: none; }

/* Experimental wing */
.exp-card { position: relative; }
.exp-tag {
  position: absolute; top: 20px; right: 20px; font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--line-2); padding: 4px 10px; border-radius: 999px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .lab-hero { grid-template-columns: 1fr; gap: 32px; padding: 32px 0 20px; }
  .nn-stage { max-width: 380px; }
  .lab-stats { grid-template-columns: repeat(3, 1fr); }
  .fs-stage, .pm { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 640px) {
  .gate-locked, .gate-unlocked { flex-direction: column; text-align: center; }
  .gate-banner h2 { text-align: center; }
  .gate-banner .btn { margin-left: 0; width: 100%; }
  .wx-grid { grid-template-columns: 1fr; }
  .lab-tl { padding-left: 42px; }
  .lab-tl-svg { left: 11px; }
  .lab-tl-node { left: -22px; }
}
@media (max-width: 460px) { .lab-stats { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  .lab-tl-node, .pm-bar i, #fsRing, .lab-tl-draw { transition: none !important; }
}
