/*
 * 頁尾、Instagram 拼貼、電子報（頁尾表單與左下角彈窗），以及 Contact Form 7 表單的共用樣式。
 */

/* 頁尾 */

.ks-footer {
	background: var(--ks-bg);
	color: var(--ks-text);
}

.ks-footer a:hover {
	opacity: 0.7;
}

.ks-footer__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 48px;
	padding-top: 64px;
	padding-bottom: 64px;
}

.ks-footer__brand {
	flex: 0 1 380px;
}

/* 中間的選單與聯絡我們：欄位依內容寬度排在一起，不撐滿 */
.ks-footer__cols {
	display: flex;
	flex: 0 1 auto;
	gap: 20px;
}

.ks-footer__cols .ks-footer__col {
	min-width: 130px;
}

.ks-footer__newsletter {
	flex: 0 1 360px;
}

.ks-footer__brand .ks-brand__name {
	display: inline-block;
	margin-bottom: 16px;
}

.ks-footer__brand .custom-logo {
	width: auto;
	max-height: 44px;
	margin-bottom: 16px;
}

.ks-footer__text {
	color: var(--ks-muted);
	font-size: 1.0625rem;
	line-height: 1.7;
}

.ks-footer__text p {
	margin: 0 0 12px;
}

/* 欄位標題（<summary>）：電腦版就是一般標題，手機版是手風琴的開關 */
.ks-footer__heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 18px;
	font-size: 1.0625rem;
	font-weight: 700;
	list-style: none;
	cursor: default;
}

.ks-footer__heading::-webkit-details-marker {
	display: none;
}

.ks-footer__heading svg {
	display: none;
	transition: transform 0.2s;
}

.ks-footer__newsletter .ks-footer__heading {
	font-size: 1.375rem;
}

.ks-footer__links {
	display: grid;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--ks-muted);
}

.ks-footer__links a:hover {
	color: var(--ks-text);
	opacity: 1;
}

.ks-footer__contacts p,
.ks-footer__newsletter p {
	margin: 0 0 12px;
	color: var(--ks-muted);
	font-size: 0.9375rem;
}

.ks-footer__contacts a {
	color: var(--ks-text);
}

.ks-social {
	display: flex;
	flex-wrap: wrap;
	gap: 26px;
	margin: 24px 0 0;
	padding: 0;
	list-style: none;
}

.ks-social a {
	display: inline-flex;
}

.ks-social svg {
	width: 30px;
	height: 30px;
}

.ks-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 32px;
	padding-top: 24px;
	padding-bottom: 32px;
	color: var(--ks-muted);
	font-size: 1rem;
}

.ks-footer__copyright {
	margin: 0;
}

/* Design By 後面的設計者頭像 */
.ks-footer__avatar {
	display: inline-block;
	width: 28px;
	height: 28px;
	margin: 0 8px 0 6px;
	border-radius: 50%;
	object-fit: cover;
	vertical-align: -9px;
}

.ks-footer__legal {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1199px) {
	.ks-footer__top {
		flex-wrap: wrap;
	}

	.ks-footer__brand,
	.ks-footer__newsletter {
		flex-basis: 100%;
	}
}

@media (max-width: 767px) {
	.ks-footer__top {
		flex-direction: column;
		align-items: stretch;
		gap: 32px;
		padding-top: 48px;
		padding-bottom: 48px;
	}

	.ks-footer__brand,
	.ks-footer__newsletter {
		flex-basis: auto;
	}

	.ks-footer__cols {
		display: block;
	}

	/* 手風琴：選單、聯絡我們、訂閱電子報，上下有分隔線 */
	.ks-footer__top {
		gap: 0;
	}

	.ks-footer__brand {
		margin-bottom: 32px;
	}

	.ks-footer__col {
		border-bottom: var(--ks-bw) solid var(--ks-line);
	}

	.ks-footer__brand + * > .ks-footer__col:first-child,
	.ks-footer__brand + .ks-footer__col {
		border-top: var(--ks-bw) solid var(--ks-line);
	}

	.ks-footer__heading,
	.ks-footer__newsletter .ks-footer__heading {
		margin: 0;
		padding: 20px 0;
		font-size: 1.25rem;
		cursor: pointer;
	}

	/* 手風琴裡的內容文字也跟著加大 */
	.ks-footer__links,
	.ks-footer__contacts p,
	.ks-footer__newsletter p {
		font-size: 1.0625rem;
	}

	.ks-footer__heading svg {
		display: block;
	}

	.ks-footer__col[open] .ks-footer__heading svg {
		transform: rotate(180deg);
	}

	.ks-footer__col-body {
		padding-bottom: 22px;
	}

	.ks-footer__bottom {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* Instagram 拼貼（頁尾中間） */

.ks-ig {
	padding: 32px 0 64px;
}

.ks-ig__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	margin-bottom: 32px;
}

.ks-ig__title {
	margin: 0;
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	letter-spacing: -0.02em;
}

.ks-ig__follow {
	gap: 10px;
}

/* 追蹤、訂閱按鈕：深色版改白底黑字 */
.ks-ig__follow,
.wpcf7 .ks-newsletter-fields input[type="submit"] {
	background: var(--ks-btn-strong);
	color: var(--ks-btn-strong-text);
}

.ks-ig__follow:hover,
.wpcf7 .ks-newsletter-fields input[type="submit"]:hover {
	background: var(--ks-btn-strong-hover);
	color: var(--ks-btn-strong-text);
}

.ks-ig__grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 12px;
}

