/**
 * RS Resume - Frontend Styles
 *
 * Design tokens and BEM-structured CSS for resume display.
 *
 * @package RsResume
 */

/* ──────────────────────────────────────────────
   CSS Variables (Design Tokens)
   ────────────────────────────────────────────── */

:root {
	/* Gradient */
	--rs-gradient: linear-gradient(to right, #8ebba0 0%, #549481 39%, #71a991 100%);
	/* Text */
	--rs-text-primary: #444141;
	--rs-text-secondary: #505050;
	--rs-text-white: #ffffff;
	/* Background */
	--rs-bg-label: #edf3e7;
	--rs-bg-value: #ffffff;
	/* Border */
	--rs-border-label: #7ab796;
	--rs-border-value: #cccccc;
	--rs-border-outer: #bdbdbd;
	/* Filter + List Page */
	--rs-filter-bg: #f7f5f0;
	--rs-placeholder: #808080;
	--rs-page-active-bg: #7ab796;
	--rs-page-active-text: #fefdf9;
	--rs-page-border: #eeeeee;
	/* Font */
	--rs-font: 'Noto Sans TC', sans-serif;
}

/* ──────────────────────────────────────────────
   Base Reset
   ────────────────────────────────────────────── */

.rs-resume,
.rs-resume *,
.rs-resume *::before,
.rs-resume *::after {
	box-sizing: border-box;
}

/* Single post template wrapper */
.rs-resume-single {
	padding: 40px 20px;
}

.rs-resume {
	max-width: 1087px;
	margin: 0 auto;
	font-family: var(--rs-font);
	color: var(--rs-text-primary);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
}

/* ──────────────────────────────────────────────
   Upper Section: Photo + Basic Info + Family
   ────────────────────────────────────────────── */

.rs-resume__header {
	display: flex;
	gap: 69px;
}

/* Photo */
.rs-resume__photo {
	flex-shrink: 0;
}

.rs-resume__photo img,
.rs-resume__photo-img {
	width: 366px;
	height: 472px;
	object-fit: cover;
	display: block;
	border-radius: 0;
}

/* Right Content */
.rs-resume__content {
	flex: 1;
	min-width: 0;
}

/* Name + Number */
.rs-resume__intro {
	padding-bottom: 10px;
	margin-bottom: 10px;
	border-bottom: 1px dashed #bdbdbd;
}

.rs-resume__name {
	font-size: 23px;
	font-weight: 400;
	color: var(--rs-text-primary);
	margin-bottom: 4px;
}

.rs-resume__number {
	font-size: 16px;
	font-weight: 400;
	color: var(--rs-text-secondary);
}

/* ──────────────────────────────────────────────
   Section Title (Gradient Bar)
   ────────────────────────────────────────────── */

.rs-resume__section {
	margin-top: 10px;
}

.rs-resume__section-title {
	background: var(--rs-gradient);
	padding: 8px 24px;
	font-size: 16px;
	font-weight: 500;
	line-height: 26px;
	letter-spacing: 1.6px;
	color: var(--rs-text-white);
	margin-bottom: 10px;
}

/* ──────────────────────────────────────────────
   Basic Info (Two Flex Columns — Figma match)
   ────────────────────────────────────────────── */

.rs-resume__basic-columns {
	display: flex;
}

.rs-resume__basic-col {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.rs-resume__basic-col-inner {
	display: flex;
	flex-direction: column;
}

.rs-resume__basic-row {
	display: flex;
	height: 42px;
	align-items: center;
	margin-top: -1px;
}

.rs-resume__basic-row:first-child {
	margin-top: 0;
}

.rs-resume__basic-label {
	width: 135px;
	height: 42px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px 24px;
	background: var(--rs-bg-label);
	border-top: 1px solid var(--rs-border-label);
	border-bottom: 1px solid var(--rs-border-label);
	font-size: 16px;
	line-height: 26px;
	letter-spacing: 1.6px;
	color: var(--rs-text-primary);
	white-space: nowrap;
}

.rs-resume__basic-value {
	flex: 1;
	height: 42px;
	display: flex;
	align-items: center;
	padding: 8px;
	background: var(--rs-bg-value);
	border-top: 1px solid var(--rs-border-value);
	border-bottom: 1px solid var(--rs-border-value);
	font-size: 16px;
	line-height: 26px;
	letter-spacing: 1.6px;
	color: var(--rs-text-primary);
	word-break: break-word;
}

/* ──────────────────────────────────────────────
   Tables (CSS Grid) — Family, Work Experience, Work Ability
   ────────────────────────────────────────────── */

.rs-resume__table {
	display: grid;
}

/* 6-column: Family Info (label-value × 3) */
.rs-resume__table--6col {
	grid-template-columns: repeat(3, auto 1fr);
}

/* 5-column: Work Experience */
.rs-resume__table--5col {
	grid-template-columns: repeat(5, 1fr);
}

/* 3-column: Work Ability */
.rs-resume__table--3col {
	grid-template-columns: repeat(3, 1fr);
}

/* Shared cell styles — top/bottom borders only, 42px height */
.rs-resume__table-label,
.rs-resume__table-value,
.rs-resume__table-header {
	height: 42px;
	display: flex;
	align-items: center;
	font-size: 16px;
	font-weight: 400;
	line-height: 26px;
	letter-spacing: 1.6px;
	color: var(--rs-text-primary);
	border-top: 1px solid transparent;
	border-bottom: 1px solid transparent;
}

/* Label Cell */
.rs-resume__table-label {
	background: var(--rs-bg-label);
	border-color: var(--rs-border-label);
	padding: 8px 24px;
	white-space: nowrap;
}

/* Value Cell */
.rs-resume__table-value {
	background: var(--rs-bg-value);
	border-color: var(--rs-border-value);
	padding: 8px;
	word-break: break-word;
}

/* Table Header (for Work Experience / Ability) */
.rs-resume__table-header {
	background: var(--rs-bg-label);
	border-color: var(--rs-border-label);
	padding: 8px 24px;
	justify-content: flex-start;
	text-align: left;
}

/* Collapse grid row borders: -1px row gap */
.rs-resume__table {
	row-gap: 0;
}

.rs-resume__table--6col {
	grid-template-rows: repeat(auto-fill, 42px);
}

.rs-resume__table--5col,
.rs-resume__table--3col {
	grid-template-rows: repeat(auto-fill, 42px);
}

/* 2-column: Mobile label-value pairs */
.rs-resume__table--2col {
	grid-template-columns: auto 1fr;
}

/* Desktop/Mobile visibility toggles */
.rs-resume__mobile-only {
	display: none;
}

/* ──────────────────────────────────────────────
   Lower Section: Family + Work Experience + Work Ability
   ────────────────────────────────────────────── */

.rs-resume__body {
	margin-top: 60px;
	max-width: 1087px;
}

.rs-resume__body .rs-resume__section + .rs-resume__section {
	margin-top: 60px;
}

/* Allow line breaks in work content / reason */
.rs-resume__table--5col .rs-resume__table-value:nth-child(5n+4),
.rs-resume__table--5col .rs-resume__table-value:nth-child(5n+5) {
	word-break: break-word;
}

/* ──────────────────────────────────────────────
   Filter Sidebar
   ────────────────────────────────────────────── */

.rs-resume-filter {
	width: 380px;
	height: 564px;
	background: var(--rs-filter-bg);
	border-radius: 8px;
	padding: 32px;
	flex-shrink: 0;
	align-self: flex-start;
}

.rs-resume-filter__title {
	background: var(--rs-gradient);
	border-radius: 4px;
	padding: 20px;
	font-size: 23px;
	font-weight: 400;
	letter-spacing: 2.3px;
	line-height: 30px;
	color: var(--rs-text-white);
	font-family: var(--rs-font);
}

.rs-resume-filter__body {
	padding: 32px 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.rs-resume-filter__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.rs-resume-filter__label {
	font-size: 16px;
	font-weight: 400;
	color: var(--rs-text-primary);
	font-family: var(--rs-font);
}

.rs-resume-filter__select,
.rs-resume-filter__input {
	background: #ffffff;
	border: 1px solid var(--rs-border-outer);
	border-radius: 4px;
	padding: 10px 16px;
	font-size: 16px;
	font-weight: 400;
	color: var(--rs-text-primary);
	font-family: var(--rs-font);
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
}

.rs-resume-filter__select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 24px 24px;
	padding-right: 44px;
}

.rs-resume-filter__select::placeholder,
.rs-resume-filter__input::placeholder {
	color: var(--rs-placeholder);
}

.rs-resume-filter__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	background: #7ab696;
	color: var(--rs-text-white);
	border: none;
	border-radius: 4px;
	padding: 10px 20px;
	font-size: 16px;
	font-weight: 400;
	font-family: var(--rs-font);
	cursor: pointer;
	white-space: nowrap;
	margin-top: 32px;
}

.rs-resume-filter__btn:hover {
	opacity: 0.9;
}

.rs-resume-filter__btn svg {
	width: 24px;
	height: 24px;
}

/* ──────────────────────────────────────────────
   List Page Layout
   ────────────────────────────────────────────── */

.rs-resume-page {
	display: flex;
	gap: 66px;
	font-family: var(--rs-font);
	max-width: 1440px;
	margin: 0 auto;
}

/* List area fills remaining space, 40px from top */
#rs-resume-list-wrap {
	flex: 1;
	min-width: 0;
	padding-top: 40px;
}

