/* Purlieus LLC: shared styles.
   Palette from Tern (src/shared/theme): paper, ink, and coral for the primary
   action only. Layout patterns follow the a-thread portfolio. Fonts are
   self-hosted (SIL Open Font License, see assets/fonts/), so no page calls a
   third-party server. */

@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/Fraunces_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/Manrope_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/Manrope_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/Manrope_700Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Tern neutrals */
  --bg: #f5f3ee; /* paper */
  --surface: #ffffff; /* card */
  --surface-2: #eeefec; /* dove tint */
  --border: #e7e3d9;
  --text: #26262b; /* ink */
  --text-muted: #63636a; /* ink 2 */
  --nav-bg: rgba(245, 243, 238, 0.88);

  /* Tern domain hues */
  --link: #33707e; /* glacier deep */
  --accent: #3a7365; /* aurora */
  --glacier: #33707e;
  --glacier-tint: #ddeef1;
  --water: #3e5a6c;
  --water-tint: #e1eaed;
  --aurora: #3a7365;
  --aurora-tint: #dcebe5;
  --driftwood: #5b4636;
  --driftwood-tint: #efe7dc;

  /* Primary action only */
  --coral: #c23a19;
  --on-coral: #ffffff;

  /* Dark band and footer (Tern's waypoints sky) */
  --band-from: #1a2630;
  --band-mid: #3e5a6c;
  --band-to: #62564a;
  --band-text: #fbfaf7;
  --band-text-muted: rgba(251, 250, 247, 0.82);
  --band-accent: #f2c888; /* sun light */
  --band-chip-bg: rgba(0, 0, 0, 0.22);
  --band-chip-border: rgba(255, 255, 255, 0.22);
  --footer-bg: #1a2630;
  --footer-text: #b9c3c9;
  --footer-strong: #fbfaf7;

  --shadow: rgba(30, 24, 52, 0.18);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-md: 12px;
  --radius-lg: 18px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181a1c;
    --surface: #202326;
    --surface-2: #272a2e;
    --border: #33373c;
    --text: #eeece7;
    --text-muted: #a9aba8;
    --nav-bg: rgba(24, 26, 28, 0.86);

    --link: #8fc3cf;
    --accent: #8fd9c4; /* route */
    --glacier: #8fc3cf;
    --glacier-tint: rgba(143, 195, 207, 0.14);
    --water: #a9c2ce;
    --water-tint: rgba(169, 194, 206, 0.14);
    --aurora: #8fd9c4;
    --aurora-tint: rgba(143, 217, 196, 0.14);
    --driftwood: #d8bfa3;
    --driftwood-tint: rgba(216, 191, 163, 0.14);

    --band-from: #11181e;
    --band-mid: #26394a;
    --band-to: #3f372f;
    --footer-bg: #101418;
    --footer-text: #9aa4ab;

    --shadow: rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px; /* clear the sticky header for #anchors */
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
  border-radius: 6px;
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 640px) {
  .wrap {
    padding: 0 32px;
  }
}
@media (min-width: 960px) {
  .wrap {
    padding: 0 56px;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -4rem;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 700;
  z-index: 100;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
@media (min-width: 960px) {
  .site-header__inner {
    min-height: 76px;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}
.brand:hover {
  text-decoration: none;
}
.brand__mark {
  width: 34px;
  height: 34px;
  margin-right: 4px;
  flex: none;
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.brand__suffix {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 960px) {
  .nav-links {
    gap: 28px;
  }
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--text);
}
.nav-links a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}
.nav-links .btn {
  color: var(--text);
}

/* Tern's pages: the header becomes Tern's, with Purlieus as a small parent link. */
.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}
.crumb__parent {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.crumb__parent:hover {
  color: var(--text);
}
.crumb__sep {
  color: var(--border);
  font-size: 1.1rem;
}
.crumb__app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  text-decoration: none;
}
.crumb__icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  flex: none;
}
.nav-links__wide {
  display: none;
}
@media (min-width: 760px) {
  .nav-links__wide {
    display: block;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    opacity 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: var(--coral);
  color: var(--on-coral);
}
.btn-primary:hover {
  opacity: 0.9;
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--text);
}
.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.88rem;
}

/* ---------- Eyebrow ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  flex: none;
}

/* ---------- Company intro (the home page's only hero) ---------- */

.intro {
  padding: 56px 0 64px;
}
@media (min-width: 960px) {
  .intro {
    padding: 112px 0 104px;
  }
}
.intro .wrap > * {
  max-width: 42rem;
}
.intro h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.intro__definition {
  margin: 14px 0 36px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
  line-height: 1.3;
  color: var(--accent);
}
.intro__pos {
  margin-right: 6px;
  font-family: var(--font-body);
  font-size: 0.6em;
  font-weight: 600;
  font-style: italic;
  color: var(--text-muted);
}
.intro__lede {
  margin: 0 0 16px;
  font-size: 1.12rem;
  color: var(--text-muted);
}
@media (min-width: 960px) {
  .intro__lede {
    font-size: 1.2rem;
  }
}

/* ---------- Sections ---------- */

