/* ─────────────────────────────────────────────────────────────
   Grace Journal — Legal pages (Privacy & Terms)
   Editorial dark theme, brand-aligned annotations, mobile-first.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #141619;
  --ink: #F6F5F3;
  --ink-mute: rgba(246, 245, 243, 0.78);
  --ink-soft: rgba(246, 245, 243, 0.6);
  --ink-faint: rgba(246, 245, 243, 0.32);
  --ink-ghost: rgba(246, 245, 243, 0.08);

  --purple: #C4B5FD;
  --pink:   #F9A8D4;
  --yellow: #FCD34D;
  --blue:   #93C5FD;
  --sage:   #86EFAC;
  --coral:  #FCA5A5;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;
  --hand:  'Caveat', 'Bradley Hand', cursive;

  --col: 38rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.defs {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
}

/* ════════════════ LAYOUT ════════════════ */
.container {
  max-width: none;
  margin: 0;
  padding: clamp(1.5rem, 4vw, 3rem);
  position: relative;
  z-index: 2;
}

.page-header,
.title-block,
.lede,
section,
.contact,
.page-footer {
  max-width: var(--col);
}

@media (min-width: 900px) {
  .container {
    padding: clamp(3rem, 6vh, 5rem) clamp(1.5rem, 4vw, 3rem);
  }
  .page-header,
  .title-block,
  .lede,
  .contact,
  .page-footer { max-width: 100%; }
  .lede { max-width: 44rem; }
  section {
    position: relative;
    display: block;
    padding-left: clamp(16rem, 28vw, 30rem);
    max-width: 100%;
    min-height: 9rem;
  }
  section > h2 {
    position: absolute;
    left: 0;
    top: 0;
    width: clamp(11rem, 20vw, 22rem);
    margin-top: 0;
    padding-top: 0;
  }
  section > :not(h2) {
    max-width: 42rem;
  }
}

/* ════════════════ HEADER ════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-bottom: clamp(2.5rem, 8vh, 4.5rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.3s ease;
}

.brand .brand-logo {
  margin: 0 -0.1rem;
}

.brand:hover, .brand:focus-visible { opacity: 0.7; }

.brand-logo {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 350;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  font-variation-settings: 'opsz' 24, 'SOFT' 80;
  transition: opacity 0.3s ease;
}

.wordmark:hover, .wordmark:focus-visible { opacity: 0.7; }

.meta {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ════════════════ TITLE ════════════════ */
.title-block {
  margin-bottom: clamp(2rem, 6vh, 3.25rem);
  position: relative;
}

.page-title {
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(2.4rem, 9vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  margin-bottom: 0.85rem;
}

.page-title em {
  font-style: italic;
  font-weight: 300;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

.effective {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.lede {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.65;
  color: var(--ink-mute);
  margin: clamp(2rem, 5vh, 2.75rem) 0 clamp(2.75rem, 8vh, 4.5rem);
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
  position: relative;
}

/* ════════════════ SECTIONS & PROSE ════════════════ */
section { margin-bottom: clamp(2rem, 5vh, 3rem); }

@media (min-width: 900px) {
  section { margin-bottom: clamp(2.5rem, 6vh, 4rem); }
}

h2 {
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(1.55rem, 4.5vw, 2.05rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: clamp(2.75rem, 7vh, 4rem) 0 1.25rem;
  font-variation-settings: 'opsz' 72, 'SOFT' 50;
}

h2 .num {
  display: inline-block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 0.7em;
  color: var(--ink-faint);
  margin-right: 0.55em;
  letter-spacing: 0;
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
}

h3 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 2.6vw, 1.25rem);
  line-height: 1.35;
  color: var(--ink);
  margin: 1.75rem 0 0.75rem;
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
}

h4 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 1.25rem 0 0.5rem;
}

p {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.72;
  color: var(--ink-mute);
  margin-bottom: 0.85rem;
}

section > p,
section > ul,
section > ol,
section > .callout,
section > .defs-list,
section > .annotated {
  max-width: 42rem;
}

p:last-child { margin-bottom: 0; }

ul, ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
}

li {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-mute);
  margin-bottom: 0.55rem;
}

li::marker { color: var(--ink-faint); }

strong { color: var(--ink); font-weight: 500; }
em { font-style: italic; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s ease;
}

a:hover, a:focus-visible {
  text-decoration-color: var(--ink);
}