.rs-resume-page *,
.rs-resume-page *::before,
.rs-resume-page *::after {
	box-sizing: border-box;
}

/* ──────────────────────────────────────────────
   Card List
   ────────────────────────────────────────────── */

.rs-resume-list {
	width: 100%;
	padding: 0;
}

.rs-resume-list__grid {
	display: flex;
	flex-wrap: wrap;
	gap: 56px 22px;
}

.rs-resume-list__card {
	width: calc((100% - 44px) / 3);
	display: flex;
	flex-direction: column;
	gap: 16px;
	text-decoration: none;
	color: inherit;
}

.rs-resume-list__card:hover {
	opacity: 0.9;
}

.rs-resume-list__card-photo img {
	width: 100%;
	height: auto;
	aspect-ratio: 267 / 344;
	object-fit: cover;
	display: block;
	border-radius: 0;
}

.rs-resume-list__card-name {
	font-size: 16px;
	font-weight: 400;
	color: var(--rs-text-primary);
	text-align: center;
}

/* Card Info Table */
.rs-resume-list__card-info {
	display: flex;
	flex-direction: column;
}

.rs-resume-list__card-row {
	display: flex;
	margin-top: -1px;
}

.rs-resume-list__card-row:first-child {
	margin-top: 0;
}

.rs-resume-list__card-label {
	width: 75px;
	flex-shrink: 0;
	background: var(--rs-bg-label);
	border: 1px solid var(--rs-border-label);
	padding: 4px 10px;
	font-size: 14px;
	font-weight: 400;
	color: var(--rs-text-primary);
}

