/* ==========================================================================
   VENRO kit — shared by the studio site and every concept app.
   Fonts, shutter transition, toasts, construction mode, concept pill, grain.
   ========================================================================== */

/* ---------- Fonts (all vendored, OFL — see /assets/fonts) ---------- */
@font-face { font-family: 'Geist'; src: url('../fonts/Geist-Latin.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../fonts/GeistMono-Latin.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../fonts/InstrumentSerif-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../fonts/InstrumentSerif-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('../fonts/Archivo-Var.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('../fonts/Bricolage-Var.woff2') format('woff2'); font-weight: 200 800; font-stretch: 75% 100%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('../fonts/PlusJakarta-Var.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  /* Tempo — 120 BPM. Every duration in the system is a multiple of a sixteenth. */
  --beat: 500ms;
  --eighth: 250ms;
  --sixteenth: 125ms;
  --bar: 2000ms;

  /* Easing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);          /* brand: sharp expo-out */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-ui: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.32, 0.64, 1); /* replaced at runtime by a real spring via linear() */
  --dur-spring: 560ms;
  --ease-spring-soft: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-spring-soft: 480ms;

  --kit-ink: #0A0A0A;
  --kit-paper: #F5F5F3;
}

/* ---------- Accessibility utilities ---------- */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 10001;
  padding: 10px 16px; border-radius: 999px;
  background: var(--kit-ink); color: var(--kit-paper);
  font: 500 14px/1 'Geist', system-ui, sans-serif; text-decoration: none;
  transform: translateY(-160%); transition: transform 200ms var(--ease-ui);
}
.skip-link:focus-visible { transform: none; outline: 2px solid var(--kit-paper); outline-offset: 2px; }

/* ---------- Letterbox shutter (page transitions) ---------- */
.shutter { position: fixed; inset: 0; z-index: 10000; pointer-events: none; }
.shutter.is-active { pointer-events: auto; }
.shutter-bar {
  position: absolute; left: 0; right: 0; height: 50.5vh; height: 50.5dvh;
  background: #0A0A0A; transform: translateY(-101%); will-change: transform;
}
.shutter-bar.is-top { top: 0; }
.shutter-bar.is-bottom { bottom: 0; transform: translateY(101%); }
html.shutter-in .shutter-bar { transform: none; }
/* Parked just off screen between transitions, so hidden too: while a phone's toolbar slides away the
   screen grows before the page does, and the bottom bar showed through as a black band. */
html:not(.shutter-in) .shutter:not(.is-active) .shutter-bar { visibility: hidden; }

/* ---------- Toasts ---------- */
.v-toasts {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 9500;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.v-toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  min-height: 44px; padding: 6px 6px 6px 18px; border-radius: 999px;
  background: var(--toast-bg, rgba(16, 16, 16, 0.88)); color: var(--toast-fg, #F5F5F3);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  font: 500 14px/1.3 var(--toast-font, 'Geist', system-ui, sans-serif);
  transition: transform var(--dur-spring) var(--ease-spring), opacity 250ms var(--ease-ui);
}
.v-toast:not(:has(button)) { padding-right: 18px; }
.v-toast[data-state="enter"] { transform: translateY(18px) scale(0.94); opacity: 0; }
.v-toast[data-state="exit"] { transform: translateY(10px) scale(0.97); opacity: 0; transition-duration: 200ms; transition-timing-function: var(--ease-ui); }
.v-toast button {
  appearance: none; border: 0; cursor: pointer;
  min-height: 32px; padding: 0 14px; border-radius: 999px;
  background: var(--toast-action-bg, rgba(255, 255, 255, 0.14)); color: inherit;
  font: inherit; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  transition: transform 140ms var(--ease-ui), background-color 150ms ease;
}
.v-toast button:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .v-toast button:hover { background: var(--toast-action-hover, rgba(255, 255, 255, 0.22)); } }

/* ---------- Construction mode ("see how it's built") ---------- */
.construct-grid {
  position: fixed; inset: 0; z-index: 9400; pointer-events: none; display: none;
  padding-inline: var(--construct-margin, clamp(16px, 4vw, 72px));
  grid-template-columns: repeat(var(--construct-cols, 12), minmax(0, 1fr));
  column-gap: var(--construct-gutter, 24px);
  mix-blend-mode: difference;
}
html.construct .construct-grid { display: grid; animation: construct-in var(--eighth) var(--ease) both; }
.construct-grid i { background: rgba(255, 255, 255, 0.06); box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.22), inset -1px 0 0 rgba(255, 255, 255, 0.22); }
.construct-baseline {
  position: fixed; inset: 0; z-index: 9399; pointer-events: none; display: none;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 100% 8px; mix-blend-mode: difference;
}
html.construct .construct-baseline { display: block; }
@keyframes construct-in { from { opacity: 0; } to { opacity: 1; } }

