/* Reel My Property — base styles and shared components (website + studio).
   Built on assets/tokens.css. Page-specific layout lives in site/site.css and studio/studio.css. */

/* ---------- Fonts (self-hosted, open license) ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
/* Georgia squeezed to Instrument Serif's proportions, so headlines barely move when the font arrives */
@font-face {
  font-family: "Instrument Serif Fallback";
  src: local("Georgia");
  size-adjust: 84%;
  ascent-override: 96%;
  descent-override: 28%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--t-body) / 1.6 var(--font-sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--cf-300); color: var(--ink); }

/* Any element carrying a theme paints its own surface */
[data-theme] { background-color: var(--bg); color: var(--fg); }

/* ---------- Type ---------- */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); line-height: 1; }
h2 { font-size: var(--t-h2); line-height: 1.02; }
h3 { font-size: var(--t-h3); line-height: 1.1; }
h4 { font: 600 1.0625rem / 1.35 var(--font-sans); letter-spacing: -0.006em; }
.t-hero { font-size: var(--t-hero); line-height: 0.95; letter-spacing: -0.02em; }
.t-h1 { font-size: var(--t-h1); line-height: 1; }
.t-h2 { font-size: var(--t-h2); line-height: 1.02; }
.t-h3 { font-size: var(--t-h3); line-height: 1.1; }
p { text-wrap: pretty; }
.lead { font-size: var(--t-lead); line-height: 1.55; color: var(--fg-2); max-width: 36em; }
.small { font-size: var(--t-small); line-height: 1.5; }
.muted { color: var(--fg-3); }
.soft { color: var(--fg-2); }
.num { font-variant-numeric: tabular-nums; }

/* Small uppercase label with the cornflower dot */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  font: 500 var(--t-micro) / 1 var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.eyebrow::before {
  content: "";
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.eyebrow--plain::before { content: none; }

a:not([class]) {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:not([class]):hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.wrap--wide { width: min(100% - 2 * var(--gutter), var(--wrap-wide)); margin-inline: auto; }
.section { padding-block: var(--section); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Icons ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--solid { fill: currentColor; stroke: none; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: 400 1.5rem / 1 var(--font-display);
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.brand i { font-style: italic; }
.brand__mark { width: 1.5rem; height: 1.5rem; flex: none; }
.brand__mark circle { fill: var(--accent); }
.brand__mark path { fill: var(--on-accent); }

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: var(--btn-h);
  padding: 0 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font: 500 0.9375rem / 1 var(--font-sans);
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--d-1) ease, border-color var(--d-1) ease, color var(--d-1) ease, transform var(--d-2) var(--ease-out);
}
.btn .icon { width: 1.15em; height: 1.15em; transition: transform var(--d-2) var(--ease-out); }
.btn:hover .icon--nudge { transform: translateX(3px); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active { background: var(--accent-press); }
.btn--ink { background: var(--fg); color: var(--bg); }
.btn--ink:hover { background: color-mix(in srgb, var(--fg) 84%, var(--bg)); }
.btn--ghost { border-color: var(--line-2); color: var(--fg); }
.btn--ghost:hover { border-color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.btn--quiet {
  min-height: 2.75rem;
  padding-inline: 0.25rem;
  border-radius: var(--r-control);
  color: var(--fg);
}
.btn--quiet > span {
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 0.2em;
  transition: background-size var(--d-2) var(--ease-out);
}
.btn--quiet:hover > span { background-size: 0 1px; background-position: 100% 100%; }
.btn--sm { --btn-h: 2.5rem; padding-inline: 1.05rem; font-size: 0.875rem; }
.btn--lg { --btn-h: 3.5rem; padding-inline: 1.75rem; font-size: 1rem; }
.btn--block { width: 100%; }
.btn--icon { width: var(--btn-h); padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn[disabled]:active, .btn[aria-disabled="true"]:active { transform: none; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--on-accent);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn--ink.is-busy::after { border-color: var(--bg); border-right-color: transparent; }
.btn--ghost.is-busy::after { border-color: var(--fg); border-right-color: transparent; }

/* ---------- Fields ---------- */
.field { display: grid; gap: 0.4rem; }
.field__label { font: 500 var(--t-small) / 1.35 var(--font-sans); }
.field__label small { font-weight: 400; color: var(--fg-3); font-size: inherit; }
.field__hint { font-size: var(--t-small); line-height: 1.45; color: var(--fg-3); }
.field__error { font-size: var(--t-small); line-height: 1.45; color: var(--bad); }
.input, .select, .textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--fg);
  transition: border-color var(--d-1) ease, box-shadow var(--d-1) ease;
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--fg-3); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 24%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.textarea { min-height: 6.5rem; line-height: 1.5; resize: vertical; }
.select {
  appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a6a72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1.1rem;
}
.check { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: var(--t-small); }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--cf-700); }

/* Segmented control: a radio group, or buttons with aria-pressed */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--well);
}
.segmented > label, .segmented > button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: var(--r-pill);
  font: 500 var(--t-small) / 1 var(--font-sans);
  color: var(--fg-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--d-1) ease, color var(--d-1) ease, box-shadow var(--d-1) ease;
}
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented > label:hover, .segmented > button:hover { color: var(--fg); }
.segmented > label:has(input:checked), .segmented > button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 2px rgb(15 15 18 / 0.14);
}
.segmented > label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Cards, chips, badges ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s-5);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.875rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  font: 500 var(--t-micro) / 1 var(--font-sans);
  letter-spacing: 0.02em;
  color: var(--fg-2);
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.625rem;
  padding: 0 0.65rem;
  border-radius: var(--r-pill);
  background: var(--well);
  color: var(--fg-2);
  font: 500 var(--t-micro) / 1 var(--font-sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge--live { background: var(--cf-100); color: var(--cf-800); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }

/* Inline notes: quiet information, warnings and errors */
.note {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--r-control);
  background: var(--well);
  color: var(--fg-2);
  font-size: var(--t-small);
  line-height: 1.5;
}
.note .icon { margin-top: 0.1em; }
.note--info { background: var(--cf-100); color: var(--cf-900); }
.note--ok { background: var(--ok-bg); color: var(--ok); }
.note--warn { background: var(--warn-bg); color: var(--warn); }
.note--bad { background: var(--bad-bg); color: var(--bad); }
.note a { color: inherit; font-weight: 500; }