.rs-resume-list__card-value {
	width: 191px;
	background: var(--rs-bg-value);
	border: 1px solid var(--rs-border-value);
	padding: 4px 8px;
	font-size: 14px;
	font-weight: 400;
	color: var(--rs-text-primary);
}

/* ──────────────────────────────────────────────
   Pagination
   ────────────────────────────────────────────── */

.rs-resume-list__pagination {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 60px;
}

.rs-resume-list__page-btn {
	width: 42px;
	height: 42px;
	border-radius: 4px;
	padding: 10px;
	font-size: 16px;
	font-weight: 400;
	font-family: var(--rs-font);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	background: transparent;
	border: 1px solid var(--rs-page-border);
	color: var(--rs-text-secondary);
	text-decoration: none;
}

.rs-resume-list__page-btn:hover {
	border-color: var(--rs-border-label);
}

.rs-resume-list__page-btn--active {
	background: var(--rs-page-active-bg);
	color: var(--rs-page-active-text);
	border-color: var(--rs-page-active-bg);
}

/* ──────────────────────────────────────────────
   Loading State
   ────────────────────────────────────────────── */

.rs-resume-list--loading {
	opacity: 0.5;
	pointer-events: none;
}

/* ──────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────── */

@media (max-width: 1200px) {
	.rs-resume__header {
		flex-direction: column;
		align-items: center;
		gap: 30px;
	}

	/* Basic info stretches full width to match body tables */
	.rs-resume__content {
		width: 100%;
	}

	/* Dashed separator needs extra bottom spacing when stacked */
	.rs-resume__intro {
		margin-bottom: 20px;
	}

	/* Basic info → body spacing matches body section spacing (60px) */
	.rs-resume__header {
		margin-bottom: 60px;
	}

	.rs-resume__body {
		margin-top: 0;
	}

	.rs-resume__photo img,
	.rs-resume__photo-img {
		width: 300px;
		height: auto;
		aspect-ratio: 366 / 472;
	}
}