.sub {
  display: inline-grid;
  align-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  color: var(--ink-soft);
  margin-right: 0.45em;
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
  vertical-align: 0.01em;
}

/* ════════════════ DEFINITION LIST ════════════════ */
.defs-list {
  list-style: none;
  padding-left: 0;
  margin-top: 1.25rem;
}

.defs-list > li {
  margin-bottom: 1.1rem;
  padding-left: 0;
}

.defs-list > li:last-child { margin-bottom: 0; }

.defs-term {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 0.15rem;
  font-variation-settings: 'opsz' 24, 'SOFT' 100;
}

.defs-desc {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-mute);
}

/* ════════════════ CALLOUT ════════════════ */
.callout {
  border-left: 2px solid var(--ink-ghost);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
}

.callout > h3:first-child { margin-top: 0.25rem; }

/* ════════════════ ANNOTATION TOOLKIT ════════════════ */

/* Highlights */
.hl {
  padding: 0.06em 0.32em;
  margin: 0 -0.05em;
  border-radius: 3px;
}
.hl-purple { background: rgba(196, 181, 253, 0.18); color: var(--purple); }
.hl-yellow { background: rgba(252, 211, 77, 0.16);  color: var(--yellow); }
.hl-pink   { background: rgba(249, 168, 212, 0.16); color: var(--pink); }
.hl-sage   { background: rgba(134, 239, 172, 0.16); color: var(--sage); }
.hl-blue   { background: rgba(147, 197, 253, 0.16); color: var(--blue); }
.hl-coral  { background: rgba(252, 165, 165, 0.16); color: var(--coral); }

