/* ============================================================================
 * GP Document vault - css/gp-doc-vault.css
 * ----------------------------------------------------------------------------
 * The shared document upload block, the show-on-profile switch and the modal
 * viewer (inc/gp-doc-vault.php + js/gp-doc-vault.js). Buttons are the frozen
 * library's .gp-btn; the viewer frame is the shared surface (gp-surface.css).
 * Tier-2/3 tokens only, so dark mode follows for free.
 * ============================================================================ */

/* ---- 1. Editor block ------------------------------------------------------ */

/* position: relative keeps the hidden file input (section below) inside its
   own block. Without it, a transformed ancestor (the website Edit Profile
   .gp-modal) becomes the input's containing block, the input escapes the
   scrolling modal body, and focusing it scrolls the whole modal to an empty
   white box (JP 2026-11-12). */
.gp-docvault {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--gp-space-3);
}

.gp-docvault__file {
	display: flex;
	align-items: center;
	gap: var(--gp-space-3);
	padding: var(--gp-space-3);
	border: 1px solid var(--gp-color-border);
	border-radius: var(--gp-r-sm);
	background: var(--gp-color-surface-2);
}

.gp-docvault__file[hidden] { display: none; }

.gp-docvault__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--gp-r-xs);
	background: var(--gp-color-fill-ink);
	color: var(--gp-color-on-primary);
}

.gp-docvault__meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.gp-docvault__name {
	font-weight: 600;
	color: var(--gp-color-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gp-docvault__sub {
	font-size: var(--gp-t-foot);
	color: var(--gp-color-text-secondary);
}

.gp-docvault__actions {
	display: flex;
	align-items: center;
	gap: var(--gp-space-3);
	flex-wrap: wrap;
}

.gp-docvault__pick { cursor: pointer; }

/* The picker is reached through its label (a real, focusable control). */
.gp-docvault__input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
	pointer-events: none;
}

.gp-docvault__input:focus-visible + .gp-docvault__remove,
.gp-docvault__pick:focus-within {
	outline: 2px solid var(--gp-color-focus);
	outline-offset: 2px;
}

.gp-docvault__remove {
	appearance: none;
	min-width: 44px;
	min-height: 44px;
	background: none;
	border: 0;
	padding: var(--gp-space-2);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--gp-color-danger);
	cursor: pointer;
}

.gp-docvault__remove[hidden] { display: none; }

.gp-docvault__hint,
.gp-docvault__status {
	margin: 0;
	font-size: var(--gp-t-foot);
	color: var(--gp-color-text-secondary);
}

.gp-docvault__status:empty { display: none; }

.gp-docvault__status--error { color: var(--gp-color-danger); }

.gp-docvault--busy .gp-docvault__pick,
.gp-docvault--busy .gp-docvault__remove {
	opacity: 0.5;
	pointer-events: none;
}

/* ---- 2. Show-on-profile switch ------------------------------------------- */

.gp-showrow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gp-space-3);
	min-height: 44px;
}

.gp-showrow__label {
	font-size: 14px;
	color: var(--gp-color-text-secondary);
}

.gp-showswitch {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	position: relative;
	width: 51px;
	height: 31px;
	margin: 0;
	border-radius: var(--gp-r-full);
	background: var(--gp-color-border-strong);
	cursor: pointer;
	transition: background-color var(--gp-motion-duration-fast) var(--gp-motion-ease-out);
}

.gp-showswitch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: var(--gp-color-surface);
	box-shadow: 0 2px 4px var(--gp-color-shadow);
	transition: transform var(--gp-motion-duration-fast) var(--gp-motion-ease-out);
}

.gp-showswitch:checked { background: var(--gp-color-success); }

.gp-showswitch:checked::after { transform: translateX(20px); }

.gp-showswitch:focus-visible {
	outline: 2px solid var(--gp-color-focus);
	outline-offset: 2px;
}

/* ---- 3. Viewer ------------------------------------------------------------ */

.gp-docview__panel {
	display: flex;
	flex-direction: column;
}

.gp-docview__title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gp-docview__body {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	min-height: 60vh;
	padding: 0;
	background: var(--gp-color-surface-2);
	-webkit-overflow-scrolling: touch;
}

.gp-docview__frame {
	display: block;
	width: 100%;
	flex: 1 1 auto;
	min-height: 70vh;
	border: 0;
	background: var(--gp-color-surface);
}

.gp-docview__img {
	display: block;
	max-width: 100%;
	max-height: 75vh;
	margin: 0 auto;
	object-fit: contain;
}

