/* Portfolio / case-study components: PageSpeed-style score panel, device viewer,
   and the mini score strip on the homepage project cards. Loaded only on work pages. */

:root {
  --wk-pass: #0c6;
  --wk-pass-text: #080;
  --wk-avg: #fa3;
  --wk-avg-text: #c33300;
  --wk-fail: #f33;
  --wk-fail-text: #c00;
  --wk-psi-font: system-ui, Roboto, Helvetica, Arial, sans-serif;
  --wk-mono: "Roboto Mono", Menlo, Consolas, monospace;
}

/* ---------- Lighthouse-style gauge ---------- */
.wk-gauge { display: flex; flex-direction: column; align-items: center; width: 120px; text-align: center; }
.wk-gauge__ring { position: relative; width: 96px; height: 96px; }
.wk-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.wk-gauge circle { stroke-width: 8; }
.wk-gauge__base { opacity: .1; }
.wk-gauge__arc { fill: none; stroke-linecap: round; }
.wk-gauge__num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--wk-mono); font-size: 34px; line-height: 1; font-weight: 400;
}
.wk-gauge__label { margin-top: 14px; font: 500 16px/22px var(--wk-psi-font); color: #212121; }
.wk-gauge.is-pending circle { stroke: #bdbdbd; fill: #bdbdbd; }
.wk-gauge.is-pending .wk-gauge__num { color: #9e9e9e; }
.wk-gauge.is-pass { color: var(--wk-pass-text); fill: var(--wk-pass); stroke: var(--wk-pass); }
.wk-gauge.is-avg { color: var(--wk-avg-text); fill: var(--wk-avg); stroke: var(--wk-avg); }
.wk-gauge.is-fail { color: var(--wk-fail-text); fill: var(--wk-fail); stroke: var(--wk-fail); }
.wk-gauge circle { fill: inherit; stroke: inherit; }
.wk-gauge .wk-gauge__arc { fill: none; }

/* fraction pill (Agentic Browsing) */
.wk-frac { display: flex; flex-direction: column; align-items: center; width: 120px; }
.wk-frac__pill {
  position: relative; height: 96px; display: flex; align-items: center;
}
.wk-frac__inner {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-radius: 48px; font: 28px/1 var(--wk-psi-font); color: #9e9e9e;
  transition: color .4s;
}
.wk-frac__inner::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #bdbdbd; opacity: .15; transition: background .4s; }
.wk-frac__val { font-weight: 400; }
.wk-frac__dot { display: block; flex: none; width: 20px; height: 20px; border-radius: 50%; background: #bdbdbd; transition: background .4s; }
.wk-frac.is-pass .wk-frac__inner { color: var(--wk-pass-text); }
.wk-frac.is-pass .wk-frac__inner::before, .wk-frac.is-pass .wk-frac__dot { background: var(--wk-pass); }

/* ---------- PageSpeed panel ---------- */
.wk-psi {
  background: #fff; color: #212121; border-radius: 24px; overflow: hidden;
  font-family: var(--wk-psi-font); box-shadow: 0 30px 80px rgba(0,0,0,.18);
}
.wk-psi__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 28px; border-bottom: 1px solid #ebebeb;
}
.wk-psi__url { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #424242; min-width: 0; }
.wk-psi__url b { font-weight: 600; color: #212121; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-psi__tabs { display: inline-flex; background: #f1f3f4; border-radius: 999px; padding: 4px; }
.wk-psi__tabs button {
  border: 0; background: transparent; border-radius: 999px; padding: 8px 18px;
  font: 500 14px var(--wk-psi-font); color: #5f6368; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.wk-psi__tabs button[aria-selected="true"] { background: #fff; color: #1a73e8; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.wk-psi__tabs svg { width: 16px; height: 16px; fill: currentColor; }
.wk-psi__status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 12px 20px 0; font-size: 14px; color: #5f6368;
}
.wk-psi__spin { width: 16px; height: 16px; border: 2px solid #c6dafc; border-top-color: #1a73e8; border-radius: 50%; animation: wk-spin .8s linear infinite; }
.wk-psi__status.is-done .wk-psi__spin { display: none; }
.wk-psi__status.is-done { color: #188038; }
@keyframes wk-spin { to { transform: rotate(360deg); } }
.wk-psi__progress { height: 3px; background: #e8f0fe; margin: 10px 28px 0; border-radius: 3px; overflow: hidden; }
.wk-psi__progress i { display: block; height: 100%; width: 0; background: #1a73e8; transition: width .35s ease; }
.wk-psi__status.is-done + .wk-psi__progress { opacity: 0; transition: opacity .4s .3s; }
.wk-psi__gauges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; padding: 26px 20px 10px; }
.wk-psi__scale { display: flex; justify-content: center; gap: 28px; font-size: 12px; color: #616161; padding: 6px 20px 22px; }
.wk-psi__scale span { display: inline-flex; align-items: center; gap: 6px; }
.wk-psi__scale i { display: inline-block; width: 10px; height: 10px; }
.wk-psi__scale .f { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 10px solid var(--wk-fail); }
.wk-psi__scale .a { background: var(--wk-avg); }
.wk-psi__scale .p { background: var(--wk-pass); border-radius: 50%; }
.wk-psi__metrics {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; margin: 0 28px; border-top: 1px solid #ebebeb;
  opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s;
}
.wk-psi__metrics.is-in { opacity: 1; transform: none; }
.wk-psi__metric { display: grid; grid-template-columns: 26px 1fr; padding: 12px 4px; border-bottom: 1px solid #ebebeb; }
.wk-psi__metric i { width: 12px; height: 12px; border-radius: 50%; background: var(--wk-pass); margin-top: 5px; }
.wk-psi__metric.is-avg i { border-radius: 0; background: var(--wk-avg); }
.wk-psi__metric span { font-size: 14px; }
.wk-psi__metric b { grid-column: 2; font: 400 25px/1.3 var(--wk-psi-font); color: var(--wk-pass-text); }
.wk-psi__metric.is-avg b { color: var(--wk-avg-text); }
.wk-psi__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 22px 28px 26px; font-size: 13px; color: #616161;
}
.wk-psi__foot p { margin: 0; max-width: 520px; line-height: 1.5; }
.wk-psi__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.wk-psi__btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 18px;
  font: 500 14px var(--wk-psi-font); text-decoration: none; cursor: pointer; border: 1px solid #dadce0; background: #fff; color: #1a73e8;
}
.wk-psi__btn--solid { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.wk-psi__btn--solid:hover { background: #1765cc; color: #fff; }
.wk-psi__btn:hover { color: #1765cc; }
.wk-psi__btn--solid:hover { color: #fff; }
@media (max-width: 640px) {
  .wk-psi__bar, .wk-psi__foot { padding-left: 18px; padding-right: 18px; }
  .wk-psi__metrics { grid-template-columns: 1fr; margin: 0 18px; }
  .wk-gauge { width: 96px; }
  .wk-gauge__ring { width: 72px; height: 72px; }
  .wk-gauge__num { font-size: 26px; }
  .wk-gauge__label { font-size: 13px; line-height: 18px; margin-top: 10px; }
  .wk-frac { width: 96px; }
  .wk-frac__pill { height: 72px; }
  .wk-frac__inner { font-size: 20px; padding: 8px 14px; gap: 8px; }
  .wk-frac__dot { width: 14px; height: 14px; }
}

/* ---------- Device viewer ---------- */
.wk-viewer__tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.wk-viewer__tabs button {
  border: 1px solid var(--color-border-1, #d9d9d9); background: transparent; color: inherit;
  border-radius: 999px; padding: 9px 22px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.wk-viewer__tabs button[aria-selected="true"] { background: #111; color: #fff; border-color: #111; }
.active-body .wk-viewer__tabs button[aria-selected="true"] { background: #fff; color: #111; border-color: #fff; }
.wk-viewer__stage { display: flex; justify-content: center; }
.wk-browser {
  width: 100%; max-width: 1080px; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,.22); border: 1px solid rgba(0,0,0,.08);
}
.wk-browser__bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #f1f3f4; border-bottom: 1px solid #e0e0e0; }
.wk-browser__dots { display: flex; gap: 7px; }
.wk-browser__dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.wk-browser__dots i:nth-child(2) { background: #febc2e; }
.wk-browser__dots i:nth-child(3) { background: #28c840; }
.wk-browser__url {
  flex: 1; max-width: 520px; margin: 0 auto; background: #fff; border-radius: 999px; padding: 6px 16px;
  font: 13px var(--wk-psi-font); color: #444; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-scroll { position: relative; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.wk-scroll img { display: block; width: 100%; height: auto; }
.wk-browser .wk-scroll { height: min(620px, 70vh); }
.wk-phone {
  width: 320px; max-width: 86vw; padding: 12px; border-radius: 46px; background: #111;
  box-shadow: 0 30px 80px rgba(0,0,0,.3), inset 0 0 0 2px #333;
}
.wk-phone .wk-scroll { height: min(640px, 72vh); border-radius: 34px; background: #fff; }
.wk-phone__notch { position: relative; height: 0; }
.wk-phone__notch::after { content: ""; position: absolute; z-index: 2; top: 8px; left: 50%; transform: translateX(-50%); width: 96px; height: 26px; border-radius: 20px; background: #111; }
.wk-viewer__hint { text-align: center; margin-top: 16px; font-size: 14px; opacity: .7; }
.wk-viewer [hidden] { display: none !important; }

/* ---------- Case-study page layout ---------- */
.wk-hero { padding: 70px 0 30px; }
.wk-kicker { display: inline-block; font-size: 14px; letter-spacing: .08em; text-transform: lowercase; margin-bottom: 14px; }
.wk-kicker::before { content: "[ "; } .wk-kicker::after { content: " ]"; }
.wk-hero h1 { font-size: clamp(40px, 6vw, 76px); line-height: 1.05; margin-bottom: 18px; }
.wk-hero .lead { font-size: 19px; line-height: 1.6; max-width: 640px; }
.wk-pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 22px 0 26px; }
.wk-pills li { border: 1px solid #45d0bd; border-radius: 999px; padding: 5px 14px; font-size: 14px; }
.wk-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.wk-section { padding: 50px 0; }
.wk-section h2 { font-size: clamp(30px, 4vw, 48px); margin-bottom: 12px; }
.wk-section .sub { max-width: 680px; margin-bottom: 34px; font-size: 17px; line-height: 1.6; }
.wk-dark { background: #1f1f1f; color: #fff; border-radius: 30px; margin: 0 15px; padding: 70px 0; }
.wk-dark h2, .wk-dark .sub { color: #fff; }

/* ---------- Homepage card: mini score strip + scrolling screenshot ---------- */
.wk-mini {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 26px; padding: 14px 12px 10px; border-radius: 18px;
  background: rgba(16,16,16,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.08);
}
.wk-mini .wk-gauge { width: auto; flex: 1; }
.wk-mini .wk-gauge__ring { width: 46px; height: 46px; }
.wk-mini .wk-gauge circle { stroke-width: 9; }
.wk-mini .wk-gauge__num { font-size: 15px; }
.wk-mini .wk-gauge__label { margin-top: 6px; font-size: 10.5px; line-height: 13px; color: #cfcfcf; }
.wk-mini .wk-gauge.is-pass { color: var(--wk-pass); }
.wk-mini .wk-frac { width: auto; flex: 1.1; }
.wk-mini .wk-frac__pill { height: 46px; }
.wk-mini .wk-frac__inner { font-size: 14px; padding: 5px 9px; gap: 5px; }
.wk-mini .wk-frac__dot { width: 9px; height: 9px; }
.wk-mini .wk-frac.is-pass .wk-frac__inner { color: var(--wk-pass); }
.wk-mini__cap { display: block; position: relative; z-index: 1; margin-top: 8px; font-size: 12px; color: #d6d6d6; letter-spacing: .02em; text-shadow: 0 1px 6px rgba(0,0,0,.9); }

.project-card.wk-scrolling::before {
  background-size: 100% 100%, 100% auto;
  background-position: 0 0, center top;
  transition: opacity .3s ease, visibility .3s ease, background-position 9s linear;
}
.project-card.wk-scrolling:hover::before { background-position: 0 0, center bottom; }
/* show the top of the site, dimmed, before hover; the template's :hover rule takes it to full */
.project-card.wk-scrolling::before { opacity: .45; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  .wk-psi__spin { animation: none; }
  .project-card.wk-scrolling::before { transition: opacity .3s ease, visibility .3s ease; }
}

/* ---------- Load filmstrip ---------- */
.wk-film__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.wk-film__tabs { display: inline-flex; gap: 6px; }
.wk-film__tabs button {
  border: 1px solid var(--color-border-1, #d9d9d9); background: transparent; color: inherit;
  border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.wk-film__tabs button[aria-selected="true"] { background: #111; color: #fff; border-color: #111; }
.active-body .wk-film__tabs button[aria-selected="true"] { background: #fff; color: #111; border-color: #fff; }
.wk-film__strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.wk-film__strip.is-desktop { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wk-film__frame { margin: 0; opacity: 0; transform: translateY(10px); transition: opacity .35s ease, transform .35s ease; transition-delay: calc(var(--i) * 110ms); }
.wk-film__strip.is-in .wk-film__frame { opacity: 1; transform: none; }
.wk-film__frame img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); background: #fff; }
.wk-film__frame figcaption { text-align: center; font-size: 12px; opacity: .6; margin-top: 6px; }
@media (max-width: 767px) {
  .wk-film__strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wk-film__strip.is-desktop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- "Built light" stat tiles + structured data ---------- */
.wk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 40px; }
.wk-stat { border: 1px solid var(--color-border-1, #e3e3e3); border-radius: 20px; padding: 24px; }
.wk-stat b { display: block; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; margin-bottom: 8px; }
.wk-stat p { margin: 0; font-size: 15px; line-height: 1.55; opacity: .8; }
@media (max-width: 767px) { .wk-stats { grid-template-columns: 1fr; } }
.wk-schema { border: 1px solid var(--color-border-1, #e3e3e3); border-radius: 20px; padding: 26px; }
.wk-schema ul { list-style: none; padding: 0; margin: 16px 0 22px; display: grid; gap: 12px; }
.wk-schema li { display: grid; grid-template-columns: 26px 1fr; align-items: start; font-size: 15.5px; line-height: 1.55; }
.wk-schema li::before { content: ""; width: 16px; height: 16px; margin-top: 4px; border-radius: 50%; background: #0c6 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center/12px no-repeat; }
.wk-schema code { font-size: 14px; padding: 1px 6px; border-radius: 6px; background: rgba(69,208,189,.14); color: inherit; }

/* ---------- Guided tour wrapper ---------- */
.wk-tour .ixw-view { aspect-ratio: 16 / 11; }

/* ---------- Work gallery ---------- */
.wk-gal__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 26px; }
.wk-gal__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-gal__chips button {
  border: 1px solid var(--color-border-1, #d9d9d9); background: transparent; color: inherit;
  border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.wk-gal__chips button[aria-pressed="true"] { background: #111; color: #fff; border-color: #111; }
.active-body .wk-gal__chips button[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; }
.wk-gal__search {
  border: 1px solid var(--color-border-1, #d9d9d9); border-radius: 999px; padding: 10px 18px; min-width: 240px;
  background: transparent; color: inherit; font-size: 15px;
}
.wk-gal__count { font-size: 14px; opacity: .65; margin-bottom: 14px; }
.wk-gal__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.wk-gal__item { border: 1px solid var(--color-border-1, #e3e3e3); border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease; }
.wk-gal__item:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(0,0,0,.12); }
.wk-gal__shot { aspect-ratio: 4 / 3; overflow: hidden; background: #f2f2f2; }
.wk-gal__shot img { display: block; width: 100%; height: auto; transition: transform 6s linear; }
.wk-gal__item:hover .wk-gal__shot img { transform: translateY(calc(-100% + 100px)); }
.wk-gal__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.wk-gal__body h3 { font-size: 22px; margin: 0; }
.wk-gal__body p { margin: 0; font-size: 15px; line-height: 1.55; opacity: .85; }
.wk-gal__tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.wk-gal__tags li { font-size: 12px; border: 1px solid #45d0bd; border-radius: 999px; padding: 2px 10px; }
.wk-gal__links { margin-top: auto; padding-top: 6px; display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; font-size: 15px; }
.wk-gal__links a { text-decoration: underline; text-underline-offset: 4px; }
.wk-gal__score { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.wk-gal__score i { width: 10px; height: 10px; border-radius: 50%; background: #0c6; }
.wk-gal__empty { padding: 40px 0; text-align: center; opacity: .7; }
@media (prefers-reduced-motion: reduce) {
  .wk-film__frame { transition: none; }
  .wk-gal__shot img { transition: none; }
}

/* ---------- Homepage card extras (opt in with .wk-fx on the section) ---------- */
.wk-fx .project-card { --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; will-change: transform; }
/* 3D tilt toward the cursor (replaces the template's flat scale on hover) */
.wk-fx .project-card:hover,
.wk-fx .project-card:focus-within {
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry)) scale(1.04);
  border-color: transparent;
  transition: transform .12s ease-out, border-color .3s;
}
/* light that follows the cursor across the card */
.wk-fx .project-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(69, 208, 189, .22), transparent 55%);
  opacity: 0; transition: opacity .3s;
}
.wk-fx .project-card:hover::after { opacity: 1; }
/* keyboard users get the same reveal as mouse users */
.wk-fx .project-card:focus-within::before { opacity: 1; visibility: visible; }
.wk-fx .project-card:focus-within .projec-content { transform: translateY(0); }
.wk-fx .project-card .empty { z-index: 2; }
/* keep the industry pill readable over the screenshot */
.wk-fx .project-card .empty > span { background: rgba(16, 16, 16, .55); border-radius: 50px; }
/* mini browser bar with the site's address, shown on hover */
.wk-cardbar {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 26px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: rgba(241, 243, 244, .94); color: #444; font: 11px/1 system-ui, sans-serif;
  border-radius: 25px 25px 0 0; transform: translateY(-100%); opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.wk-cardbar i { width: 8px; height: 8px; border-radius: 50%; background: #ff5f57; flex: none; }
.wk-cardbar i:nth-child(2) { background: #febc2e; } .wk-cardbar i:nth-child(3) { background: #28c840; }
.wk-cardbar b { font-weight: 500; margin: 0 auto; padding-right: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-fx .project-card:hover .wk-cardbar, .wk-fx .project-card:focus-within .wk-cardbar { transform: none; opacity: 1; }
@media (hover: none) {
  .wk-cardbar { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .wk-fx .project-card:hover, .wk-fx .project-card:focus-within { transform: none; }
}

/* before/after with real screenshots */
.wk-ba picture,.wk-ba img{display:block;width:100%;height:100%}
.wk-ba img{object-fit:cover;object-position:top center}

/* filmstrip timings */
.wk-film__frame figcaption { font-variant-numeric: tabular-nums; }
.wk-film__frame.is-pre img { opacity: .55; }
.wk-film__frame.is-pre figcaption { opacity: .45; }
.wk-film__note { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; font-size: 14px; }
.wk-film__note i { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #0c6; }
.wk-film__note b { margin: 0; padding: 0; display: inline; font-weight: 700; }
