/*
Theme Name: Yy Tan & Co — Ink & Paper
Theme URI: https://yytanco.com/
Author: Messrs Yy Tan & Co.
Description: Lightweight block theme for Messrs Yy Tan & Co. (Direction B, "Ink & Paper"). Image-led, mobile-first, WCAG AA palette. Articles use the standard WordPress block editor. No page builder required.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.32
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: yytanco
*/

/* Visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.11) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--navy);
	outline-offset: 3px;
	border-radius: 2px;
}
.has-deep-background-color :where(a, button, .wp-element-button):focus-visible,
.has-navy-background-color :where(a, button, .wp-element-button):focus-visible,
.wp-block-cover :where(a, button, .wp-element-button):focus-visible {
	outline-color: #ffffff;
}
.skip-link.screen-reader-text:focus { background: #fff; color: var(--wp--preset--color--deep); }

/* Header */
.yyt-header { border-bottom: 1px solid var(--wp--preset--color--line); }
.yyt-logo img { height: 44px; width: auto; display: block; }
@media (max-width: 600px) { .yyt-logo img { height: 34px; } }
.yyt-footer-logo img { height: 40px; width: auto; }

/* Image tiles: image-led cards with an ink rule */
.yyt-tile { background: #fff; height: 100%; }
.yyt-tile .wp-block-image { margin: 0; }
.yyt-tile .wp-block-image img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; display: block; }
.yyt-tile-body { border-left: 5px solid var(--wp--preset--color--navy); }
.yyt-tile a { text-decoration: none; color: inherit; }
.yyt-tile a:hover, .yyt-tile a:focus-visible { text-decoration: underline; }

/* Article cards (query loop) */
.yyt-card .wp-block-post-featured-image img { aspect-ratio: 16 / 10; object-fit: cover; }
.yyt-card .wp-block-post-title a { text-decoration: none; }
.yyt-card .wp-block-post-title a:hover, .yyt-card .wp-block-post-title a:focus-visible { text-decoration: underline; }

