/*
Theme Name: Region 8 Soo Bahk Do
Theme URI: https://soobahkdoregion8.com/
Author: Region 8 webmaster
Description: Custom block theme for the Rocky Mountain Region (Region 8) of the U.S. Soo Bahk Do Moo Duk Kwan Federation. What you see in the block editor is what visitors see. Pairs with the "Region 8 Core" plugin for events, schools, and forms.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: region8
Tags: block-patterns, full-site-editing, editor-style, accessibility-ready
*/

/* ------------------------------------------------------------------
   Shared tokens (also used by the Region 8 Core plugin)
------------------------------------------------------------------- */
:root {
	--r8-ridge: url("assets/images/ridge.svg");
	--r8-ridge-height: clamp(22px, 4.2vw, 64px);
	--r8-radius: 4px;
	--r8-sticky-offset: 1.5rem;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

h1, h2, h3, h4, h5, h6, [id] { scroll-margin-top: 6rem; }

/* Comfortable reading in long content */
.entry-content p, .entry-content li { hanging-punctuation: first; }
.entry-content li + li { margin-top: 0.35em; }
.entry-content strong { color: var(--wp--preset--color--midnight); }
.entry-content :where(h2) { margin-top: var(--wp--preset--spacing--50); }
.entry-content :where(h3, h4, h5) { margin-top: var(--wp--preset--spacing--40); }
.entry-content :where(h2 + *, h3 + *, h4 + *, h5 + *) { margin-top: 0.75rem; }

:where(.wp-site-blocks) a:where(:not(.wp-element-button)) { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:where(.wp-site-blocks) a:where(:not(.wp-element-button)):hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--wp--preset--color--gold); outline-offset: 2px; }

.screen-reader-text:focus { background: #fff; clip: auto !important; clip-path: none; color: var(--wp--preset--color--midnight); display: block; font-weight: 700; height: auto; left: 8px; padding: 12px 20px; top: 8px; width: auto; z-index: 100000; }

/* ------------------------------------------------------------------
   Header
------------------------------------------------------------------- */
.r8-header { position: relative; z-index: 20; border-bottom: 1px solid var(--wp--preset--color--line); }
.r8-header .wp-block-site-logo img { max-height: 64px; width: auto; }
.r8-header .r8-brand { gap: 0.85rem; }
.r8-header .r8-brand-text { gap: 0.15rem; }
.r8-header .wp-block-navigation .wp-block-navigation-item__content { padding: 0.35rem 0; }
.r8-header .wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
.r8-header .wp-block-navigation a[aria-current="page"] { color: var(--wp--preset--color--red); box-shadow: inset 0 -2px 0 currentColor; }
.r8-header .wp-block-navigation__submenu-container { border: 1px solid var(--wp--preset--color--line) !important; border-radius: var(--r8-radius); box-shadow: var(--wp--preset--shadow--lift); padding: 0.4rem 0 !important; min-width: 14rem !important; }
.r8-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: 0.45rem 1rem !important; }
.r8-header .wp-block-navigation__responsive-container.is-menu-open { padding: 1.5rem; }
.r8-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container { gap: 0.9rem; font-size: 1.125rem; }
@media (max-width: 781px) {
	.r8-header .wp-block-site-tagline { display: none; }
	.r8-header .r8-header-cta { display: none; }
}

/* ------------------------------------------------------------------
   Ridge edges (the mountain line used at band edges)
------------------------------------------------------------------- */
.is-style-ridge-bottom, .is-style-ridge-top, .r8-band { position: relative; }
.is-style-ridge-bottom::after, .r8-band::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -1px;
	height: var(--r8-ridge-height);
	background: var(--r8-ridge-color, var(--wp--preset--color--base));
	-webkit-mask: var(--r8-ridge) bottom / 100% 100% no-repeat;
	mask: var(--r8-ridge) bottom / 100% 100% no-repeat;
	pointer-events: none;
	z-index: 2;
}
.is-style-ridge-top::before {
	content: "";
	position: absolute;
	left: 0; right: 0;
	top: calc(var(--r8-ridge-height) * -1 + 1px);
	height: var(--r8-ridge-height);
	background-color: inherit;
	-webkit-mask: var(--r8-ridge) bottom / 100% 100% no-repeat;
	mask: var(--r8-ridge) bottom / 100% 100% no-repeat;
	pointer-events: none;
}
.is-style-ridge-bottom { --r8-ridge-color: var(--wp--preset--color--base); }
.is-style-ridge-bottom.r8-ridge-to-snow { --r8-ridge-color: var(--wp--preset--color--snow); }
.is-style-ridge-bottom { padding-bottom: calc(var(--r8-ridge-height) + var(--wp--preset--spacing--40)) !important; }