/* Wavy underlines */
.ul {
  position: relative;
  display: inline-block;
}
.ul::after {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: -0.18em;
  height: 0.4em;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
.ul-pink::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M 1 6 Q 10 2, 20 5 T 40 5 T 60 4 T 80 6 T 99 5' stroke='%23F9A8D4' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ul-coral::after  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M 1 6 Q 10 2, 20 5 T 40 5 T 60 4 T 80 6 T 99 5' stroke='%23FCA5A5' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ul-yellow::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M 1 6 Q 10 2, 20 5 T 40 5 T 60 4 T 80 6 T 99 5' stroke='%23FCD34D' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ul-blue::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M 1 6 Q 10 2, 20 5 T 40 5 T 60 4 T 80 6 T 99 5' stroke='%2393C5FD' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ul-sage::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M 1 6 Q 10 2, 20 5 T 40 5 T 60 4 T 80 6 T 99 5' stroke='%2386EFAC' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

.ul-double::after {
  height: 0.7em;
  bottom: -0.32em;
}
.ul-double.ul-coral::after  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'%3E%3Cpath d='M 1 5 Q 10 1, 20 4 T 40 4 T 60 3 T 80 5 T 99 4' stroke='%23FCA5A5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3Cpath d='M 1 11 Q 10 7, 20 10 T 40 10 T 60 9 T 80 11 T 99 10' stroke='%23FCA5A5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ul-double.ul-yellow::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'%3E%3Cpath d='M 1 5 Q 10 1, 20 4 T 40 4 T 60 3 T 80 5 T 99 4' stroke='%23FCD34D' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3Cpath d='M 1 11 Q 10 7, 20 10 T 40 10 T 60 9 T 80 11 T 99 10' stroke='%23FCD34D' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

em.ul, .ul em { font-style: italic; }

/* Hand-drawn circle */
.circled {
  position: relative;
  display: inline-block;
  padding: 0.1em 0.45em 0.1em 0.4em;
  font-style: inherit;
}
.circled::after {
  content: '';
  position: absolute;
  inset: -0.18em -0.05em -0.18em -0.05em;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
.circled-blue::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 50' preserveAspectRatio='none'%3E%3Cpath d='M 60 3 C 100 3, 117 12, 117 25 C 117 40, 95 47, 60 47 C 22 47, 4 39, 3 25 C 2 11, 25 3, 60 3.5' stroke='%2393C5FD' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.circled-coral::after  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 50' preserveAspectRatio='none'%3E%3Cpath d='M 60 3 C 100 3, 117 12, 117 25 C 117 40, 95 47, 60 47 C 22 47, 4 39, 3 25 C 2 11, 25 3, 60 3.5' stroke='%23FCA5A5' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.circled-yellow::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 50' preserveAspectRatio='none'%3E%3Cpath d='M 60 3 C 100 3, 117 12, 117 25 C 117 40, 95 47, 60 47 C 22 47, 4 39, 3 25 C 2 11, 25 3, 60 3.5' stroke='%23FCD34D' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.circled-sage::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 50' preserveAspectRatio='none'%3E%3Cpath d='M 60 3 C 100 3, 117 12, 117 25 C 117 40, 95 47, 60 47 C 22 47, 4 39, 3 25 C 2 11, 25 3, 60 3.5' stroke='%2386EFAC' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* Scribble-out */
.scribble {
  position: relative;
  display: inline-block;
  color: var(--ink-soft);
  font-style: italic;
}
.scribble::after {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 0.55em;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
.scribble-coral::after  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M 1 4 Q 10 1, 20 4 T 40 4 T 60 3 T 80 5 T 99 4' stroke='%23FCA5A5' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.scribble-pink::after   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M 1 4 Q 10 1, 20 4 T 40 4 T 60 3 T 80 5 T 99 4' stroke='%23F9A8D4' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* Handwritten note */
.ann {
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.35rem;
  display: inline-block;
  transform: rotate(-2deg);
  white-space: nowrap;
  margin: 0.4rem 0 0.6rem;
  line-height: 1.1;
  color: var(--coral);
}

.ann-coral  { color: var(--coral); }
.ann-blue   { color: var(--blue); }
.ann-sage   { color: var(--sage); }
.ann-yellow { color: var(--yellow); }
.ann-pink   { color: var(--pink); }
.ann-purple { color: var(--purple); }

.annotated { position: relative; }

@media (min-width: 900px) {
  .ann-margin {
    position: absolute;
    left: 100%;
    top: 0.25rem;
    margin-left: 1.75rem;
    max-width: 11rem;
    white-space: normal;
    line-height: 1.2;
    font-size: 1.3rem;
    transform: rotate(-3deg);
  }
  .ann-margin.ann-bottom {
    top: auto;
    bottom: 0.5rem;
  }
  .ann-margin.tilt-r { transform: rotate(2deg); }
  .ann-margin.tilt-l { transform: rotate(-4deg); }
  section > .ann-margin {
    position: absolute;
    left: 0;
    top: clamp(7rem, 13vw, 12rem);
    margin: 0;
    max-width: 10rem;
    padding-top: 0;
  }
}

/* ════════════════ CONTACT CARD ════════════════ */
.contact {
  border: 1px solid var(--ink-ghost);
  border-radius: 8px;
  padding: clamp(1.5rem, 5vw, 2.25rem);
  margin: clamp(3rem, 8vh, 4.5rem) 0 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
}

.contact h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 3.5vw, 1.6rem);
}

.contact p {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.contact p:last-child { margin-bottom: 0; }

/* ════════════════ FOOTER ════════════════ */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: clamp(3.5rem, 10vh, 6rem);
  position: relative;
  z-index: 2;
}

.footer-links {
  display: flex;
  gap: clamp(1rem, 4vw, 1.75rem);
  position: relative;
}

.ann-footer {
  position: absolute;
  top: -1.6rem;
  right: 0;
  margin: 0;
  font-size: 1.05rem;
  color: var(--sage);
  transform: rotate(-2deg);
  z-index: 3;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .page-footer {
    width: calc(100vw - clamp(3rem, 8vw, 6rem));
    max-width: none;
    margin-left: calc(50% - 50vw + clamp(1.5rem, 4vw, 3rem));
    margin-right: calc(50% - 50vw + clamp(1.5rem, 4vw, 3rem));
  }
}

.page-footer a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  transition: opacity 0.3s ease;
}

.page-footer a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-footer a:hover::after,
.page-footer a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ════════════════ SELECTION + ANIMATION ════════════════ */
::selection {
  background: rgba(252, 211, 77, 0.25);
  color: var(--ink);
}

.container {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ════════════════ MOBILE TWEAKS ════════════════ */
@media (max-width: 480px) {
  .page-header { gap: 0.4rem; }
  h2 { margin-top: clamp(2.25rem, 7vh, 3rem); }

  .page-footer {
    justify-content: center;
    text-align: center;
  }
  .footer-links { justify-content: center; flex-wrap: wrap; }
  .ann-footer { display: none; }

  .ann { font-size: 1.2rem; }
}

@media (max-width: 380px) {
  a[href^="mailto:"] { word-break: break-word; }
}