/* ---------- Progress and loading ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--well); overflow: hidden; }
.progress > i {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--d-2) ease;
}
.spinner {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* ---------- Print and camera marks ----------
   Crop marks just outside the corners of a frame. Set --mark-gap / --mark-len to tune. */
.marks { position: relative; }
.marks::after {
  --g: var(--mark-gap, 10px);
  --l: var(--mark-len, 14px);
  --o: calc(var(--g) + var(--l));
  content: "";
  position: absolute;
  inset: calc(var(--o) * -1);
  pointer-events: none;
  color: var(--mark-color, var(--fg));
  opacity: var(--mark-opacity, 0.55);
  background:
    linear-gradient(currentColor, currentColor) left 0 top var(--o) / var(--l) 1px no-repeat,
    linear-gradient(currentColor, currentColor) left var(--o) top 0 / 1px var(--l) no-repeat,
    linear-gradient(currentColor, currentColor) right 0 top var(--o) / var(--l) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right var(--o) top 0 / 1px var(--l) no-repeat,
    linear-gradient(currentColor, currentColor) left 0 bottom var(--o) / var(--l) 1px no-repeat,
    linear-gradient(currentColor, currentColor) left var(--o) bottom 0 / 1px var(--l) no-repeat,
    linear-gradient(currentColor, currentColor) right 0 bottom var(--o) / var(--l) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right var(--o) bottom 0 / 1px var(--l) no-repeat;
}

/* ---------- Dialogs ---------- */
dialog {
  padding: 0;
  border: 0;
  max-width: none;
  max-height: none;
  background: transparent;
  color: var(--fg);
}
.dialog {
  position: fixed;
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border-radius: var(--r-sheet);
  background: var(--bg);
  box-shadow: var(--shadow-2);
}
.dialog--wide { width: min(46rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(15 15 18 / 0.62); backdrop-filter: blur(6px); }
.dialog__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  color: var(--fg);
  transition: background-color var(--d-1) ease;
}
.dialog__close:hover { background: color-mix(in srgb, var(--fg) 14%, transparent); }
.dialog__title { font-size: var(--t-h3); line-height: 1.1; padding-right: 3rem; }
body:has(dialog[open]) { overflow: hidden; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  inset: auto 0 1.25rem 0;
  z-index: var(--z-toast);
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding-inline: 1rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(34rem, 100%);
  padding: 0.8rem 1.05rem;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-1);
  font-size: var(--t-small);
  line-height: 1.45;
}
.toast .icon { color: var(--cf-300); }
.toast--bad .icon { color: #ffb4ab; }
.toast button { color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: rise-in var(--d-3) var(--ease-out); }
  .dialog[open]::backdrop { animation: fade-in var(--d-2) ease; }
  .toast { animation: rise-in var(--d-3) var(--ease-out); }

  /* The homepage and the studio cross-fade into each other where the browser supports it */
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.32s; }
}

/* Motion off: the system setting, or the site's own "pause motion" control */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
