/*
 * docs.css
 * Shared stylesheet for the four "document" marketing pages:
 *   /accessibility · /faq · /shipping · /terms (and /terms/accept typography)
 * Replaces accessibility.css, faq.css, shipping.css and terms.css.
 *
 * Structure:
 *   1. Shared .doc-* primitives — sticky TOC sidebar (+ .is-active state),
 *      the TOC/doc two-column layout grid, doc-column typography, and the
 *      shared responsive collapse.
 *   2. Page deltas — small overrides scoped by a page class on <main>
 *      (.ac-main / .faq-main / .sp-main / .tp-main). The body class is
 *      ft-page for all four pages, so page scoping lives on the main element.
 *   3. Page-unique blocks kept under their old prefixes:
 *      .ac-*  accessibility contact/feedback blocks + dot lists
 *      .faq-* accordion (+ eyebrow, category groups)
 *      .sp-*  shipping-methods table (+ disc lists, doc grid rhythm)
 *      .tp-*  terms legal typography (blocks/lists also used by /terms/accept)
 *
 * Reuses the global .ft-* foundation (foundation.css, linked before this file)
 * for tokens: --ft-blue #2da7fa · --ft-text #333536 · --ft-muted #737a82 ·
 * --ft-border #e4e4e4.
 */

/* ===================== 1. Shared .doc-* ===================== */

/* Section band behind the document (accessibility/faq/shipping). Terms keeps
 * its own #f7f7f9 page background on .tp-main instead (see §Terms). */
.doc-section {
	background: #fdfdfd;
}

/* Two-column band on the .ft-shell element: 264px TOC + 48px gap + doc column
 * (= 888px at the 1200px cap), centered. Shipping preserves its Figma
 * 280px/32px split via a .sp-main override (§Shipping) — same 1200px total,
 * so the doc column starts at the same x either way. */
.doc-shell {
	display: grid;
	grid-template-columns: 264px minmax(0, 1fr);
	gap: 48px;
	align-items: start;
	width: min(1200px, 100% - 80px);
}

/* ---- Table of Content sidebar ---- */
.doc-toc {
	position: sticky;
	top: calc(var(--shop-header-height, 80px) + 24px);
}

/* Default variant (accessibility/faq): 14px title carrying the divider as its
 * own border-bottom. */
.doc-toc__title {
	margin: 0 0 16px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--ft-border);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--ft-text);
}

/* Ruled variant (shipping/terms): 16px title + separate <hr> divider, spaced
 * by a 16px container gap. */
.doc-toc--ruled {
	display: grid;
	gap: 16px;
}

.doc-toc--ruled .doc-toc__title {
	margin: 0;
	padding-bottom: 0;
	border-bottom: 0;
	font-size: 16px;
}

.doc-toc__rule {
	width: 100%;
	height: 0;
	margin: 0;
	border: 0;
	border-top: 1px solid var(--ft-border);
}

.doc-toc__nav {
	display: grid;
	gap: 16px;
}

.doc-toc__link {
	font-size: 14px;
	font-weight: 500;
	line-height: 18px;
	color: var(--ft-muted);
	text-decoration: none;
	transition: color 0.2s ease;
}

.doc-toc__link:hover,
.doc-toc__link:focus-visible {
	color: var(--ft-blue);
}

.doc-toc__link.is-active {
	color: var(--ft-blue);
	font-weight: 600;
}

/* ---- Document column ---- */
.doc-body {
	min-width: 0;
}

.doc-intro {
	display: grid;
	gap: 16px;
}

.doc-title {
	margin: 0;
	font-size: 24px;
	line-height: 30px;
	font-weight: 700;
	color: var(--ft-text);
}

/* Meta line between title and lead — the "Last Updated" date the Terms page's
   own "Changes" section promises. .doc-intro is a grid, so it spaces itself. */
.doc-updated {
	margin: 0;
	font-size: 13px;
	line-height: 18px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--ft-muted);
}

.doc-lead {
	margin: 0;
	font-size: 16px;
	line-height: 22px;
	font-weight: 500;
	color: var(--ft-muted);
}

/* Inline text link (accessibility/faq body copy). */
.doc-link {
	color: var(--ft-blue);
	text-decoration: none;
}

.doc-link:hover,
.doc-link:focus-visible {
	text-decoration: underline;
}

/* Horizontal rules — the intro is separated by a heavier (4px) blue rule on
 * accessibility/faq; group separators are a hairline. */
.doc-rule {
	height: 0;
	margin: 24px 0;
	border: 0;
	border-top: 1px solid var(--ft-border);
}

.doc-rule--strong {
	border-top: 4px solid var(--ft-blue);
}

/* Anchor-target section block. scroll-margin keeps a clicked TOC hash link
 * from hiding the heading under the fixed header. */
.doc-block {
	display: grid;
	gap: 8px;
	scroll-margin-top: calc(var(--shop-header-height, 80px) + 24px);
}

.doc-block__title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--ft-text);
}