.ks-ig__account,
.ks-ig__cell {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: var(--ks-radius);
}

.ks-ig__account {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px;
	background: var(--ks-surface);
	font-weight: 700;
	text-align: center;
}

.ks-ig__account svg {
	width: 32px;
	height: 32px;
}

.ks-ig__track {
	display: flex;
	height: 100%;
}

.ks-ig__post {
	display: block;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
}

.ks-ig__post img {
	transition: opacity 0.2s;
}

.ks-ig__post:hover img {
	opacity: 0.85;
}

.ks-ig__track img {
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 989px) {
	.ks-ig__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.ks-ig {
		padding: 16px 0 48px;
	}

	/* 手機版：追蹤按鈕排到圖片下方 */
	.ks-ig > .ks-container {
		display: flex;
		flex-direction: column;
	}

	.ks-ig__top {
		display: contents;
	}

	.ks-ig__title {
		margin-bottom: 24px;
		font-size: 1.875rem;
		line-height: 1.25;
	}

	.ks-ig__grid {
		order: 1;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.ks-ig__follow {
		order: 2;
		width: 100%;
		height: var(--ks-control-h-lg);
		margin-top: 24px;
	}
}

/* 電子報 */

.ks-newsletter {
	display: grid;
	gap: 10px;
}

.ks-newsletter .wpcf7-form {
	margin: 0;
}

.ks-newsletter-fields,
.ks-newsletter-fields > p {
	display: flex;
	gap: 8px;
	margin: 0;
}

.ks-newsletter-fields br {
	display: none;
}

.ks-newsletter-fields .wpcf7-form-control-wrap {
	flex: 1;
	min-width: 0;
}

/* 要蓋過下方 .wpcf7 送出按鈕的滿版寬度 */
.wpcf7 .ks-newsletter-fields input[type="submit"] {
	flex: none;
	width: auto;
}

.ks-newsletter__note {
	margin: 0;
	color: var(--ks-muted);
	font-size: 0.8125rem;
}

.ks-newsletter__note a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* 電子報彈窗：電腦版在左下角，手機版（有開啟時）沿用底部抽屜 */

.ks-popup {
	position: fixed;
}

@media (min-width: 750px) {
	.ks-popup {
		inset: auto auto 24px 24px;
		width: min(640px, calc(100vw - 48px));
		margin: 0;
		padding: 40px;
	}

	.ks-popup[open] {
		animation: ks-popup-in 0.3s ease;
	}
}

@keyframes ks-popup-in {
	from {
		opacity: 0;
	}
}

.ks-popup__close {
	position: absolute;
	top: 20px;
	right: 20px;
}

.ks-popup__title {
	margin: 0 40px 12px 0;
	font-size: clamp(1.5rem, 3vw, 2rem);
	letter-spacing: -0.02em;
}

.ks-popup__text {
	margin: 0 0 24px;
	color: var(--ks-muted);
}

/* Contact Form 7：欄位、按鈕、勾選與回應訊息跟著主題 */

.wpcf7-form {
	display: grid;
	gap: 16px;
}

.wpcf7-form > p {
	margin: 0;
}

.wpcf7-form label {
	display: grid;
	gap: 10px;
	font-weight: 600;
}

.wpcf7 input:is([type="text"], [type="email"], [type="tel"], [type="url"], [type="number"], [type="date"]),
.wpcf7 select,
.wpcf7 textarea {
	width: 100%;
	height: var(--ks-control-h);
	padding: 0 16px;
	border: var(--ks-bw) solid var(--ks-line);
	border-radius: var(--ks-radius);
	background: var(--ks-bg);
	color: var(--ks-text);
	font: inherit;
	font-weight: 500;
	outline: none;
	box-shadow: none;
	transition: border-color 0.15s;
}

.wpcf7 textarea {
	height: auto;
	min-height: 160px;
	padding: 14px 16px;
	resize: vertical;
}

.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
	border-color: var(--ks-text);
}