.inspector { position: fixed; inset: 0; z-index: 9450; pointer-events: none; display: none; }
html.construct .inspector { display: block; }
.inspector-box, .inspector-pad { position: absolute; left: 0; top: 0; mix-blend-mode: difference; }
.inspector-box { box-shadow: 0 0 0 1px #fff; transition: transform 90ms var(--ease-ui), width 90ms var(--ease-ui), height 90ms var(--ease-ui); }
.inspector-pad { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px 5px); }
.inspector-badge {
  position: absolute; left: 0; top: 0;
  padding: 5px 8px; border-radius: 6px;
  background: #0A0A0A; color: #F5F5F3; box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.35);
  font: 500 11px/1.2 'Geist Mono', ui-monospace, monospace; white-space: nowrap; letter-spacing: 0.01em;
}
.inspector-badge b { font-weight: 600; }
.inspector-badge span { opacity: 0.6; }
.inspector-hint {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 9460; display: none; align-items: center; gap: 10px;
  padding: 8px 8px 8px 16px; border-radius: 999px;
  background: #0A0A0A; color: #F5F5F3; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 0 0 0.5px rgba(255, 255, 255, 0.2);
  font: 500 13px/1 'Geist', system-ui, sans-serif;
}
html.construct .inspector-hint { display: inline-flex; animation: hint-in var(--beat) var(--ease) both; }
.inspector-hint kbd {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.12); font: 600 12px/1 'Geist Mono', monospace;
}
.inspector-hint button { appearance: none; border: 0; cursor: pointer; padding: 0 12px; height: 28px; border-radius: 999px; background: #F5F5F3; color: #0A0A0A; font: 600 12px/1 'Geist', sans-serif; }
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Concept pill (apps opened on their own) ---------- */
.concept-pill {
  position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 9300;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 16px 6px 6px; border-radius: 999px;
  background: rgba(10, 10, 10, 0.84); color: #F5F5F3; text-decoration: none;
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16);
  font: 500 13px/1.1 'Geist', system-ui, sans-serif;
  transition: transform 160ms var(--ease-ui);
}
.concept-pill:active { transform: scale(0.97); }
/* Tucks away while you read (scrolling down) and returns on the way up, like Safari's toolbar */
.concept-pill { transition: transform var(--dur-spring-soft) var(--ease-spring-soft), opacity 250ms ease; }
.concept-pill.is-tucked { transform: translateY(calc(100% + 28px)); opacity: 0; pointer-events: none; transition: transform 500ms var(--ease), opacity 250ms ease; }
@media (max-width: 699px) {
  .concept-pill { padding: 6px; }
  .concept-pill .concept-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* Concepts that fill the window show only the mark; the label opens on hover or keyboard focus */
@media (min-width: 700px) {
  .concept-pill .concept-label { max-width: 240px; overflow: hidden; white-space: nowrap; transition: max-width 400ms var(--ease), opacity 250ms ease; }
  .concept-pill.is-compact { transition: transform var(--dur-spring-soft) var(--ease-spring-soft), opacity 250ms ease, padding 400ms var(--ease), gap 400ms var(--ease); }
  .concept-pill.is-compact:not(:hover):not(:focus-visible) { padding-right: 6px; gap: 0; }
  .concept-pill.is-compact:not(:hover):not(:focus-visible) .concept-label { max-width: 0; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .concept-pill.is-tucked { transform: none; transition: opacity 200ms ease; } }
.concept-pill:focus-visible { outline: 2px solid #F5F5F3; outline-offset: 3px; }
.concept-pill .concept-mark { width: 32px; height: 32px; border-radius: 50%; background: #F5F5F3; display: grid; place-items: center; flex: none; }
.concept-pill .concept-mark svg { width: 18px; height: 18px; }
.concept-pill small { display: block; font-size: 11px; opacity: 0.6; font-weight: 400; margin-top: 2px; }
html.in-frame .concept-pill { display: none; }

/* ---------- Film grain ---------- */
.grain {
  position: fixed; inset: -120px; z-index: 9200; pointer-events: none;
  opacity: var(--grain-opacity, 0.04); background-size: 180px 180px;
  animation: none;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); } 17% { transform: translate(-36px, 24px); } 33% { transform: translate(28px, -40px); }
  50% { transform: translate(-18px, 44px); } 67% { transform: translate(40px, 12px); } 83% { transform: translate(-44px, -24px); } 100% { transform: translate(0, 0); }
}

/* ---------- Reduced motion & transparency ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .v-toast { transition: opacity 200ms ease; }
  .v-toast[data-state] { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .v-toast, .concept-pill { -webkit-backdrop-filter: none; backdrop-filter: none; background: #141414; }
}