/* Standard document body copy (accessibility paragraphs, shipping paragraphs).
 * Terms uses its larger 16/30 measure — kept under .tp-block__body below. */
.doc-text {
	margin: 0;
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	color: var(--ft-muted);
}

/* ===================== 2+3. Accessibility (.ac-main) ===================== */

/* Section titles are a size down from the shared 16px on this page. */
.ac-main .doc-block__title {
	margin: 0 0 4px;
	font-size: 14px;
}

.ac-group {
	display: grid;
	gap: 24px;
}

/* Bullet lists — middle-dot markers, muted body text. */
.ac-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 4px;
}

.ac-list li {
	position: relative;
	padding-left: 20px;
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	color: var(--ft-muted);
}

.ac-list li::before {
	content: "•";
	position: absolute;
	left: 6px;
	top: -0.05em;
	color: var(--ft-muted);
}

/* ---- Contact block (Feedback) ---- */
.ac-contact {
	margin-top: 16px;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
}

.ac-contact__label {
	margin: 0 0 8px;
	font-size: 10px;
	line-height: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--ft-text);
}

.ac-contact__value {
	margin: 0;
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	color: var(--ft-muted);
}

/* ===================== 2+3. FAQ (.faq-main) ===================== */

.faq-main .doc-intro {
	gap: 8px;
}

.faq-main .doc-lead {
	margin-top: 4px;
}

.faq-eyebrow {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--ft-blue);
}

/* ---- Category groups ---- */
.faq-group {
	scroll-margin-top: calc(var(--shop-header-height, 80px) + 24px);
}

.faq-group + .faq-group {
	margin-top: 40px;
}

.faq-group__title {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ft-text);
}

/* ---- Accordion ---- */
.faq-list {
	display: grid;
	gap: 0;
	border-top: 1px solid var(--ft-border);
}

.faq-item {
	border-bottom: 1px solid var(--ft-border);
}

.faq-item__q {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	padding: 18px 4px;
	margin: 0;
	background: none;
	border: 0;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ft-text);
	transition: color 0.2s ease;
}

.faq-item__q:hover,
.faq-item.is-open .faq-item__q {
	color: var(--ft-blue);
}

.faq-item__q i {
	flex: 0 0 auto;
	font-size: 18px;
	color: var(--ft-blue);
	transition: transform 0.2s ease;
}

/* Collapsible panel — animate height via grid-template-rows (0fr → 1fr),
 * the same technique the homepage timeline (.ft-tl__body) uses. */
.faq-item__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.32s ease;
}

.faq-item.is-open .faq-item__panel {
	grid-template-rows: 1fr;
}

.faq-item__a {
	overflow: hidden;
	min-height: 0;
	font-size: 14px;
	line-height: 20px;
	font-weight: 500;
	color: var(--ft-muted);
	/* Padding lives on the open state below so that at 0fr the panel truly has
	 * zero height (avoids a sliver when closed). */
	padding-bottom: 0;
	opacity: 0;
	transition: opacity 0.25s ease, padding-bottom 0.32s ease;
}

.faq-item.is-open .faq-item__a {
	padding-bottom: 20px;
	opacity: 1;
}

.faq-item__a a {
	color: var(--ft-blue);
	text-decoration: none;
}

.faq-item__a a:hover,
.faq-item__a a:focus-visible {
	text-decoration: underline;
}

.faq-item__a p {
	margin: 0 0 10px;
}

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

@media (prefers-reduced-motion: reduce) {
	.faq-item__panel,
	.faq-item__a,
	.faq-item__q i {
		transition: none;
	}
}

/* ===================== 2+3. Shipping (.sp-main) ===================== */

.sp-section {
	padding: 64px 0 96px;
}

/* Figma split for this page: TOC 280px + 32px gutter (doc column lands at the
 * same x as the shared 264+48). */
.sp-main .doc-shell {
	grid-template-columns: 280px minmax(0, 1fr);
	gap: 32px;
}

.sp-main .doc-toc__rule {
	width: 246px;
	max-width: 100%;
}

/* Document rhythm comes from the column grid, not rule margins. */
.sp-doc {
	display: grid;
	gap: 24px;
}

.sp-main .doc-rule {
	margin: 0;
}

.sp-main .doc-block {
	gap: 16px;
}

.sp-main .doc-block__title {
	line-height: 1.25;
}

.sp-block__body {
	display: grid;
	gap: 16px;
}

/* ---- Bulleted lists (disc markers) ---- */
.sp-list {
	margin: 0;
	padding-left: 20px;
	display: grid;
	gap: 8px;
	list-style: disc;
}

.sp-list li {
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	color: var(--ft-muted);
}

/* ---- Shipping-methods table (Figma group 217:7383) ---- */
.sp-table-wrap {
	width: 100%;
}

.sp-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.sp-table th,
.sp-table td {
	text-align: left;
	padding: 10px 0;
	font-size: 14px;
	line-height: 18px;
	font-weight: 500;
	border-bottom: 1px solid var(--ft-border);
	vertical-align: top;
}