/* ------------------------------------------------------------------
   Page heading band
------------------------------------------------------------------- */
.r8-band { overflow: hidden; }
.r8-band .wp-block-post-title, .r8-band h1 { color: var(--wp--preset--color--base); text-wrap: balance; }
.r8-band .r8-breadcrumbs, .r8-band .r8-breadcrumbs a { color: rgba(255,255,255,0.78); font-size: var(--wp--preset--font-size--small); }
.r8-band .r8-breadcrumbs a:hover { color: #fff; }
.r8-band .r8-band-sub { color: rgba(255,255,255,0.86); }

/* ------------------------------------------------------------------
   Home hero
------------------------------------------------------------------- */
.r8-hero.wp-block-cover { align-items: flex-end; }
.r8-hero .wp-block-cover__inner-container { width: 100%; max-width: var(--wp--style--global--wide-size, 76rem); margin-inline: auto; }
.r8-hero h1 { color: #fff; font-size: var(--wp--preset--font-size--display); line-height: 1; text-wrap: balance; }
.r8-hero p { color: rgba(255,255,255,0.92); }
.r8-hero .wp-block-cover__background { background: linear-gradient(180deg, rgba(17,25,56,0.15) 0%, rgba(17,25,56,0.55) 55%, rgba(17,25,56,0.88) 100%) !important; opacity: 1 !important; }

/* ------------------------------------------------------------------
   Block styles
------------------------------------------------------------------- */
/* Steps: for content that truly is a sequence (e.g. submission steps) */
ol.is-style-steps { list-style: none; counter-reset: r8-step; padding-left: 0; }
ol.is-style-steps > li { counter-increment: r8-step; position: relative; padding: 0 0 1.25rem 3.75rem; margin: 0 !important; min-height: 2.75rem; }
ol.is-style-steps > li::before {
	content: counter(r8-step);
	position: absolute; left: 0; top: -0.1rem;
	width: 2.5rem; height: 2.5rem;
	display: grid; place-items: center;
	border-radius: 50%;
	background: var(--wp--preset--color--midnight);
	color: #fff;
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 700;
	font-size: 1.125rem;
}
ol.is-style-steps > li:not(:last-child)::after {
	content: ""; position: absolute; left: calc(1.25rem - 1px); top: 2.6rem; bottom: 0.15rem;
	width: 2px; background: var(--wp--preset--color--line);
}
ol.is-style-steps > li > :is(ul, ol) { margin-top: 0.5rem; }

/* Checklist */
ul.is-style-checklist { list-style: none; padding-left: 0; }
ul.is-style-checklist > li { position: relative; padding-left: 2rem; }
ul.is-style-checklist > li::before {
	content: ""; position: absolute; left: 0.1rem; top: 0.42em; width: 1.05rem; height: 1.05rem;
	border-radius: 3px; border: 2px solid var(--wp--preset--color--midnight);
	background: linear-gradient(var(--wp--preset--color--gold), var(--wp--preset--color--gold)) center / 0.45rem 0.45rem no-repeat;
}

/* Callouts */
.is-style-callout-note, .is-style-callout-important {
	border-left: 4px solid var(--wp--preset--color--midnight);
	background: var(--wp--preset--color--snow);
	padding: 1.1rem 1.35rem !important;
	border-radius: 0 var(--r8-radius) var(--r8-radius) 0;
}
.is-style-callout-important { border-left-color: var(--wp--preset--color--red); background: var(--wp--preset--color--red-tint); }
.is-style-callout-note > :first-child, .is-style-callout-important > :first-child { margin-top: 0; }

/* Panel: a quiet bordered box */
.is-style-panel { border: 1px solid var(--wp--preset--color--line); border-radius: var(--r8-radius); padding: clamp(1.1rem, 3vw, 1.75rem) !important; background: #fff; }

/* Details (accordion) */
.wp-block-details > summary {
	cursor: pointer; list-style: none; position: relative;
	padding: 0.85rem 2.5rem 0.85rem 0;
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 600; font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--midnight);
}
.wp-block-details > summary::-webkit-details-marker { display: none; }
.wp-block-details > summary::after {
	content: ""; position: absolute; right: 0.4rem; top: 50%; width: 0.7rem; height: 0.7rem;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg); transition: transform 0.15s ease;
}
.wp-block-details[open] > summary::after { transform: translateY(-25%) rotate(-135deg); }
.wp-block-details[open] > summary { color: var(--wp--preset--color--red); }
.wp-block-details > :not(summary) { margin-bottom: 1rem; }
.wp-block-details + .wp-block-details { margin-top: -1px; }

/* Tables */
.wp-block-table table { border-collapse: collapse; width: 100%; }
.wp-block-table :is(th, td) { border: 0; border-bottom: 1px solid var(--wp--preset--color--line); padding: 0.65rem 0.75rem; text-align: left; vertical-align: top; }
.wp-block-table thead th { border-bottom: 2px solid var(--wp--preset--color--midnight); color: var(--wp--preset--color--midnight); }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--wp--preset--color--snow); }

