/*
 * Pros Cam: site.css — what every page shares.
 *
 *   1. Fonts and registered colours
 *   2. Tokens: the six themes (the same palettes as ios/ReadMe/Design/Theme.swift and Wordmark.swift)
 *   3. Base
 *   4. Wordmark
 *   5. Buttons and small parts
 *   6. Header and the theme dock
 *   7. Footer
 *   8. Legal and support pages
 *   9. Reduced motion
 *
 * Spacing is an 8-point grid (--u). Colours are tokens; nothing below the token block names a hex.
 */

/* 1. Fonts and registered colours ------------------------------------------------------------- */

/* Pacifico (SIL Open Font License, assets/pacifico-OFL.txt), cut down to the letters of "pros.cam" and "Pros Cam". */
@font-face {
  font-family: "Pacifico Mark";
  src: url("/assets/pacifico-wordmark.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* Registered, so a theme change glides instead of cutting. */
@property --bg { syntax: "<color>"; inherits: true; initial-value: #000000; }
@property --glow-a { syntax: "<color>"; inherits: true; initial-value: #4a4a4a; }
@property --glow-b { syntax: "<color>"; inherits: true; initial-value: #2e2e2e; }
@property --text { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --text-2 { syntax: "<color>"; inherits: true; initial-value: #bdbdbd; }
@property --text-3 { syntax: "<color>"; inherits: true; initial-value: #9e9e9e; }
@property --fill { syntax: "<color>"; inherits: true; initial-value: #222222; }
@property --hairline { syntax: "<color>"; inherits: true; initial-value: #383838; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --primary { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --on-primary { syntax: "<color>"; inherits: true; initial-value: #000000; }
@property --mark { syntax: "<color>"; inherits: true; initial-value: #f2dc6a; }

/* 2. Tokens ----------------------------------------------------------------------------------- */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mark: "Pacifico Mark", "Snell Roundhand", "Brush Script MT", cursive;
  --u: 8px;
  --gutter: clamp(24px, 5vw, 64px);
  --wrap: 1200px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --header: 72px;

  /* Black (the app's first theme, and this site's) */
  --bg: #000000;
  --glow-a: #4a4a4a;
  --glow-b: #2e2e2e;
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.74);
  --text-3: rgba(255, 255, 255, 0.62);
  --fill: rgba(255, 255, 255, 0.13);
  --hairline: rgba(255, 255, 255, 0.22);
  --accent: #ffffff;
  --primary: #ffffff;
  --on-primary: #000000;
  --mark: #f2dc6a;
  --cam: #ffffff;
  --shade: 0, 0, 0;
  --titanium-a: #2c2c30;
  --titanium-b: #8b8b92;
  --titanium-c: #1b1b1e;
  color-scheme: dark;

  /* Derived: glass as the app tints it, and the colours the drawn footage is mixed from. */
  --glass: color-mix(in srgb, color-mix(in srgb, var(--glow-a) 14%, var(--bg)) 78%, transparent);
  --glass-edge: color-mix(in srgb, var(--accent) 28%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --link: color-mix(in srgb, var(--mark) 92%, var(--text));
  --f-room1: color-mix(in srgb, var(--glow-a) 32%, #7a5a44);
  --f-room2: color-mix(in srgb, var(--glow-b) 20%, #3d3331);
  --f-ground: color-mix(in srgb, var(--bg) 30%, #1d1a1b);
  --f-sky1: color-mix(in srgb, var(--glow-b) 40%, #2b4a66);
  --f-sky2: color-mix(in srgb, var(--glow-a) 25%, #c88b5a);
  --f-hill: color-mix(in srgb, var(--bg) 25%, #1d2a22);
  --f-hill2: color-mix(in srgb, var(--glow-b) 22%, #2a3b2f);
  --f-body: color-mix(in srgb, var(--glow-b) 30%, #2f4a5c);
  --f-sun: color-mix(in srgb, var(--mark) 40%, #f1c27a);
  /* The drawn hand: the theme's own glow, lifted toward the text colour; no skin tone. */
  --hand-a: color-mix(in srgb, var(--text) 24%, color-mix(in srgb, var(--glow-a) 70%, var(--bg)));
  --hand-b: color-mix(in srgb, var(--text) 6%, color-mix(in srgb, var(--glow-b) 60%, var(--bg)));
}

:root[data-theme="white"] {
  --bg: #f2f2f4;
  --glow-a: #c4c4cc;
  --glow-b: #d8d8de;
  --text: #0b0b0c;
  --text-2: rgba(0, 0, 0, 0.7);
  --text-3: rgba(0, 0, 0, 0.62);
  --fill: rgba(0, 0, 0, 0.07);
  --hairline: rgba(0, 0, 0, 0.1);
  --accent: #0b0b0c;
  --primary: #0b0b0c;
  --on-primary: #ffffff;
  --mark: #2b59d6;
  --shade: 20, 20, 30;
  --titanium-a: #c9c9ce;
  --titanium-b: #f4f4f6;
  --titanium-c: #a7a7ae;
  color-scheme: light;
  --glass: color-mix(in srgb, color-mix(in srgb, var(--glow-a) 36%, var(--bg)) 72%, transparent);
  --link: var(--mark);
}

:root[data-theme="graphite"] {
  --bg: #1d1d20;
  --glow-a: #6a6a74;
  --glow-b: #45454d;
  --accent: #ececf1;
  --primary: #ececf1;
  --on-primary: #1d1d20;
  --mark: #9db8ff;
}

:root[data-theme="aurora"] {
  --bg: #0a0a0d;
  --glow-a: #4a3a86;
  --glow-b: #0f5a63;
  --accent: #ffd60a;
  --mark: #ffd60a;
  --cam: #ffd60a;
}

:root[data-theme="sunset"] {
  --bg: #120b0a;
  --glow-a: #8a3b2a;
  --glow-b: #6b2a55;
  --accent: #ffb088;
  --mark: #ffb088;
  --cam: #ffb088;
}

:root[data-theme="ocean"] {
  --bg: #060b12;
  --glow-a: #12508a;
  --glow-b: #0f6a6a;
  --accent: #7cd4ff;
  --mark: #7cd4ff;
  --cam: #7cd4ff;
}

/* A theme change glides; the view-transition path (theme.js) switches this off while it takes over. */
html:not(.theme-cut) {
  transition: --bg 0.6s var(--ease-out), --glow-a 0.6s var(--ease-out), --glow-b 0.6s var(--ease-out),
    --text 0.6s var(--ease-out), --text-2 0.6s var(--ease-out), --text-3 0.6s var(--ease-out),
    --fill 0.6s var(--ease-out), --hairline 0.6s var(--ease-out), --accent 0.6s var(--ease-out),
    --primary 0.6s var(--ease-out), --on-primary 0.6s var(--ease-out), --mark 0.6s var(--ease-out);
}

/* 3. Base ------------------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

/* The app's themed ground: a flat colour with two soft glows (ThemedBackground in Glass.swift). */
.ground {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vmax 60vmax at 6% -6%, color-mix(in srgb, var(--glow-a) 62%, transparent), transparent 62%),
    radial-gradient(56vmax 56vmax at 96% 74%, color-mix(in srgb, var(--glow-b) 58%, transparent), transparent 62%),
    var(--bg);
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

::selection { background: color-mix(in srgb, var(--mark) 45%, transparent); color: var(--text); }

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

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: 16px; top: -64px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip:focus { top: 16px; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 4. Wordmark: "pros.cam" in Pacifico, "pros" in the text colour and ".cam" in the theme's mark colour. */

.wm {
  display: inline-block;
  font-family: var(--font-mark);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  /* The p's swash reaches left and below the box. */
  padding: 0.04em 0.06em 0.12em 0.1em;
}
.wm .c { color: var(--mark); }

/* 5. Buttons and small parts ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 56px;
  padding: 0 32px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font: 600 17px/1 var(--font);
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: transform 0.5s var(--spring), box-shadow 0.3s var(--ease-out);
}
.btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 30px -14px rgba(var(--shade), 0.7); }
.btn:active { transform: scale(0.97); transition-duration: 0.12s; }

.btn.ghost {
  background: var(--glass);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
}

/* 6. Header and the theme dock ---------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header);
  pointer-events: none;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 -20px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 82%, transparent) 30%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  pointer-events: none;
}
.site-header.scrolled::before { opacity: 1; }
.site-header .wrap {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header .wm { font-size: 32px; pointer-events: auto; flex: none; }

.nav {
  pointer-events: auto;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
}
.nav a {
  display: block;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--text-2);
  font: 500 14px/1 var(--font);
  text-decoration: none;
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.nav a:hover { color: var(--text); background: var(--fill); }
.nav a[aria-current="true"] { color: var(--text); background: var(--fill); }
@media (min-width: 1024px) { .nav { display: flex; } }

.dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 2px;
  border-radius: 999px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
}
.dock button {
  position: relative;
  width: 32px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.dock .dot {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, var(--d2), var(--d1) 72%);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.45);
  transition: transform 0.5s var(--spring);
}
.dock .dot::after {
  content: "";
  position: absolute;
  right: 3px; bottom: 3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--d3);
}
.dock button:hover .dot { transform: scale(1.15); }
.dock button[aria-checked="true"] .dot { transform: scale(1.12); }
.dock button[aria-checked="true"]::before {
  content: "";
  position: absolute;
  inset: 5px 3px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--text);
  opacity: 0.9;
}

/* The theme change reveals as a growing circle (theme.js drives the new layer's clip). */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
@media (max-width: 420px) {
  .site-header .wm { font-size: 28px; }
  .dock button { width: 28px; }
}

/* 7. Footer ----------------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  padding: 56px 0 40px;
  border-top: 1px solid var(--line);
}
.site-footer .wrap {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}
.site-footer .wm { font-size: 32px; opacity: 0.9; }
.site-footer p { color: var(--text-2); font-size: 15px; line-height: 1.6; margin-top: 8px; max-width: 32ch; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 32px; align-content: flex-start; }
.foot-links a {
  color: var(--text-2);
  font: 500 15px/1 var(--font);
  padding: 8px 0;
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}
.foot-links a:hover { color: var(--text); }
.site-footer .fine { max-width: none; grid-column: 1 / -1; color: var(--text-3); font-size: 13px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (min-width: 768px) {
  .site-footer .wrap { grid-template-columns: 1fr auto; align-items: start; }
}

/* 8. Legal and support pages ------------------------------------------------------------------ */

.doc-page .site-header { position: absolute; }
.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--header) + 64px) var(--gutter) 96px;
}
.doc h1 {
  font: 700 clamp(40px, 6vw, 64px)/1.04 var(--font);
  letter-spacing: -0.035em;
  margin-bottom: 8px;
}
.doc h2 {
  font: 650 clamp(22px, 2.4vw, 26px)/1.2 var(--font);
  letter-spacing: -0.02em;
  margin: 56px 0 16px;
}
.doc h3 {
  font: 600 18px/1.3 var(--font);
  letter-spacing: -0.01em;
  margin: 32px 0 8px;
}
.doc p, .doc li { color: var(--text-2); margin: 0 0 16px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc ul { padding-left: 24px; margin: 0 0 16px; list-style: disc; }
.doc li::marker { color: var(--text-3); }
.doc a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doc a:hover { text-decoration-thickness: 2px; }
.doc .when { color: var(--text-3); font-size: 15px; margin-bottom: 40px; }
.doc .lede { font-size: clamp(18px, 2vw, 21px); line-height: 1.5; color: var(--text-2); margin-bottom: 40px; }
.doc table { border-collapse: collapse; width: 100%; margin: 0 0 24px; font-size: 16px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 16px 24px 16px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.doc th { color: var(--text-3); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.doc td:first-child { color: var(--text); }
.contact {
  margin: 0 0 8px;
  padding: 24px 32px;
  border-radius: 24px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}
.contact p { margin: 0 0 8px; }
.contact a { font-weight: 600; font-size: clamp(20px, 3vw, 28px); letter-spacing: -0.02em; color: var(--text); text-decoration-color: var(--mark); }
.doc nav.more {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--text-3);
}
.doc nav.more a { color: var(--text-2); }

/* 9. Reduced motion --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; transition: none !important; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
}
