/* The one header and footer, shared by both sides of the site: the professional
   pages (/, /labs/, /agencies/, /startups/) and the studio (/studio, writing,
   dialogues, about). Both sides load this file, so the frame cannot drift.
   Colours come from whichever side's tokens are present: the studio's
   (--paper, --ink, ...) first, then the professional site's (--bg, --text, ...). */
.sg-head, .sg-foot {
  --sg-bg: var(--paper, var(--bg, #f8f7f3));
  --sg-surface: var(--paper-soft, var(--surface, #eeede7));
  --sg-text: var(--ink, var(--text, #141413));
  --sg-text-2: var(--ink-soft, var(--text-2, #45443f));
  --sg-rule: var(--rule, #d6d5cd);
  --sg-accent: var(--accent, #1d3fc8);
  --sg-font: "Helvetica Neue", Helvetica, Arial, "Inter", sans-serif;
  font-family: var(--sg-font);
  line-height: 1.4;
  color: var(--sg-text);
}

/* ---------- header ---------- */
.sg-head {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--sg-bg) 94%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--sg-rule);
}
.sg-row {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px 24px;
}
@media (min-width: 720px) { .sg-row { padding: 14px 32px; } }
.sg-mark {
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--sg-text); text-decoration: none; white-space: nowrap; margin-right: auto;
}
.sg-mark:hover { text-decoration: underline; text-underline-offset: 0.18em; }

.sg-nav { display: flex; align-items: center; gap: 4px 20px; }
.sg-menu { position: relative; }
.sg-btn, .sg-email {
  font: inherit; font-size: 14px; color: var(--sg-text-2); background: none; border: 0;
  padding: 8px 2px; margin: 0; cursor: pointer; text-decoration: none; line-height: 1.2;
  border-bottom: 2px solid transparent;
}
.sg-btn::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 7px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease;
}
.sg-btn[aria-expanded="true"]::after { transform: rotate(-135deg); margin-bottom: -1px; }
.sg-btn:hover, .sg-email:hover, .sg-btn[aria-expanded="true"] { color: var(--sg-text); }
.sg-btn[aria-current="true"] { color: var(--sg-text); font-weight: 600; border-bottom-color: var(--sg-accent); }
.sg-btn:focus-visible, .sg-email:focus-visible, .sg-burger:focus-visible, .sg-panel a:focus-visible {
  outline: 2px solid var(--sg-accent); outline-offset: 2px;
}

.sg-panel {
  display: none; position: absolute; top: calc(100% + 10px); right: -18px;
  min-width: 300px; max-width: 360px; padding: 14px 0 10px;
  background: var(--sg-bg); border: 1px solid var(--sg-rule);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
.sg-btn[aria-expanded="true"] + .sg-panel { display: block; }
.sg-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* keeps hover alive across the gap */
.sg-q {
  margin: 0 18px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sg-text-2);
}
.sg-panel ul { list-style: none; margin: 0; padding: 0; }
.sg-panel a {
  display: block; padding: 8px 18px; color: var(--sg-text); text-decoration: none; font-size: 15px;
  border-left: 2px solid transparent;
}
.sg-panel a:hover { background: var(--sg-surface); }
.sg-panel a[aria-current="page"] { border-left-color: var(--sg-accent); font-weight: 600; }
.sg-panel a span { display: block; font-size: 13px; color: var(--sg-text-2); margin-top: 2px; font-weight: 400; }
.sg-panel .sg-sep { border-top: 1px solid var(--sg-rule); margin-top: 8px; padding-top: 8px; }
.sg-panel .sg-sub a { padding-left: 32px; font-size: 14px; }
.sg-panel .sg-sublabel { display: block; padding: 10px 18px 2px; font-size: 13px; color: var(--sg-text-2); }

/* Short / Full: same control on every page that has both views. */
.sg-toggle { display: inline-flex; border: 1px solid var(--sg-text); flex: none; }
.sg-toggle button {
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  min-height: 34px; padding: 6px 12px; margin: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--sg-text-2); cursor: pointer;
}
.sg-toggle button + button { border-left: 1px solid var(--sg-text); }
.sg-toggle button:hover { color: var(--sg-text); background: var(--sg-surface); }
.sg-toggle button[aria-pressed="true"] { background: var(--sg-text); color: var(--sg-bg); }
.sg-toggle button:focus-visible { outline: 2px solid var(--sg-accent); outline-offset: 2px; position: relative; }
html:not([data-view]) .sg-toggle { display: none; }
html[data-view="short"] .x { display: none !important; }
html[data-view="full"] .s, html[data-view="full"] .to-full { display: none !important; }

.sg-burger {
  display: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--sg-text);
  background: none; border: 1px solid var(--sg-rule); padding: 7px 12px; min-height: 34px; cursor: pointer;
}

/* Phones: name, Short/Full, Menu. Menu opens both groups, stacked. */
@media (max-width: 759px) {
  .sg-row { flex-wrap: wrap; }
  .sg-burger { display: inline-block; order: 3; }
  .sg-toggle { order: 2; }
  .sg-nav {
    display: none; order: 4; flex-basis: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    border-top: 1px solid var(--sg-rule); margin-top: 4px; padding: 4px 0 8px;
    max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .sg-head[data-open] .sg-nav { display: flex; }
  .sg-btn { display: none; }
  .sg-panel {
    display: block; position: static; min-width: 0; max-width: none;
    border: 0; box-shadow: none; background: none; padding: 12px 0 4px;
  }
  .sg-panel .sg-q { margin-left: 0; }
  .sg-panel a { padding-left: 0; padding-right: 0; border-left: 0; }
  .sg-panel a[aria-current="page"] { color: var(--sg-accent); }
  .sg-panel .sg-sub a { padding-left: 14px; }
  .sg-panel .sg-sublabel { padding-left: 0; }
  .sg-panel .sg-q.sg-hide-wide { display: block; }
  .sg-email { padding: 12px 0 4px; font-size: 15px; color: var(--sg-text); }
  #sg-work .sg-sep { display: none; } /* listed once on phones, under Studio */
}
@media (min-width: 760px) { .sg-hide-wide { display: none; } }

/* ---------- footer ---------- */
.sg-foot { border-top: 1px solid var(--sg-rule); background: var(--sg-bg); color: var(--sg-text-2); }
.sg-foot-row {
  max-width: 1200px; margin: 0 auto; padding: 32px 16px 48px;
  display: grid; gap: 28px 32px; grid-template-columns: 1fr;
}
@media (min-width: 560px) { .sg-foot-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .sg-foot-row { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; padding: 40px 32px 56px; } }
.sg-foot h2 {
  margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sg-text-2); font-family: var(--sg-font);
}
.sg-foot ul { list-style: none; margin: 0; padding: 0; }
.sg-foot li { margin: 0 0 6px; font-size: 14px; }
.sg-foot a { color: var(--sg-text); text-decoration: none; }
.sg-foot a:hover { color: var(--sg-accent); text-decoration: underline; text-underline-offset: 0.18em; }
.sg-foot .sg-where { margin: 0; font-size: 13px; align-self: end; }

@media (prefers-reduced-motion: reduce) { .sg-btn::after { transition: none; } }

/* ---------- collapsible sections ("more, if you want it") ----------
   The deeper sections sit near the bottom of a page as closed rows: a label
   and a headline. Click to open in place. Shared by both sides. */
.folds, .fold {
  --f-rule: var(--rule, #d6d5cd);
  --f-strong: var(--ink, var(--text, #141413));
  --f-text-2: var(--ink-soft, var(--text-2, #45443f));
  --f-accent: var(--accent, #1d3fc8);
  --f-hover: var(--paper-soft, var(--surface, #eeede7));
}
.folds { border-top: 1px solid var(--f-rule); }
.fold { border-bottom: 1px solid var(--f-rule); scroll-margin-top: 72px; }
.fold > summary { list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--f-hover); }
.fold > summary:focus-visible { outline: 2px solid var(--f-accent); outline-offset: -2px; }
.fold-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: center; padding-top: 22px; padding-bottom: 22px; }
.fold-label { grid-column: 1; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--f-text-2); }
.fold-h { grid-column: 1; font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; color: var(--f-strong); }
.fold-ic { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; position: relative; }
.fold-ic::before, .fold-ic::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--f-strong); transition: transform .15s ease; }
.fold-ic::after { transform: rotate(90deg); }
.fold[open] .fold-ic::after { transform: rotate(0deg); }
@media (min-width: 900px) {
  .fold-row { grid-template-columns: 1fr 2fr auto; gap: 32px; }
  .fold-label { grid-column: 1; }
  .fold-h { grid-column: 2; }
  .fold-ic { grid-column: 3; grid-row: 1; }
}
/* inside an open row: the headline is already in the summary */
.fold > .fold-body { padding-top: 8px; border-top: 0; background: none; }
.fold > .fold-body .section-head .label,
.fold > .fold-body .section-head h2 { display: none; }
.fold > .fold-body .section-head > div { border-top: 0; padding-top: 0; }
.fold > .fold-body .section-head { margin-bottom: 24px; }
.fold > .fold-body .section-head:not(:has(p:not(.label))) { display: none; }
@media (prefers-reduced-motion: reduce) { .fold-ic::before, .fold-ic::after { transition: none; } }

/* tap targets: footer and links inside open rows get at least 24px on phones */
@media (max-width: 759px) { .sg-foot a, .fold-body .links a, .fold-body .more-links a, .fold-body td.go a { display: inline-block; padding: 6px 0; } }