@media (max-width: 960px) {
	.rs-resume-page {
		flex-direction: column;
		gap: 30px;
	}

	.rs-resume-filter {
		width: 100%;
	}

	.rs-resume-list {
		width: 100%;
	}

	.rs-resume-list__grid {
		justify-content: center;
	}
}

@media (max-width: 768px) {
	/* Remove all inner padding — user controls outer container spacing */
	.rs-resume {
		max-width: 100%;
	}

	.rs-resume__header {
		padding: 0;
		gap: 0;
	}

	.rs-resume__photo img,
	.rs-resume__photo-img {
		width: 100%;
		height: auto;
		aspect-ratio: 366 / 472;
	}

	.rs-resume__body {
		margin-top: 0;
	}

	.rs-resume__section {
		margin-top: 0;
	}

	.rs-resume__intro {
		padding: 12px 16px;
		margin-bottom: 10px;
	}

	/* Basic info: stack columns vertically */
	.rs-resume__basic-columns {
		flex-direction: column;
	}

	.rs-resume__basic-row {
		height: auto;
	}

	.rs-resume__basic-label {
		width: 135px;
		flex-shrink: 0;
	}

	/* All tables: 100% width, no overflow */
	.rs-resume__table {
		width: 100%;
		overflow: hidden;
	}

	/* 6-col family → 2-col with fixed label */
	.rs-resume__table--6col {
		grid-template-columns: 135px 1fr;
	}

	/* Mobile 2-col tables: fixed label width */
	.rs-resume__table--2col {
		grid-template-columns: 135px 1fr;
		width: 100%;
	}

	/* Basic info rows: no overflow */
	.rs-resume__basic-col-inner {
		width: 100%;
	}

	.rs-resume__basic-value {
		min-width: 0;
		word-break: break-word;
	}

	/* Toggle desktop/mobile blocks for work sections */
	.rs-resume__desktop-only {
		display: none;
	}

	.rs-resume__mobile-only {
		display: block;
	}

	/* List page */
	.rs-resume-list__grid {
		gap: 30px 16px;
	}

	.rs-resume-list__card {
		width: calc((100% - 16px) / 2);
	}

	.rs-resume-list__card-photo img {
		width: 100%;
		height: auto;
		aspect-ratio: 267 / 344;
	}

	.rs-resume-list__card-label,
	.rs-resume-list__card-value {
		width: auto;
		flex: 1;
	}

	/* Filter */
	.rs-resume-filter {
		border-radius: 0;
		padding: 16px;
	}
}

@media (max-width: 480px) {
	.rs-resume-list__card {
		width: 100%;
	}
}