/* File block (documents) */
.wp-block-file { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border: 1px solid var(--wp--preset--color--line); border-radius: var(--r8-radius); }
.wp-block-file .wp-block-file__button { background: var(--wp--preset--color--midnight); border-radius: var(--r8-radius); }

/* Buttons */
.wp-block-button.is-style-outline > .wp-block-button__link { background: transparent; color: var(--wp--preset--color--red); border-color: currentColor; }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--midnight); border-color: var(--wp--preset--color--midnight); color: #fff; }
.has-midnight-background-color .wp-block-button.is-style-outline > .wp-block-button__link,
.has-midnight-deep-background-color .wp-block-button.is-style-outline > .wp-block-button__link,
.r8-hero .wp-block-button.is-style-outline > .wp-block-button__link { color: #fff; border-color: rgba(255,255,255,0.8); }
.has-midnight-background-color .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.r8-hero .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: #fff; color: var(--wp--preset--color--midnight); }

/* Images */
.wp-block-image img { border-radius: 2px; }
.wp-block-image.is-style-framed img { padding: 6px; background: #fff; border: 1px solid var(--wp--preset--color--line); }

/* Dark sections: keep links readable */
:is(.has-midnight-background-color, .has-midnight-deep-background-color) { --r8-on-dark: 1; }
:is(.has-midnight-background-color, .has-midnight-deep-background-color) :is(h1, h2, h3, h4, h5, h6) { color: #fff; }
:is(.has-midnight-background-color, .has-midnight-deep-background-color) a:where(:not(.wp-element-button)) { color: #fff; }
:is(.has-midnight-background-color, .has-midnight-deep-background-color) a:where(:not(.wp-element-button)):hover { color: var(--wp--preset--color--gold); }

/* Section heading row: heading left, link right */
.r8-section-head { align-items: baseline !important; }
.r8-section-head h2 { margin: 0; }

/* ------------------------------------------------------------------
   Guide layout (Dan Prep and other long reference pages)
------------------------------------------------------------------- */
.r8-guide { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--wp--preset--spacing--50); align-items: start; }
@media (min-width: 960px) {
	.r8-guide { grid-template-columns: 16.5rem minmax(0, 1fr); }
	.r8-guide > .r8-guide-aside { position: sticky; top: var(--r8-sticky-offset); max-height: calc(100vh - 2 * var(--r8-sticky-offset)); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
	.admin-bar .r8-guide > .r8-guide-aside { top: calc(var(--r8-sticky-offset) + 32px); }
}
.r8-guide > .r8-guide-main { min-width: 0; }
.r8-guide > .r8-guide-main > .entry-content > :first-child { margin-top: 0; }

/* ------------------------------------------------------------------
   Footer
------------------------------------------------------------------- */
.r8-footer { --r8-ridge-top-color: var(--wp--preset--color--midnight-deep); margin-top: calc(var(--r8-ridge-height) + var(--wp--preset--spacing--60)); }
.r8-footer, .r8-footer p { color: rgba(255,255,255,0.82); }
.r8-footer h2 { font-size: var(--wp--preset--font-size--small); font-family: var(--wp--preset--font-family--sans); color: var(--wp--preset--color--gold) !important; letter-spacing: 0.02em; margin-bottom: 0.75rem; }
.r8-footer .wp-block-navigation { font-weight: 500; }
.r8-footer .wp-block-navigation a { color: #fff; }
.r8-footer .wp-block-navigation a:hover { color: var(--wp--preset--color--gold); }
.r8-footer .wp-block-site-title a { color: #fff; }
.r8-footer .r8-footer-fine { border-top: 1px solid rgba(255,255,255,0.14); color: rgba(255,255,255,0.62); }
.r8-footer .r8-footer-fine a { color: rgba(255,255,255,0.8); }
.wp-site-blocks > footer:last-child { margin-block-start: 0; }
.has-snow-background-color + footer .r8-footer,
main.r8-flush + footer .r8-footer { margin-top: var(--r8-ridge-height); }

/* Social icons inherit on dark */
.r8-footer .wp-block-social-links .wp-social-link { background: transparent !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.35); }
.r8-footer .wp-block-social-links .wp-social-link:hover { border-color: var(--wp--preset--color--gold); color: var(--wp--preset--color--gold) !important; transform: none; }

/* ------------------------------------------------------------------
   Print — members print Dan Prep requirements
------------------------------------------------------------------- */
@media print {
	.r8-header, .r8-footer, .r8-guide-aside, .r8-band::after, .r8-band::before, .wp-block-buttons { display: none !important; }
	.r8-band { background: none !important; color: #000 !important; padding: 0 !important; }
	.r8-band h1 { color: #000 !important; }
	.r8-guide { display: block; }
	a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; word-break: break-all; }
	body { font-size: 11pt; }
}

/* ------------------------------------------------------------------
   Content carried over from the old site
------------------------------------------------------------------- */
/* Empty paragraphs were used as spacers; let the theme's spacing do that job. */
.entry-content > p:empty, .entry-content .wp-block-group > p:empty, .entry-content .wp-block-column > p:empty { display: none; }
/* Old theme colour names */
.has-header-red-color { color: var(--wp--preset--color--red) !important; }
.has-midnight-blue-color { color: var(--wp--preset--color--midnight) !important; }
.has-black-color { color: var(--wp--preset--color--ink) !important; }
.has-white-color { color: #fff !important; }
.has-white-background-color { background-color: #fff !important; }
.has-black-background-color { background-color: var(--wp--preset--color--midnight-deep) !important; }
:is(.has-light-gray-background-color, .has-white-smoke-background-color, .has-alice-blue-background-color, .has-pale-cyan-blue-background-color, .has-cyan-bluish-gray-background-color) { background-color: var(--wp--preset--color--snow) !important; }
.has-light-gray-background-color.has-white-color { color: var(--wp--preset--color--ink) !important; }
/* Old floated images inside long pages: lists sit beside a float instead of under it */
.entry-content :is(ul, ol) { display: flow-root; }
.entry-content .alignleft { float: left; margin: 0.35rem 1.5rem 1rem 0; max-width: 45%; }
.entry-content .alignright { float: right; margin: 0.35rem 0 1rem 1.5rem; max-width: 45%; }
.entry-content > .wp-block-heading, .entry-content > hr { clear: both; }
@media (max-width: 600px) { .entry-content :is(.alignleft, .alignright) { float: none; margin: 1rem 0; max-width: 100%; } }
/* Preformatted blocks used for layout on old pages: wrap text instead of scrolling sideways */
.entry-content .wp-block-preformatted { white-space: pre-wrap; font-family: var(--wp--preset--font-family--sans); font-size: var(--wp--preset--font-size--medium); background: transparent; padding: 0; overflow-wrap: anywhere; }
/* Old media & text blocks */
.entry-content .wp-block-media-text { gap: 0; margin-block: 1.25rem; }
.entry-content .wp-block-media-text .wp-block-media-text__content { padding: 0 0 0 1.5rem; }
.entry-content .wp-block-media-text__content > p { margin-block: 0.35rem; }

/* ------------------------------------------------------------------
   Reference pages (Dan Prep, Kyo Sa)
------------------------------------------------------------------- */
.r8-guide .entry-content > h2 { padding-top: var(--wp--preset--spacing--40); border-top: 3px solid var(--wp--preset--color--midnight); position: relative; }
.r8-guide .entry-content > h2::after { content: ""; position: absolute; top: -3px; left: 0; width: 4.5rem; height: 3px; background: var(--wp--preset--color--gold); }
.r8-guide .entry-content > h3, .r8-guide .entry-content .wp-block-group > h3 { font-size: 1.375rem; }
.is-lead { font-size: var(--wp--preset--font-size--large); line-height: 1.6; }

/* Quick links at the top of a guide */
ul.r8-jumplist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 0.5rem; }
ul.r8-jumplist > li { margin: 0 !important; }
ul.r8-jumplist a { display: block; height: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--wp--preset--color--line); border-left: 4px solid var(--wp--preset--color--midnight); border-radius: var(--r8-radius); text-decoration: none; font-weight: 600; color: var(--wp--preset--color--midnight); background: #fff; }
ul.r8-jumplist a:hover { border-left-color: var(--wp--preset--color--red); color: var(--wp--preset--color--red); }

/* Deadline panels: stacked, label on the left on wide screens */
.wp-block-columns.r8-deadlines { flex-direction: column; gap: 0.75rem; }
.wp-block-columns.r8-deadlines > .wp-block-column { flex-basis: auto !important; }
.r8-deadlines .wp-block-column > h3 { font-size: 1.25rem !important; margin-top: 0; }
@media (min-width: 700px) {
	.r8-deadlines > .wp-block-column { display: grid; grid-template-columns: 13rem minmax(0, 1fr); column-gap: 1.5rem; align-items: start; }
	.r8-deadlines > .wp-block-column > h3 { grid-row: span 3; }
	.r8-deadlines > .wp-block-column > * { margin-top: 0 !important; }
	.r8-deadlines > .wp-block-column > p + p { margin-top: 0.75rem !important; }
}

/* Numbered steps made of whole sections */
.r8-steps { counter-reset: r8-step; margin-top: var(--wp--preset--spacing--30); }
.r8-step { counter-increment: r8-step; position: relative; padding: 0 0 var(--wp--preset--spacing--40) 3.5rem; margin: 0 !important; }
.r8-step::before {
	content: counter(r8-step); position: absolute; left: 0; top: 0;
	width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 50%;
	background: var(--wp--preset--color--midnight); color: #fff;
	font-family: var(--wp--preset--font-family--serif); font-weight: 700; font-size: 1.1rem;
	box-shadow: 0 0 0 4px #fff;
}
.r8-step:not(:last-child)::after { content: ""; position: absolute; left: calc(1.2rem - 1px); top: 2.6rem; bottom: 0.5rem; width: 2px; background: var(--wp--preset--color--line); }
.r8-step > :first-child { margin-top: 0 !important; padding-top: 0.35rem; }
.r8-step:last-child { padding-bottom: 0; }

/* Payment and packet links: tappable rows */
ul.r8-paylinks { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
ul.r8-paylinks > li { margin: 0 !important; padding: 0.65rem 0.9rem; border: 1px solid var(--wp--preset--color--line); border-radius: var(--r8-radius); background: #fff; font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--granite); }
ul.r8-paylinks > li > a:first-child { font-size: var(--wp--preset--font-size--medium); font-weight: 650; }
ul.r8-paylinks.is-packets { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }

/* Rank facts panel */
.r8-rank-facts { background: var(--wp--preset--color--snow) !important; border-color: transparent !important; }
.r8-rank-facts p { margin: 0; }
.r8-rank-facts p + p { margin-top: 0.6rem; }

/* Heading links read as headings */
:where(h1, h2, h3, h4) a:where(:not(.wp-element-button)) { color: inherit; text-decoration-color: var(--wp--preset--color--gold); text-decoration-thickness: 2px !important; }
:where(h1, h2, h3, h4) a:where(:not(.wp-element-button)):hover { color: var(--wp--preset--color--red); }

/* Home */
.r8-hero-copy { max-width: 44rem; }
.r8-hero-copy h1 { max-width: none; }
.r8-feature-card { border-radius: var(--r8-radius); overflow: hidden; box-shadow: var(--wp--preset--shadow--lift); }
.r8-feature-card .wp-block-image { margin: 0; }
.r8-feature-card .wp-block-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0; }
.r8-submit-media { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--granite); }
/* Tables typed into old pages with fixed sizes */
.entry-content table:not(.wp-block-table table) { width: 100% !important; height: auto !important; max-width: 100%; border-collapse: collapse; font-size: var(--wp--preset--font-size--small); }
.entry-content table:not(.wp-block-table table) :is(td, th) { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--wp--preset--color--line); vertical-align: top; width: auto !important; height: auto !important; }
.entry-content table:not(.wp-block-table table) h2 { font-size: var(--wp--preset--font-size--x-large); }
.entry-content img { max-width: 100%; height: auto; }
.entry-content iframe { max-width: 100%; }