/* People tiles: square monograms or studio portraits (same footprint) */
.yyt-monogram { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.yyt-monogram p { margin: 0; letter-spacing: .04em; }
.yyt-portrait { aspect-ratio: 1 / 1; margin: 0; overflow: hidden; background: var(--wp--preset--color--navy, #264863); }
.yyt-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wp-block-image.yyt-portrait { margin: 0; }

/* Readable article body */
.yyt-article .wp-block-post-content { font-size: var(--wp--preset--font-size--medium); }
.yyt-article .wp-block-post-content > * + h2 { margin-top: 1.6em; }
.yyt-article .wp-block-post-content p { hyphens: manual; }
.yyt-disclaimer { font-size: var(--wp--preset--font-size--small); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important; }
.wp-block-image.yyt-tile img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }

/* Enquiry form (Fluent Forms) brought into the Ink & Paper palette — AA contrast */
.yyt-enquiry .fluentform .ff-el-form-control { border: 1px solid #8A8476; border-radius: 0; background: #fff; color: var(--wp--preset--color--deep); font-family: inherit; font-size: 1rem; padding: .7rem .8rem; }
.yyt-enquiry .fluentform .ff-el-form-control:focus { border-color: var(--wp--preset--color--navy); outline: 3px solid var(--wp--preset--color--navy); outline-offset: 1px; }
.yyt-enquiry .fluentform .ff-el-input--label label { color: var(--wp--preset--color--deep); font-weight: 500; }
.yyt-enquiry .fluentform .ff-btn-submit, .yyt-enquiry .fluentform button[type=submit] { background: var(--wp--preset--color--deep) !important; color: #fff !important; border: 0; border-radius: 0; padding: .85rem 1.6rem; font-family: inherit; font-weight: 500; letter-spacing: .04em; }
.yyt-enquiry .fluentform .ff-btn-submit:hover { background: var(--wp--preset--color--navy) !important; }
.yyt-enquiry .fluentform .error, .yyt-enquiry .fluentform .text-danger { color: #A1201B; }
.yyt-enquiry .ff-el-tc label, .yyt-enquiry .ff_t_c { color: var(--wp--preset--color--body); }
.yyt-enquiry .fluentform .ff-el-help-message { font-size: .875rem; font-style: normal; color: var(--wp--preset--color--body); }
.yyt-enquiry .fluentform .ff-el-is-required.asterisk-right label::after { color: #A1201B; }
@media (max-width: 781px) { .wp-block-column.yyt-enquiry { padding-top: var(--wp--preset--spacing--40, 2rem); } }
/* Home "Our people": Partners / Associates / Support staff groups */
.yyt-people-groups { align-items: flex-start; }
.yyt-people-row.is-layout-grid { grid-template-columns: repeat(var(--yyt-n, 3), minmax(8rem, 9.5rem)) !important; }
.yyt-cols-1 { --yyt-n: 1; } .yyt-cols-2 { --yyt-n: 2; } .yyt-cols-3 { --yyt-n: 3; } .yyt-cols-4 { --yyt-n: 4; }
@media (max-width: 600px) {
	.yyt-people-groups { flex-direction: column; }
	.yyt-people-row.is-layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
.yyt-hero-disclaimer { margin-top: 1rem; }
.yyt-hero-disclaimer a { color: #fff; text-decoration: underline; }

/* Social links (footer) — keep clear of floating chat on mobile */
.yyt-social { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.yyt-social__link {
	display: inline-flex; align-items: center; gap: 0.4rem;
	color: #fff; text-decoration: none; font-size: 0.875rem;
	padding: 0.35rem 0.55rem; border: 1px solid rgba(255,255,255,0.35); border-radius: 2px;
}
.yyt-social__link:hover, .yyt-social__link:focus-visible { background: rgba(255,255,255,0.1); }
.yyt-social__icon { flex: 0 0 auto; display: block; }
.yyt-social__label { line-height: 1; }
@media (max-width: 600px) {
	/* Leave room for Social Chat floating button (bottom-right) */
	.yyt-social { margin-bottom: 0.25rem; padding-right: 4.5rem; }
	footer .wp-block-group:last-child,
	.yyt-footer-bottom { padding-bottom: 4.5rem; }
}

/* Team / people cards that link to a profile */
.yyt-person-card--linked a { color: inherit; text-decoration: none; }
.yyt-person-card--linked h3 a:hover,
.yyt-person-card--linked h3 a:focus-visible,
.yyt-person-card--linked .has-deep-color > a:hover,
.yyt-person-card--linked .has-deep-color a:hover,
.yyt-person-card--linked .has-deep-color a:focus-visible { text-decoration: underline; }
.yyt-person-media { display: block; color: inherit; text-decoration: none; }
.yyt-person-media:hover, .yyt-person-media:focus-visible { outline: none; }
.yyt-profile-portrait { max-width: 16rem; }
@media (max-width: 900px) {
	.yyt-people-row.yyt-cols-4.is-layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* 1.0.4 — EN/BM language switch: one small, discreet link */
.yyt-lang-switch { font-size: var(--wp--preset--font-size--small); text-align: right; margin: 0 0 1rem; }
.yyt-lang-switch a { color: var(--wp--preset--color--navy, #264863); text-decoration: underline; text-underline-offset: 0.15em; }
.yyt-lang-switch-wrap { max-width: 1240px; margin: 0.75rem auto 0; padding: 0 var(--wp--preset--spacing--40, 1.5rem); }
.yyt-lang-switch-wrap .yyt-lang-switch { margin: 0; }

/* 1.0.6: one language switch per page, at the right-hand end of the header (EN "Bahasa Malaysia" / BM "English") */
.yyt-header .wp-block-navigation { margin-left: auto; }
.yyt-header .yyt-lang-switch { margin: 0 0 0 1.5rem; font-size: 0.85rem; line-height: 1.2; text-align: right; white-space: nowrap; }
.yyt-header .yyt-lang-switch a { color: var(--wp--preset--color--navy, #264863); text-decoration: underline; text-underline-offset: 0.2em; }
@media (max-width: 600px) {
	.yyt-header .yyt-lang-switch { margin-left: 0.75rem; font-size: 0.8rem; }
	.yyt-header .yyt-logo img { height: 30px; }
}
.yyt-404-ms { margin-top: var(--wp--preset--spacing--50, 2.5rem); padding-top: 1rem; border-top: 1px solid var(--wp--preset--color--line); }

/* 1.0.10 — compact WhatsApp chip on phones (qlwapp 8.7.0).
 * Desktop keeps the existing text pill. On small screens the wide
 * "How can I help you?" / "Boleh kami bantu?" label covered the home
 * Practice/Amalan heading and the office CTAs on /contact/ and /hubungi/.
 * The label stays in the tree (visually hidden) so it remains the
 * accessible name. A visible :focus-visible ring overrides the plugin's
 * outline:none !important, on every viewport.
 */
.qlwapp__button:focus-visible {
	outline: 3px solid #ffffff !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 6px var(--wp--preset--color--navy, #264863) !important;
}
@media (max-width: 600px) {
	.qlwapp__container.qlwapp__container--bottom-right,
	.qlwapp__container.qlwapp__container--bottom-left {
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		width: auto;
		max-width: 100%;
	}
	.qlwapp__container--bottom-right .qlwapp__button.qlwapp__button--button,
	.qlwapp__container--bottom-left .qlwapp__button.qlwapp__button--button {
		width: 52px;
		height: 52px;
		min-width: 52px;
		min-height: 52px;
		padding: 0;
		gap: 0;
		border-radius: 50%;
		justify-content: center;
		align-items: center;
	}
	.qlwapp__container--bottom-right .qlwapp__button.qlwapp__button--button {
		margin: 0 16px 8px 0;
	}
	.qlwapp__container--bottom-left .qlwapp__button.qlwapp__button--button {
		margin: 0 0 8px 16px;
	}
	.qlwapp__button--button .qlwapp__icon {
		margin: 0;
		align-items: center;
		font-size: 26px;
	}
	/* Keep the button text for assistive tech; hide it visually. */
	.qlwapp__button--button .qlwapp__text {
		position: absolute !important;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		clip-path: inset(50%);
		white-space: nowrap;
		border: 0;
	}
	/* Office CTAs (Call/Email/Directions) wrap clear of the chip. */
	.wp-block-buttons:has(> .wp-block-button > a[href^="tel:+60378860189"]) {
		padding-right: 4.75rem;
		row-gap: 0.65rem;
	}
}


/* 1.0.14 — compact EN/BM flag switcher (always both languages) */
.yyt-lang-switch {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	margin: 0 0 0 1rem;
	padding: 0.15rem;
	border: 1px solid var(--wp--preset--color--line, #D9D3C7);
	border-radius: 999px;
	background: #fff;
	white-space: nowrap;
	flex: none;
	line-height: 1;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-align: left;
}
.yyt-lang-switch a { color: inherit; text-decoration: none; }
.yyt-header .yyt-lang-switch { margin: 0 0 0 1rem; font-size: 0.75rem; line-height: 1; text-align: left; white-space: nowrap; }
.yyt-header .yyt-lang-switch a { color: var(--wp--preset--color--deep, #12222F); text-decoration: none; }
.yyt-lang-switch__item {
	display: inline-flex;
	align-items: center;
	gap: 0.28rem;
	padding: 0.2rem 0.45rem 0.2rem 0.3rem;
	border-radius: 999px;
	color: var(--wp--preset--color--navy, #264863);
	line-height: 1;
}
a.yyt-lang-switch__item:hover,
a.yyt-lang-switch__item:focus-visible { background: var(--wp--preset--color--alt, #EFEBE3); }
.yyt-lang-switch__item.is-current {
	background: var(--wp--preset--color--deep, #12222F);
	color: #fff;
}
.yyt-lang-flag { display: block; width: 18px; height: 12px; flex: none; border-radius: 1px; overflow: hidden; box-shadow: 0 0 0 1px rgba(18,34,47,0.15); }
.yyt-lang-code { font-family: inherit; font-weight: 600; letter-spacing: 0.06em; }

/* Keep the longer header (Procedures + flags) on one row at 1280 and 1024 */
.yyt-header .wp-block-group.is-layout-flex,
.yyt-header .wp-block-group { flex-wrap: nowrap !important; min-width: 0; }
.yyt-header .wp-block-navigation { min-width: 0; }
@media (max-width: 1280px) {
	.yyt-header .wp-block-navigation { column-gap: 0.9rem !important; }
}
@media (max-width: 1100px) {
	.yyt-header .wp-block-navigation { column-gap: 0.65rem !important; font-size: 0.8rem; }
	.yyt-header .yyt-lang-switch { margin-left: 0.6rem; }
	.yyt-header .yyt-logo img { height: 38px; }
}
@media (max-width: 1024px) {
	.yyt-header .wp-block-navigation { column-gap: 0.5rem !important; font-size: 0.75rem; }
	.yyt-header .yyt-lang-switch { margin-left: 0.45rem; }
	.yyt-header .yyt-logo img { height: 34px; }
}
@media (max-width: 600px) {
	.yyt-header .yyt-lang-switch { margin-left: 0.4rem; }
	.yyt-header .yyt-logo img { height: 30px; }
}

/* 1.0.14 — Waze and Google Maps icon alignment */
.wp-block-button.yyt-waze-btn .wp-block-button__link,
.yyt-waze-btn .wp-block-button__link,
.wp-block-button.yyt-gmaps-btn .wp-block-button__link,
.yyt-gmaps-btn .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	vertical-align: middle;
}

/*
 * 1.0.15 — Outline appearance for buttons the block style engine never saw.
 *
 * Saved outline buttons get a unique class (is-style-outline--2, --3, …) and
 * CSS emitted in block-style-variation-styles, which loads after global-styles
 * and wins. Injected or PHP-rendered buttons (Waze via render_block, the
 * Procedures "Read full guide" CTAs) only have is-style-outline. The core
 * outline rule also uses :where() (specificity equal to the theme.json default
 * .wp-element-button fill) and is printed *before* global-styles, so it loses:
 * the link is filled "deep" while .has-deep-color makes the label "deep" too —
 * invisible text on a dark bar (the Waze icon, with its own fill, stayed faintly
 * visible). Theme style.css loads after global-styles, so these rules restore
 * the outline look without needing a Site Editor or variation class.
 */
:root :where(.wp-block-button.is-style-outline .wp-block-button__link),
.wp-block-button.yyt-waze-btn .wp-block-button__link,
.wp-block-button.yyt-gmaps-btn .wp-block-button__link,
.yyt-procedure__cta .wp-block-button .wp-block-button__link {
	background-color: transparent;
	background-image: none;
	color: var(--wp--preset--color--deep, #12222F);
	border-color: currentColor;
	border-style: solid;
	border-width: 2px;
	padding: 0.667em 1.33em;
}
:root :where(.wp-block-button.is-style-outline .wp-block-button__link:hover),
:root :where(.wp-block-button.is-style-outline .wp-block-button__link:focus-visible),
.wp-block-button.yyt-waze-btn .wp-block-button__link:hover,
.wp-block-button.yyt-waze-btn .wp-block-button__link:focus-visible,
.wp-block-button.yyt-gmaps-btn .wp-block-button__link:hover,
.wp-block-button.yyt-gmaps-btn .wp-block-button__link:focus-visible,
.yyt-procedure__cta .wp-block-button .wp-block-button__link:hover,
.yyt-procedure__cta .wp-block-button .wp-block-button__link:focus-visible {
	background-color: transparent;
	background-image: none;
	color: var(--wp--preset--color--navy, #264863);
	border-color: currentColor;
}
.yyt-waze-icon,
.yyt-gmaps-icon {
	display: block;
	width: 1.35em;
	height: 1.35em;
	flex: none;
}
svg.yyt-waze-icon,
svg.yyt-gmaps-icon { overflow: visible; }
@media (max-width: 781px) {
	.wp-block-button.yyt-waze-btn .wp-block-button__link,
	.wp-block-button.yyt-gmaps-btn .wp-block-button__link { justify-content: center; }
}

/* 1.0.14 — Procedures listing and single-post crumb */
.yyt-procedures { max-width: 1240px; }
.yyt-procedure { margin: 0 0 var(--wp--preset--spacing--50, 3rem); padding-bottom: var(--wp--preset--spacing--50, 3rem); border-bottom: 1px solid var(--wp--preset--color--line, #D9D3C7); }
.yyt-procedure:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.yyt-procedure__title { margin: 0 0 0.85rem; }
.yyt-procedure__title a { text-decoration: none; color: var(--wp--preset--color--deep, #12222F); }
.yyt-procedure__title a:hover,
.yyt-procedure__title a:focus-visible { text-decoration: underline; }
.yyt-procedure__cta { margin-top: 1.25rem; }
.yyt-procedure--card { padding-bottom: 1.5rem; }
.yyt-proc-crumb { margin: 0 0 0.65rem; font-size: var(--wp--preset--font-size--small, 0.9375rem); }
.yyt-proc-crumb a { color: var(--wp--preset--color--navy, #264863); text-decoration: none; }
.yyt-proc-crumb a:hover,
.yyt-proc-crumb a:focus-visible { text-decoration: underline; }

/* 1.0.16 — Footer Google Maps + Waze pills (dark navy, match LinkedIn/Facebook/X) */
.yyt-footer-maps {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 0.85rem;
}
.yyt-footer-maps .yyt-social__link {
	color: #fff;
}
.yyt-footer-maps .yyt-waze-icon,
.yyt-footer-maps .yyt-gmaps-icon {
	width: 20px;
	height: 20px;
}
@media (max-width: 600px) {
	.yyt-footer-maps { padding-right: 4.5rem; }
}


/* 1.0.29 — On narrow screens, article tables in post content scroll
 * horizontally inside their container so wide tables are not clipped.
 * 1.0.30 — Replace the 1.0.29 table { width: max-content } rule, which
 * stopped wrapping and made the article 020 four-column table ~3,100px
 * wide. Keep overflow-x: auto on the figure. Tables use width: auto and
 * white-space: normal so text wraps. A uniform min-width: 40rem would
 * force two-column tables (020 documents, 014, 001, 023) to 640px when
 * they already fit at 100%. width: auto; min-width: 100% alone lets the
 * 020 four-column table collapse to 358px with a ~95px last column.
 * So the 40rem (~640px) floor applies only to tables with three or more
 * columns. Desktop layout is unchanged (max-width: 781px).
 * 1.0.31 — No CSS change. llms.txt adds article 019 EN and BM
 * (provisional v3 slugs; re-verify after publish).
 * 1.0.32 — No CSS change. llms.txt adds article 021 EN and BM
 * (Distress Act 1951 / warrant of distress; law as at 30 November 2026). */
@media (max-width: 781px) {
	.entry-content figure.wp-block-table,
	.wp-block-post-content figure.wp-block-table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.entry-content figure.wp-block-table > table,
	.wp-block-post-content figure.wp-block-table > table {
		width: auto;
		max-width: none;
		min-width: 100%;
	}

	.entry-content figure.wp-block-table > table:has(:is(th, td):nth-child(3)),
	.wp-block-post-content figure.wp-block-table > table:has(:is(th, td):nth-child(3)) {
		min-width: 40rem;
	}

	.entry-content figure.wp-block-table th,
	.entry-content figure.wp-block-table td,
	.wp-block-post-content figure.wp-block-table th,
	.wp-block-post-content figure.wp-block-table td {
		white-space: normal;
	}
}