.gp-docview__state {
	margin: 0;
	padding: var(--gp-space-8) var(--gp-space-4);
	text-align: center;
	color: var(--gp-color-text-secondary);
}

.gp-docview__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gp-space-2);
	padding: var(--gp-space-8) var(--gp-space-4);
	text-align: center;
}

.gp-docview__name {
	margin: 0;
	font-weight: 600;
	color: var(--gp-color-text);
	word-break: break-word;
}

.gp-docview__note {
	margin: 0;
	font-size: var(--gp-t-foot);
	color: var(--gp-color-text-secondary);
}

.gp-docview__foot {
	display: flex;
	justify-content: flex-end;
}

.gp-docview__download[hidden] { display: none; }

@media (max-width: 1024px) {
	.gp-docview__foot { padding-bottom: calc(var(--gp-space-3) + var(--gp-safe-bottom)); }
	.gp-docview__download { flex: 1 1 auto; }
}

/* ---- 4. Self-sufficient triggers (dev check 2026-11-09) --------------------
   The app's own profile and editor screens do not carry every library
   stylesheet, and there the View button painted as bare text on white and
   the viewer's close as a grey default box. The vault's controls carry
   the library's secondary-button look themselves, so every consumer (the
   transcript, the meet schedule) reads the same on both doors.
   Each rule also names .gp-btn (two classes), because sheet order is not
   fixed: after the app's soft navigation gp-profile.css lands AFTER this
   file, and its legacy single-class .gp-btn (border none, radius 8px) won
   the tie and left the buttons as bare bold text (JP's phone, 2026-11-09).
   Two classes outrank it whatever the order. */
.gp-docvault-open,
.gp-docvault__pick,
.gp-btn.gp-docvault-open,
.gp-btn.gp-docvault__pick {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 6px 16px;
	border: 1px solid var(--gp-color-border-strong);
	border-radius: var(--gp-r-full);
	background: var(--gp-color-surface);
	color: var(--gp-color-text);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.gp-docvault-open:active,
.gp-docvault__pick:active,
.gp-btn.gp-docvault-open:active,
.gp-btn.gp-docvault__pick:active { transform: scale(var(--gp-press-scale-button)); }

.gp-docvault-open:focus-visible,
.gp-docview__close:focus-visible {
	outline: 2px solid var(--gp-color-focus);
	outline-offset: 2px;
}

.gp-docview__close {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--gp-r-full);
	background: transparent;
	color: var(--gp-color-text);
	cursor: pointer;
}

.gp-docview__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gp-space-3);
}

/* ---- 5. Academics permission box (JP + counsel 2026-11-09) ----------------
   The box at the top of both Academics editors (gp_render_academics_consent).
   Until it is ticked the GPA/SAT/ACT fields and switches sit in a disabled
   fieldset and the transcript Upload is locked; Remove stays live.
   Shipped here because this sheet loads on every gymnast profile screen on
   both doors, the same reach as the show switch above. */

.gp-acad-consent {
	padding: var(--gp-space-3);
	border: 1px solid var(--gp-color-border);
	border-radius: var(--gp-r-sm);
	background: var(--gp-color-surface-2);
}

/* The website Edit Profile sheet stacks rows by margin, not by group gap. */
.gp-academics-edit .gp-acad-consent { margin-bottom: var(--gp-space-4); }

.gp-acad-consent__row {
	display: flex;
	align-items: flex-start;
	gap: var(--gp-space-3);
	margin: 0;
	cursor: pointer;
}

.gp-acad-consent__box {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 1px 0 0;
	accent-color: var(--gp-color-primary);
	cursor: pointer;
}

.gp-acad-consent__box:focus-visible {
	outline: 2px solid var(--gp-color-focus);
	outline-offset: 2px;
}

.gp-acad-consent__text {
	font-size: 14px;
	line-height: 1.45;
	color: var(--gp-color-text);
}

.gp-acad-consent__help {
	margin: var(--gp-space-2) 0 0;
	font-size: var(--gp-t-foot);
	color: var(--gp-color-text-secondary);
}

.gp-acad-consent__help[hidden] { display: none; }

.gp-acad-fields {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.gp-acad-fields:disabled { opacity: 0.5; }

.gp-acad-fields:disabled .gp-showswitch { cursor: not-allowed; }

.gp-docvault--locked .gp-docvault__pick {
	opacity: 0.5;
	pointer-events: none;
}