.section {
  padding: 56px 0 64px;
}
@media (min-width: 960px) {
  .section {
    padding: 88px 0 96px;
  }
}
.section--surface {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---------- Product feature (home) and product hero (/tern/) ---------- */

.feature {
  overflow: hidden;
}
.feature__grid {
  display: grid;
  gap: 48px;
  align-items: center;
}
@media (min-width: 960px) {
  .feature__grid {
    grid-template-columns: minmax(0, 1fr) 460px;
    gap: 64px;
  }
}
.feature__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.feature h1,
.feature h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.feature h2 {
  font-size: clamp(2rem, 5vw, 2.6rem);
}
.feature h1 {
  font-size: clamp(2.3rem, 6.4vw, 3.4rem);
}
.feature__subtitle {
  margin: 4px 0 0;
  font-weight: 600;
  color: var(--text-muted);
}
.feature__lede {
  max-width: 32rem;
  margin: 0;
  font-size: 1.08rem;
  color: var(--text-muted);
}
.feature__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.feature__actions .stores {
  margin: 0;
}

.product__icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px -14px var(--shadow);
  flex: none;
}

/* A fan of three phone screens; only the middle one on small screens. */
.phones {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 8px 0 12px;
}
.phones::before {
  content: '';
  position: absolute;
  inset: 12% 6% 4%;
  border-radius: 32px;
  background: var(--glacier-tint);
}
.phone {
  position: relative;
  width: 220px;
  margin: 0;
  border-radius: 26px;
  overflow: hidden;
  border: 6px solid #1f2d38;
  background: #1f2d38;
  box-shadow: 0 28px 56px -24px var(--shadow);
}
.phone img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 20;
  object-fit: cover;
}
.phone--side {
  display: none;
}
@media (min-width: 560px) {
  .phone {
    width: 210px;
  }
  .phone--side {
    display: block;
    width: 180px;
    margin-top: 48px;
  }
  .phone--left {
    margin-right: -56px;
    transform: rotate(-5deg);
  }
  .phone--right {
    margin-left: -56px;
    transform: rotate(5deg);
  }
  .phone--center {
    z-index: 1;
  }
}

/* ---------- Product page sections (/tern/) ---------- */

.section-title {
  margin: 0 0 28px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.01em;
}
.features {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}
.features li {
  padding: 22px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.features h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
}
.features p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}
/* "Who Tern is for": one card per audience, with the features behind it */
.audience {
  display: grid;
  gap: 16px;
}
@media (min-width: 760px) {
  .audience {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.audience__card {
  padding: 26px 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.audience__card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
}
.audience__card p {
  margin: 0;
  color: var(--text-muted);
}
.audience__card ul {
  margin: 16px 0 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
}
.audience__card li {
  margin: 0.4rem 0;
}
.audience__card li::marker {
  color: var(--accent);
}

.feature__lede--strong {
  font-size: 1.18rem;
  color: var(--text);
}

.optional {
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.prose > * {
  max-width: 42rem;
}
.prose ul:not([class]) {
  margin: 0;
  padding-left: 1.25rem;
}
.prose ul:not([class]) li {
  margin: 0.45rem 0;
}
.prose ul:not([class]) li::marker {
  color: var(--accent);
}

.note {
  margin: 28px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Store buttons. Pending ones are plain text until the listings are live. */
.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 20px 8px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}
.store:hover {
  text-decoration: none;
  opacity: 0.9;
}
.store svg {
  width: 24px;
  height: 24px;
  flex: none;
}
.store__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.store__small {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.85;
}
.store__big {
  font-size: 1.05rem;
  font-weight: 700;
}
.store--pending {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px dashed var(--border);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

/* ---------- Document pages (privacy, deletion, support, 404) ---------- */

.doc-page {
  padding: 24px 0 64px;
}
@media (min-width: 720px) {
  .doc-page {
    padding: 56px 0 96px;
  }
}

main.doc {
  max-width: 48rem;
  margin: 0 16px;
  padding: 32px 22px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px -36px var(--shadow);
}
@media (min-width: 720px) {
  main.doc {
    margin: 0 auto;
    padding: 56px 64px 64px;
  }
}

.doc h1 {
  font-size: clamp(2rem, 5vw, 2.6rem);
  margin: 0 0 10px;
}
.doc h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2.25rem 0 0.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.doc .updated,
.doc .lede {
  display: inline-block;
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.doc .updated {
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-style: normal;
}
.doc .lede {
  display: block;
  font-size: 1.08rem;
}
.doc p {
  margin: 0 0 1rem;
}
.doc ul,
.doc ol {
  padding-left: 1.35rem;
  margin: 0 0 1rem;
}
.doc li {
  margin: 0.4rem 0;
}
.doc li::marker {
  color: var(--text-muted);
}
.doc strong {
  font-weight: 700;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.9rem;
}
.site-footer a {
  color: var(--footer-text);
}
.site-footer a:hover {
  color: var(--footer-strong);
}
.site-footer a:focus-visible {
  outline-color: var(--band-accent);
}
.site-footer__inner {
  display: grid;
  gap: 28px;
  padding-top: 48px;
  padding-bottom: 32px;
}
@media (min-width: 720px) {
  .site-footer__inner {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}
.site-footer p {
  margin: 0 0 4px;
}
.site-footer__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--footer-strong);
}
.footer-links {
  display: grid;
  gap: 8px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 480px) {
  .footer-links {
    grid-template-columns: auto auto;
  }
}
.site-footer__legal {
  padding-bottom: 32px;
  font-size: 0.82rem;
}
.site-footer__legal p {
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