.sp-table thead th {
	color: var(--ft-text);
	font-weight: 600;
}

/* First column row headers carry slightly stronger emphasis than the value
 * cells, matching the Figma weight contrast (method name vs. delivery time). */
.sp-table tbody th {
	color: var(--ft-text);
	font-weight: 600;
}

.sp-table tbody td {
	color: var(--ft-muted);
}

/* ===================== 2+3. Terms (.tp-main) ===================== */

.tp-main {
	/* Page background per Figma BG/Background. */
	background: #f7f7f9;
}

.tp-section {
	padding: 56px 0 96px;
}

.tp-main .doc-toc__rule {
	border-top-width: 2px;
}

.tp-main .doc-rule {
	border-top-width: 2px;
}

/* Legal blocks — also rendered inside /terms/accept's scroll box, so these
 * stay unscoped .tp-* (that page's <main> is .ta-main, not .tp-main). */
.tp-block + .tp-block {
	margin-top: 32px;
}

.tp-block__body {
	font-size: 16px;
	line-height: 30px;
	font-weight: 500;
	color: var(--ft-muted);
}

.tp-block__body p {
	margin: 0;
}

.tp-block__body p + p,
.tp-block__body p + ul,
.tp-block__body p + ol,
.tp-block__body ul + p,
.tp-block__body ol + p,
.tp-block__body ul + .tp-block__sub,
.tp-block__body ol + .tp-block__sub {
	margin-top: 6px;
}

/* Sub-heading line within a section (e.g. "Customer Relationship Management") */
.tp-block__sub {
	margin: 10px 0 0;
	font-weight: 500;
	color: var(--ft-muted);
}

.tp-block__spacer {
	line-height: 22px;
}

.tp-block__body a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tp-block__body a:hover,
.tp-block__body a:focus-visible {
	color: var(--ft-blue);
}

/* ---- Lists ---- */
.tp-list {
	margin: 0;
	padding-left: 24px;
}

.tp-list--ordered {
	list-style: decimal;
}

.tp-list li {
	margin: 0;
}

.tp-list li + li {
	margin-top: 6px;
}

.tp-list li strong {
	color: var(--ft-text);
	font-weight: 600;
}

/* ===================== Responsive ===================== */

@media (max-width: 990px) {
	/* Stack: TOC above the document, full width; sticky only makes sense
	 * alongside the doc on desktop. */
	.doc-shell {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.doc-toc {
		position: static;
		top: auto;
	}

	/* Shipping keeps its slightly tighter stack gap; the rule stretches. */
	.sp-main .doc-shell {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.sp-main .doc-toc__rule {
		width: 100%;
	}

	.sp-section {
		padding: 56px 0 72px;
	}

	.tp-section {
		padding: 40px 0 72px;
	}

	.ac-contact {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px 24px;
	}
}

@media (max-width: 680px) {
	/* accessibility/faq narrow their gutter a step earlier than shipping/terms */
	.ac-main .doc-shell,
	.faq-main .doc-shell {
		width: min(1200px, 100% - 48px);
	}

	.sp-section {
		padding: 40px 0 56px;
	}

	.tp-section {
		padding: 32px 0 56px;
	}

	.tp-block__body {
		line-height: 28px;
	}

	/* Card-style stacked table: each row becomes a labelled block so the 3
	 * columns don't get crushed on narrow phones. */
	.sp-table,
	.sp-table thead,
	.sp-table tbody,
	.sp-table tr,
	.sp-table th,
	.sp-table td {
		display: block;
		width: 100%;
	}

	.sp-table thead {
		/* Header row is encoded per-cell via data-label below; hide the
		 * standalone header row. */
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.sp-table tr {
		padding: 12px 0;
		border-bottom: 1px solid var(--ft-border);
	}

	.sp-table tbody th,
	.sp-table tbody td {
		padding: 4px 0;
		border-bottom: 0;
	}

	/* Row header (method name) sits on its own line as the card title. */
	.sp-table tbody th {
		font-size: 15px;
		margin-bottom: 4px;
	}

	/* Value cells get their column label prefixed for context. */
	.sp-table tbody td::before {
		content: attr(data-label) ": ";
		font-weight: 600;
		color: var(--ft-text);
	}
}

/* Narrow the gutter to 16px per side at phone widths (convention:
 * 100% - 32px at <=449). The compound selectors keep this step winning over
 * the 680 ac/faq rule above (same specificity, later in file). */
@media (max-width: 449px) {
	.doc-shell,
	.ac-main .doc-shell,
	.faq-main .doc-shell {
		width: min(1200px, 100% - 32px);
	}

	.ac-main .doc-title,
	.faq-main .doc-title {
		font-size: 22px;
		line-height: 28px;
	}

	.ac-contact {
		grid-template-columns: 1fr;
		gap: 18px;
	}

	.faq-item__q {
		font-size: 14px;
	}
}