.wpcf7 input[type="submit"] {
	width: 100%;
	height: var(--ks-control-h);
	padding: 0 28px;
	border: 0;
	border-radius: var(--ks-radius);
	background: var(--ks-btn);
	color: var(--ks-btn-text);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s;
}

.wpcf7 input[type="submit"]:hover {
	background: var(--ks-btn-hover);
}

.wpcf7 .wpcf7-list-item {
	margin: 0;
}

.wpcf7 .wpcf7-list-item label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 500;
}

.wpcf7 .wpcf7-spinner {
	display: none;
}

.wpcf7 .wpcf7-not-valid {
	border-color: var(--ks-danger);
}

.wpcf7 .wpcf7-not-valid-tip {
	margin-top: 6px;
	color: var(--ks-danger);
	font-size: 0.875rem;
	font-weight: 500;
}

/* 表單排版（聯絡表單用）：兩欄一列、選填標示、表單下方小字。CF7 自動加的 <p>、<br> 不影響排版 */
.wpcf7-form br {
	display: none;
}

.ks-form-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.ks-form-row > p {
	display: contents;
}

.wpcf7-form .ks-optional {
	margin-left: 4px;
	color: var(--ks-muted);
	font-size: 0.8125rem;
	font-weight: 500;
}

.wpcf7-form .ks-form-note {
	margin: 0;
	color: var(--ks-muted);
	font-size: 0.8125rem;
	line-height: 1.6;
}

.wpcf7-form .wpcf7-acceptance a,
.wpcf7-form .ks-form-note a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

@media (max-width: 749px) {
	.ks-form-row {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 送出後的訊息：跟 Woo 通知一樣用底色區分 */
.wpcf7 form .wpcf7-response-output {
	margin: 0;
	padding: 14px 18px;
	border: 0;
	border-radius: var(--ks-radius);
	background: var(--ks-notice-info-bg);
	font-size: 0.9375rem;
	font-weight: 600;
}

.wpcf7 form.sent .wpcf7-response-output {
	background: var(--ks-notice-success-bg);
}

.wpcf7 form:is(.invalid, .unaccepted, .failed, .aborted, .spam, .payment-required) .wpcf7-response-output {
	background: var(--ks-notice-error-bg);
}

/* 聯絡資訊：左邊圖示、右邊「標題：內容」 */
.ks-contact-list {
	display: grid;
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ks-contact-list__row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	color: inherit;
	line-height: 1.6;
	text-decoration: none;
}

a.ks-contact-list__row:hover {
	opacity: 0.7;
}

.ks-contact-list__icon {
	flex: none;
	margin-top: 0.15em;
}

.ks-contact-list__text {
	min-width: 0;
	overflow-wrap: anywhere;
}

.ks-contact-list__label {
	font-weight: 600;
}

.ks-contact-list__note {
	display: block;
	color: var(--ks-muted);
	font-size: 0.8125rem;
}

/* 頁尾大字（外觀 → 頁尾與聯絡資訊 → 頁尾大字）：撐滿內容寬度，theme.js 依寬度算字級 */
.ks-footer__wordmark {
	overflow: hidden;
	margin: 0 0 clamp(8px, 1.5vw, 20px);
	color: var(--ks-text);
	font-size: 14vw;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.03em;
	white-space: nowrap;
	user-select: none;
}

.ks-footer__wordmark span {
	display: inline-block;
}

/* Instagram 拼貼移到頁尾上方：跟頁尾之間留一段距離 */
.ks-ig {
	margin-top: clamp(48px, 6vw, 96px);
}

/* 大字緊接在頁尾欄位下方：上方距離縮小 */
.ks-footer__top:has(+ .ks-footer__wordmark) {
	padding-bottom: clamp(8px, 1.5vw, 24px);
}

/* 大字後面的 ™：小字、對齊字母頂端 */
.ks-footer__tm {
	position: relative;
	top: -0.15em;
	margin-left: 0.04em;
	font-size: 0.24em;
	font-weight: 600;
	letter-spacing: 0;
	vertical-align: top;
}

@media (max-width: 767px) {
	.ks-footer__top:has(+ .ks-footer__wordmark) {
		padding-bottom: 32px;
	}
}
