/* Design values. See DESIGN.md for roles.
   Each project owns one color (palette.json): key/on for its circle and accents,
   deep for its illustration. They are set inline where a project is shown. */
:root {
  --ground: #E6E8EB;
  --surface: #F3F4F6;
  --ink: #1B1F24;
  --ink-soft: #4A515B;
  --ring: #C3C8CF;
  --line: #CDD1D7;
  --key: #1B1F24;
  --on: #FFFFFF;
  --font: 'Familjen Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --r-sm: 6px;
  --r-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1.0625rem/1.55 var(--font); }
img, svg, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font); font-weight: 700; line-height: 1.04; letter-spacing: -.025em; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 8px; }

.wrap { width: min(1240px, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: var(--r-sm); z-index: 30; }
.skip:focus { left: 12px; }

/* Header and footer */
.announce { background: var(--ink); color: #fff; text-align: center; font-size: .9rem; font-weight: 500; padding: 8px 16px; }
.site-head { position: sticky; top: 0; z-index: 20; background: rgba(230, 232, 235, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-head-in { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.3rem/1 var(--font); text-decoration: none; letter-spacing: -.02em; }
.site-head nav, .site-foot nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { text-decoration: none; font-weight: 600; padding: 10px 14px; border-radius: var(--r-sm); }
nav a:hover, nav a[aria-current] { background: rgba(27, 31, 36, .07); }
.site-foot { margin-top: clamp(64px, 9vw, 112px); border-top: 1px solid var(--line); }
.site-foot-in { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding-block: 22px; }
.site-foot .brand { font-size: 1.1rem; }

.btn { display: inline-block; padding: 13px 26px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; transition: background .2s; }
.btn:hover { background: #3B424C; }

/* Tags and chips */
.tag-row, .info-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: .85rem; font-weight: 600; line-height: 1.3; }
.tag-field::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--key); }
.tag-local { background: #DCEFE5; color: #0B5A3B; }
.tag-local::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #17955F; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips li { padding: 4px 10px; border-radius: var(--r-sm); background: #fff; font-size: .92rem; font-weight: 500; }

/* ------------------------------------------------------------ Homepage: one screen */
.home { min-height: 100svh; display: flex; flex-direction: column; }
.home .site-head { position: static; background: transparent; backdrop-filter: none; border-bottom: 0; }

.home-main { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px 56px; align-items: center; padding-block: 8px 20px; }
.home-text h1 { font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.035em; max-width: 11ch; }
.home-sub { margin-top: 20px; font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.45; color: var(--ink-soft); max-width: 38ch; }
.home-text .btn { margin-top: 28px; }

.home-orbit { align-self: stretch; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; min-height: 0; }
.stage-box { container-type: size; min-height: 300px; display: grid; place-items: center; }
.stage { container-type: size; position: relative; width: 100cqmin; height: 100cqmin; --d: 27cqw; }
.stage::before { content: ""; position: absolute; inset: 16cqw; border: 1.5px solid var(--ring); border-radius: 50%; pointer-events: none; }
.stage-hint { position: absolute; left: 50%; top: 50%; width: 28cqw; transform: translate(-50%, -50%); text-align: center; font-size: clamp(12px, 1.9cqw, 15px); line-height: 1.35; color: var(--ink-soft); }

.orb {
  position: absolute; left: 0; top: 0; width: var(--d); height: var(--d); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35em; padding: 6%;
  background: var(--key); color: var(--on); text-align: center; text-decoration: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; will-change: transform;
  /* Ring position without JavaScript; juggle.js takes over with transforms. */
  transform: translate(calc(50cqw + 34cqw * cos(var(--a)) - var(--d) / 2), calc(50cqh + 34cqh * sin(var(--a)) - var(--d) / 2));
}
.orb.is-held { cursor: grabbing; z-index: 3; }
.orb:focus-visible { outline-offset: 4px; border-radius: 50%; }
.orb-field { font-weight: 700; font-size: clamp(13px, 3.2cqw, 23px); line-height: 1; letter-spacing: -.02em; }
.orb-name { font-size: clamp(11px, 1.75cqw, 14px); line-height: 1.15; font-weight: 500; }
.stage.has-open .orbs { opacity: .15; }
.stage.has-open .motion-btn { display: none; }

.focus {
  position: absolute; left: 7cqw; top: 7cqw; width: 86cqw; height: 86cqw; border-radius: 50%; z-index: 5;
  display: grid; place-items: center; background: var(--key); color: var(--on);
  transform-origin: center; transition: transform .38s cubic-bezier(.2, .8, .2, 1);
}
.focus[hidden] { display: none; }
.focus-in { width: 62%; text-align: center; display: grid; justify-items: center; gap: 10px; }
.focus-field { font-weight: 600; font-size: clamp(13px, 2.1cqw, 17px); }
.focus h2 { font-size: clamp(24px, 6cqw, 48px); line-height: 1; outline: none; }
.focus-line { font-size: clamp(14px, 2.5cqw, 19px); line-height: 1.4; max-width: 34ch; }
.focus-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.focus-tags span { padding: 3px 9px; border-radius: var(--r-sm); font-size: .82rem; font-weight: 600; background: rgba(0, 0, 0, .2); }
.focus-open { margin-top: 6px; padding: 12px 24px; border-radius: 999px; background: var(--on); color: var(--key); font-weight: 700; text-decoration: none; }
.focus-open:focus-visible, .focus-close:focus-visible { outline-color: var(--on); }
.focus-close { position: absolute; top: 12%; right: 12%; width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(0, 0, 0, .2); color: var(--on); }
.focus-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.motion-btn { position: absolute; right: 0; bottom: 0; z-index: 6; width: 44px; height: 44px; padding: 0; border: 1.5px solid var(--ring); border-radius: 50%;
  display: grid; place-items: center; background: var(--ground); color: var(--ink); cursor: pointer; }
.motion-btn svg { width: 14px; height: 14px; fill: currentColor; }
.motion-btn .i-play, .motion-btn[aria-pressed="true"] .i-pause { display: none; }
.motion-btn[aria-pressed="true"] .i-play { display: block; }
.motion-btn:hover { background: #fff; }
.motion-btn[hidden] { display: none; }

.consult-line { text-align: center; color: var(--ink-soft); font-size: 1rem; line-height: 1.45; max-width: 64ch; margin-inline: auto; }
.consult-line a { color: var(--ink); font-weight: 700; text-underline-offset: 3px; white-space: nowrap; }

/* Small stage (phones): square summary panel, names hidden in the circles */
@container (max-width: 400px) {
  .stage { --d: 31cqw; }
  .orb-name { display: none; }
  .orb { padding: 2px; }
  .orb-field { font-size: 12px; letter-spacing: -.03em; }
  .stage-hint { width: 30cqw; font-size: 12px; }
  .focus { left: 0; top: 0; width: 100cqw; height: 100cqw; border-radius: 28px; }
  .focus-in { width: 84%; gap: 8px; }
  .focus-close { top: 10px; right: 10px; }
}

/* Phones and portrait tablets: text on top, the orbit fills the rest of the screen */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .home-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: start; gap: 16px; padding-block: 4px 16px; }
  .home-text h1 { font-size: clamp(2rem, 9vw, 2.6rem); max-width: 14ch; }
  .home-sub { margin-top: 10px; font-size: 1rem; }
  .home-text .btn { margin-top: 14px; padding: 11px 22px; }
  .stage-box { min-height: 270px; }
  .consult-line { font-size: .95rem; }
}
@media (min-width: 761px) and (orientation: portrait) and (max-width: 1100px) {
  .home-main { padding-block: 24px 28px; gap: 24px; }
  .home-text h1 { font-size: clamp(2.6rem, 6.4vw, 4rem); max-width: 16ch; }
  .home-sub { font-size: 1.15rem; }
}
/* Short phones (iPhone SE size): tighten so everything fits one screen */
@media (max-width: 760px) and (max-height: 720px) {
  .home-text h1 { font-size: 1.85rem; }
  .home-sub { font-size: .95rem; margin-top: 8px; }
  .home-text .btn { margin-top: 10px; padding: 9px 20px; }
  .home-main { gap: 10px; }
  .stage-box { min-height: 250px; }
}

/* ------------------------------------------------------------ Shared inner-page sections */
.how { margin-top: clamp(48px, 7vw, 88px); }
.how > h2, .hard h2, .more h2, .c-why h2, .c-contact h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
.how-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; margin-top: 20px; counter-reset: step; }
.how-list li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-content: start; column-gap: 14px; padding: 18px 0 20px; border-top: 1px solid var(--line); }
.how-list li::before { content: ""; grid-row: 1 / span 2; justify-self: center; width: .8rem; height: .8rem; margin-top: .4rem; border-radius: 50%; background: var(--key); }
ol.how-list li { counter-increment: step; }
ol.how-list li::before { content: counter(step); width: 2rem; height: 2rem; margin-top: -.2rem; display: grid; place-items: center; color: var(--on); font-weight: 700; font-size: .95rem; }
.how-list strong { font: 700 1.15rem/1.3 var(--font); letter-spacing: -.01em; }
.how-list span { grid-column: 2; color: var(--ink-soft); margin-top: 4px; }
.how-list a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ Project page */
.project { padding-top: 20px; }
.back { display: inline-block; font-weight: 600; color: var(--ink-soft); text-underline-offset: 3px; }
.p-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 32px 64px; align-items: center; margin-top: 14px; }
.p-hero h1 { font-size: clamp(2.6rem, 6vw, 5rem); line-height: .98; letter-spacing: -.035em; margin: 16px 0 18px; }
.summary p { font-size: 1.2rem; line-height: 1.5; max-width: 52ch; }
.summary p + p { margin-top: 12px; font-size: 1.0625rem; color: var(--ink-soft); }
.summary a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.p-orb { width: min(100%, 480px); aspect-ratio: 1; justify-self: center; border-radius: 50%; background: var(--key); display: grid; place-items: center; }
.p-orb img { width: 74%; }
.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 30px 0 0; }
.numbers div { display: flex; flex-direction: column-reverse; justify-content: flex-end; border-top: 3px solid var(--key); padding-top: 10px; }
.numbers dd { margin: 0; font: 700 clamp(1.8rem, 3vw, 2.4rem)/1 var(--font); letter-spacing: -.02em; }
.numbers dt { margin-top: 6px; font-size: .92rem; line-height: 1.3; color: var(--ink-soft); }
.p-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 56px; margin-top: clamp(40px, 6vw, 72px); padding-top: 28px; border-top: 1px solid var(--line); }
.p-facts h2 { font-size: 1.3rem; margin-bottom: 8px; }
.p-facts p { max-width: 58ch; }
.hard { margin-top: clamp(40px, 6vw, 64px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px 48px; padding: clamp(24px, 4vw, 44px); border-radius: var(--r-lg); background: var(--surface); }
.hard p { font-size: 1.2rem; line-height: 1.5; max-width: 60ch; }
.more { margin-top: clamp(56px, 8vw, 96px); }
.more-orbs { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
.mini { width: 136px; height: 136px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px;
  background: var(--key); color: var(--on); text-align: center; text-decoration: none; transition: transform .2s; }
.mini:hover { transform: scale(1.05); }
.mini:focus-visible { border-radius: 50%; }
.mini b { font-size: 1.02rem; line-height: 1.05; letter-spacing: -.02em; }
.mini span { font-size: .78rem; line-height: 1.15; }

/* Real media on project pages (videos first, then screenshots) */
.gallery-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.gallery-media .media { margin: 0; }
.gallery-media .media-video { grid-column: 1 / -1; }
.gallery-media video, .gallery-media img { width: 100%; border-radius: var(--r-lg); background: var(--ink); }
.gallery-media img { aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface); }
.gallery-media figcaption { margin-top: 6px; font-size: .88rem; color: var(--ink-soft); }

/* ------------------------------------------------------------ Consulting page */
.consult-page { padding-top: clamp(28px, 5vw, 64px); }
.c-hero h1 { font-size: clamp(2.6rem, 6.4vw, 5.4rem); line-height: .98; letter-spacing: -.035em; max-width: 13ch; }
.c-lead { margin-top: 22px; font-size: 1.2rem; line-height: 1.5; color: var(--ink-soft); max-width: 58ch; }
.c-why { margin-top: clamp(48px, 7vw, 88px); }
.c-why ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 40px; margin-top: 22px; }
.c-why li { border-top: 3px solid var(--key); padding-top: 14px; }
.c-why h3 { font-size: 1.3rem; letter-spacing: -.015em; }
.c-why p { margin-top: 8px; color: var(--ink-soft); }
.c-more { margin-top: 18px; color: var(--ink-soft); }
.c-more a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.c-contact { margin-top: clamp(48px, 7vw, 88px); padding: clamp(28px, 5vw, 56px); border-radius: var(--r-lg); background: var(--ink); color: #fff; }
.c-contact p { margin-top: 12px; color: #D5D9DF; max-width: 52ch; }
.c-contact .contact-note { display: inline-block; margin-top: 22px; padding: 10px 18px; border: 1.5px dashed #8A929C; border-radius: var(--r-sm); color: #fff; font-weight: 600; }

/* ------------------------------------------------------------ Stack page */
.stack { padding-top: clamp(28px, 5vw, 64px); }
.stack-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px 48px; align-items: end; }
.stack-intro h1 { font-size: clamp(2.6rem, 6.4vw, 5.4rem); line-height: .98; letter-spacing: -.035em; }
.stack-intro p { font-size: 1.2rem; line-height: 1.5; max-width: 50ch; color: var(--ink-soft); }
.stack-side { margin-top: clamp(44px, 6vw, 72px); }
.stack-side h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
.stack-lead { margin-top: 8px; font-size: 1.1rem; max-width: 60ch; color: var(--ink-soft); }
.stack-rows { margin-top: 18px; padding: 0 clamp(18px, 3vw, 32px); border-radius: var(--r-lg); background: var(--surface); }
.stack-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px 32px; align-items: start; padding: 22px 0; }
.stack-row + .stack-row { border-top: 1px solid var(--line); }
.stack-row h3 { font-size: 1.2rem; letter-spacing: -.015em; }
.stack-row p { margin-top: 4px; font-size: .98rem; color: var(--ink-soft); }
.stack-row .chips { margin-top: 0; }
.used { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 !important; color: var(--ink) !important; }
.used span { width: 100%; font-size: .85rem; color: var(--ink-soft); }
.used a { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .95rem; text-underline-offset: 3px; }
.used a::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--key); }

/* ------------------------------------------------------------ Breakpoints */
@media (max-width: 980px) {
  .p-hero, .stack-intro, .hard { grid-template-columns: minmax(0, 1fr); }
  .stack-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stack-row > div { grid-column: 1 / -1; }
  .c-why ul { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  html { scroll-padding-top: 76px; }
  .site-head-in { min-height: 56px; }
  .site-head nav, .site-foot nav { gap: 2px; }
  nav a { padding: 10px 8px; font-size: .95rem; white-space: nowrap; }
  .how-list, .p-facts, .gallery-media, .stack-row { grid-template-columns: minmax(0, 1fr); }
  .numbers { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .numbers div { flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: 12px; }
  .numbers dt { margin-top: 0; }
  .p-orb { width: min(78vw, 340px); }
  .mini { width: 112px; height: 112px; }
  .mini b { font-size: .92rem; }
}
@media (max-width: 360px) {
  .brand img { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .focus, .mini { transition: none; }
}
