| 1 | --- |
| 2 | import Layout from "../layouts/Layout.astro"; |
| 3 | |
| 4 | interface Props { |
| 5 | readonly title: string; |
| 6 | readonly description: string; |
| 7 | readonly heading: string; |
| 8 | readonly lede: string; |
| 9 | readonly effectiveDate: string; |
| 10 | readonly lastUpdated: string; |
| 11 | readonly sections: ReadonlyArray<readonly [id: string, label: string]>; |
| 12 | } |
| 13 | |
| 14 | const { title, description, heading, lede, effectiveDate, lastUpdated, sections } = Astro.props; |
| 15 | --- |
| 16 | |
| 17 | <Layout title={title} description={description} pageClass="legal-document-page"> |
| 18 | <div class="legal-page"> |
| 19 | <a class="legal-index-link" href="/legal"><span aria-hidden="true">&#8592;</span> All legal documents</a> |
| 20 | <header class="legal-hero"> |
| 21 | <p class="eyebrow">T3 Tools, Inc. / Legal</p> |
| 22 | <h1>{heading}</h1> |
| 23 | <p class="legal-lede">{lede}</p> |
| 24 | <dl class="legal-dates" aria-label="Document dates"> |
| 25 | <div> |
| 26 | <dt>Effective Date</dt> |
| 27 | <dd>{effectiveDate}</dd> |
| 28 | </div> |
| 29 | <div> |
| 30 | <dt>Last Updated</dt> |
| 31 | <dd>{lastUpdated}</dd> |
| 32 | </div> |
| 33 | </dl> |
| 34 | </header> |
| 35 | |
| 36 | <div class="legal-rule" aria-hidden="true"></div> |
| 37 | |
| 38 | <div class="legal-layout"> |
| 39 | <aside class="legal-nav" aria-label="On this page"> |
| 40 | <p class="legal-nav-label">On this page</p> |
| 41 | <ol> |
| 42 | {sections.map(([id, label], index) => ( |
| 43 | <li> |
| 44 | <a href={`#${id}`} data-legal-nav-link={id}> |
| 45 | <span>{String(index + 1).padStart(2, "0")}</span> |
| 46 | {label} |
| 47 | </a> |
| 48 | </li> |
| 49 | ))} |
| 50 | </ol> |
| 51 | </aside> |
| 52 | |
| 53 | <article class="legal-copy"> |
| 54 | <slot /> |
| 55 | </article> |
| 56 | </div> |
| 57 | </div> |
| 58 | </Layout> |
| 59 | |
| 60 | <script> |
| 61 | const navLinks = Array.from( |
| 62 | document.querySelectorAll<HTMLAnchorElement>("[data-legal-nav-link]"), |
| 63 | ); |
| 64 | const sections = navLinks |
| 65 | .map((link) => { |
| 66 | const id = link.dataset.legalNavLink; |
| 67 | const section = id ? document.getElementById(id) : null; |
| 68 | return section ? { link, section } : null; |
| 69 | }) |
| 70 | .filter((entry): entry is { link: HTMLAnchorElement; section: HTMLElement } => entry !== null); |
| 71 | |
| 72 | let activeId = ""; |
| 73 | let frame = 0; |
| 74 | |
| 75 | const updateActiveSection = () => { |
| 76 | frame = 0; |
| 77 | const marker = Math.min(180, window.innerHeight * 0.28); |
| 78 | let active = sections[0]; |
| 79 | |
| 80 | for (const entry of sections) { |
| 81 | if (entry.section.getBoundingClientRect().top > marker) break; |
| 82 | active = entry; |
| 83 | } |
| 84 | |
| 85 | if (window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2) { |
| 86 | active = sections[sections.length - 1]; |
| 87 | } |
| 88 | |
| 89 | if (!active || active.section.id === activeId) return; |
| 90 | activeId = active.section.id; |
| 91 | |
| 92 | for (const { link, section } of sections) { |
| 93 | if (section.id === activeId) { |
| 94 | link.setAttribute("aria-current", "location"); |
| 95 | } else { |
| 96 | link.removeAttribute("aria-current"); |
| 97 | } |
| 98 | } |
| 99 | }; |
| 100 | |
| 101 | const scheduleUpdate = () => { |
| 102 | if (frame) return; |
| 103 | frame = window.requestAnimationFrame(updateActiveSection); |
| 104 | }; |
| 105 | |
| 106 | updateActiveSection(); |
| 107 | window.addEventListener("scroll", scheduleUpdate, { passive: true }); |
| 108 | window.addEventListener("resize", scheduleUpdate); |
| 109 | </script> |
| 110 | |
| 111 | <style is:global> |
| 112 | .legal-page { |
| 113 | width: min(1120px, calc(100% - 64px)); |
| 114 | margin: 0 auto; |
| 115 | padding: clamp(72px, 10vw, 132px) 0 112px; |
| 116 | } |
| 117 | |
| 118 | .legal-index-link { |
| 119 | display: none; |
| 120 | } |
| 121 | |
| 122 | .legal-hero { |
| 123 | max-width: 820px; |
| 124 | animation: fade-in 0.8s ease-out both; |
| 125 | } |
| 126 | |
| 127 | .legal-hero h1 { |
| 128 | margin-top: 18px; |
| 129 | font-size: clamp(3.4rem, 8vw, 7.4rem); |
| 130 | font-weight: 500; |
| 131 | letter-spacing: -0.02em; |
| 132 | line-height: 0.9; |
| 133 | } |
| 134 | |
| 135 | .legal-lede { |
| 136 | max-width: 720px; |
| 137 | margin-top: 34px; |
| 138 | color: var(--fg-muted); |
| 139 | font-size: clamp(1.05rem, 1.8vw, 1.3rem); |
| 140 | line-height: 1.65; |
| 141 | letter-spacing: -0.012em; |
| 142 | } |
| 143 | |
| 144 | .legal-dates { |
| 145 | display: flex; |
| 146 | flex-wrap: wrap; |
| 147 | gap: 36px; |
| 148 | margin-top: 38px; |
| 149 | } |
| 150 | |
| 151 | .legal-dates div { |
| 152 | display: grid; |
| 153 | gap: 4px; |
| 154 | } |
| 155 | |
| 156 | .legal-dates dt, |
| 157 | .legal-nav-label, |
| 158 | .section-number { |
| 159 | color: var(--fg-dim); |
| 160 | font-family: var(--font-mono); |
| 161 | font-size: 0.68rem; |
| 162 | font-weight: 500; |
| 163 | letter-spacing: 0.12em; |
| 164 | text-transform: uppercase; |
| 165 | } |
| 166 | |
| 167 | .legal-dates dd { |
| 168 | color: var(--fg); |
| 169 | font-family: var(--font-mono); |
| 170 | font-size: 0.8rem; |
| 171 | } |
| 172 | |
| 173 | .legal-rule { |
| 174 | height: 1px; |
| 175 | margin: 72px 0; |
| 176 | background: linear-gradient(90deg, var(--border-strong), var(--border) 65%, transparent); |
| 177 | } |
| 178 | |
| 179 | .legal-layout { |
| 180 | display: grid; |
| 181 | grid-template-columns: 210px minmax(0, 720px); |
| 182 | gap: clamp(64px, 10vw, 140px); |
| 183 | align-items: start; |
| 184 | } |
| 185 | |
| 186 | .legal-nav { |
| 187 | position: sticky; |
| 188 | top: 88px; |
| 189 | max-height: calc(100vh - 112px); |
| 190 | overflow-y: auto; |
| 191 | scrollbar-width: thin; |
| 192 | } |
| 193 | |
| 194 | .legal-nav ol { |
| 195 | display: grid; |
| 196 | gap: 2px; |
| 197 | margin-top: 16px; |
| 198 | padding-bottom: 12px; |
| 199 | list-style: none; |
| 200 | } |
| 201 | |
| 202 | .legal-nav a { |
| 203 | display: grid; |
| 204 | grid-template-columns: 24px 1fr; |
| 205 | gap: 9px; |
| 206 | margin-left: -10px; |
| 207 | padding: 7px 8px 7px 10px; |
| 208 | border-radius: 6px; |
| 209 | color: var(--fg-dim); |
| 210 | font-size: 0.78rem; |
| 211 | line-height: 1.35; |
| 212 | transition: |
| 213 | color 0.16s ease, |
| 214 | background-color 0.16s ease, |
| 215 | box-shadow 0.16s ease; |
| 216 | } |
| 217 | |
| 218 | .legal-nav a span { |
| 219 | color: var(--fg-faint); |
| 220 | font-family: var(--font-mono); |
| 221 | font-size: 0.64rem; |
| 222 | line-height: 1.7; |
| 223 | } |
| 224 | |
| 225 | .legal-nav a:hover { |
| 226 | color: var(--fg); |
| 227 | } |
| 228 | |
| 229 | .legal-nav a[aria-current="location"] { |
| 230 | color: var(--fg); |
| 231 | background: color-mix(in srgb, var(--accent) 8%, transparent); |
| 232 | box-shadow: inset 2px 0 var(--accent); |
| 233 | } |
| 234 | |
| 235 | .legal-nav a[aria-current="location"] span { |
| 236 | color: var(--accent); |
| 237 | } |
| 238 | |
| 239 | .legal-copy { |
| 240 | min-width: 0; |
| 241 | } |
| 242 | |
| 243 | .legal-copy section { |
| 244 | scroll-margin-top: 104px; |
| 245 | } |
| 246 | |
| 247 | .legal-copy section + section { |
| 248 | margin-top: 82px; |
| 249 | padding-top: 82px; |
| 250 | border-top: 1px solid var(--border); |
| 251 | } |
| 252 | |
| 253 | .section-number { |
| 254 | color: var(--accent); |
| 255 | } |
| 256 | |
| 257 | .legal-copy h2 { |
| 258 | margin: 8px 0 28px; |
| 259 | color: var(--fg); |
| 260 | font-size: clamp(1.75rem, 3vw, 2.45rem); |
| 261 | font-weight: 500; |
| 262 | letter-spacing: -0.04em; |
| 263 | line-height: 1.1; |
| 264 | } |
| 265 | |
| 266 | .legal-copy h3 { |
| 267 | margin: 32px 0 10px; |
| 268 | color: var(--fg); |
| 269 | font-size: 1rem; |
| 270 | font-weight: 600; |
| 271 | letter-spacing: -0.015em; |
| 272 | } |
| 273 | |
| 274 | .legal-copy h4 { |
| 275 | margin: 24px 0 8px; |
| 276 | color: var(--fg); |
| 277 | font-size: 0.94rem; |
| 278 | font-weight: 600; |
| 279 | } |
| 280 | |
| 281 | .legal-copy p, |
| 282 | .legal-copy li, |
| 283 | .legal-copy address { |
| 284 | color: var(--fg-muted); |
| 285 | font-size: 0.98rem; |
| 286 | font-style: normal; |
| 287 | line-height: 1.78; |
| 288 | } |
| 289 | |
| 290 | .legal-copy p + p { |
| 291 | margin-top: 18px; |
| 292 | } |
| 293 | |
| 294 | .legal-copy strong { |
| 295 | color: var(--fg); |
| 296 | font-weight: 600; |
| 297 | } |
| 298 | |
| 299 | .legal-copy ul, |
| 300 | .legal-copy ol { |
| 301 | display: grid; |
| 302 | gap: 12px; |
| 303 | margin: 18px 0 20px; |
| 304 | padding-left: 1.2rem; |
| 305 | } |
| 306 | |
| 307 | .legal-copy li { |
| 308 | padding-left: 7px; |
| 309 | } |
| 310 | |
| 311 | .legal-copy li::marker { |
| 312 | color: var(--accent); |
| 313 | } |
| 314 | |
| 315 | .legal-copy .provider-list { |
| 316 | gap: 28px; |
| 317 | } |
| 318 | |
| 319 | .provider-list a, |
| 320 | .legal-copy a { |
| 321 | overflow-wrap: anywhere; |
| 322 | } |
| 323 | |
| 324 | .legal-copy a { |
| 325 | color: var(--fg); |
| 326 | text-decoration: underline; |
| 327 | text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); |
| 328 | text-underline-offset: 4px; |
| 329 | transition: text-decoration-color 0.16s ease; |
| 330 | } |
| 331 | |
| 332 | .legal-copy a:hover { |
| 333 | text-decoration-color: var(--accent); |
| 334 | } |
| 335 | |
| 336 | .legal-notice { |
| 337 | color: var(--fg) !important; |
| 338 | font-weight: 600; |
| 339 | } |
| 340 | |
| 341 | .legal-copy address { |
| 342 | margin-top: 20px; |
| 343 | } |
| 344 | |
| 345 | .contact-link { |
| 346 | display: inline-block; |
| 347 | margin-top: 18px; |
| 348 | font-family: var(--font-mono); |
| 349 | font-size: 0.9rem; |
| 350 | } |
| 351 | |
| 352 | @media (max-width: 820px) { |
| 353 | .legal-index-link { |
| 354 | display: inline-flex; |
| 355 | align-items: center; |
| 356 | gap: 8px; |
| 357 | margin-bottom: 38px; |
| 358 | color: var(--fg-dim); |
| 359 | font-family: var(--font-mono); |
| 360 | font-size: 0.72rem; |
| 361 | letter-spacing: 0.04em; |
| 362 | text-transform: uppercase; |
| 363 | } |
| 364 | |
| 365 | .legal-page { |
| 366 | width: min(100% - 40px, 720px); |
| 367 | padding-top: 56px; |
| 368 | padding-bottom: 80px; |
| 369 | } |
| 370 | |
| 371 | .legal-hero h1 { |
| 372 | font-size: clamp(3.1rem, 16vw, 5rem); |
| 373 | } |
| 374 | |
| 375 | .legal-rule { |
| 376 | margin: 52px 0; |
| 377 | } |
| 378 | |
| 379 | .legal-layout { |
| 380 | display: block; |
| 381 | } |
| 382 | |
| 383 | .legal-nav { |
| 384 | display: none; |
| 385 | } |
| 386 | |
| 387 | .legal-copy section + section { |
| 388 | margin-top: 62px; |
| 389 | padding-top: 62px; |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | @media (max-width: 420px) { |
| 394 | .legal-page { |
| 395 | width: calc(100% - 32px); |
| 396 | padding-top: 42px; |
| 397 | } |
| 398 | |
| 399 | .legal-lede { |
| 400 | margin-top: 26px; |
| 401 | font-size: 1rem; |
| 402 | } |
| 403 | |
| 404 | .legal-dates { |
| 405 | gap: 24px; |
| 406 | } |
| 407 | |
| 408 | .legal-copy p, |
| 409 | .legal-copy li, |
| 410 | .legal-copy address { |
| 411 | font-size: 0.94rem; |
| 412 | } |
| 413 | } |
| 414 | </style> |