/*
Theme Name: CB17 Raceworks
Theme URI: https://www.cb17raceworks.com
Author: CB17 Raceworks
Description: Custom theme for CB17 Raceworks (Performance / Preparation / Racing). Black, white and red, built around the CB17 chequer and corner-accent graphics.
Version: 1.0.2
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: cb17
*/

:root {
  --black: #000000;
  --pit: #141414;
  --line: #2b2b2b;
  --white: #ffffff;
  --paper: #f3f3f3;
  --grey: #5a5a5a;
  --red: #E2010F;
  --red-dark: #b5000c;
  --slant: -12deg;
  --wrap: 1180px;
  --head: 'Chakra Petch', 'Arial Narrow', sans-serif;
  --body: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--white); color: #151515; font: 400 1.0625rem/1.65 var(--body); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--red-dark); text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.on-dark :focus-visible, .site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--white); }

h1, h2, h3, h4 { font-family: var(--head); font-style: italic; font-weight: 700; line-height: 1.12; letter-spacing: .01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
h3 { font-size: 1.3rem; }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; left: 12px; top: 12px; z-index: 100; width: auto; height: auto; margin: 0; clip: auto; padding: 10px 16px; background: var(--white); color: var(--black); }
.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }

/* Buttons: slanted like the logo, text kept upright */
.btn { display: inline-block; padding: .8em 1.7em; background: var(--red); color: var(--white); font: 700 1rem/1 var(--head); text-decoration: none; transform: skewX(var(--slant)); border: 2px solid var(--red); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn > span { display: inline-block; transform: skewX(calc(var(--slant) * -1)); }
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.btn--ghost { background: transparent; border-color: var(--white); color: var(--white); }
.btn--ghost:hover { background: var(--white); border-color: var(--white); color: var(--black); }
.btn-row { display: flex; flex-wrap: wrap; gap: 16px 22px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--black); color: var(--white); border-bottom: 4px solid var(--red); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--white); text-decoration: none; }
.brand img { display: block; }
.brand__mark { height: 40px; width: auto; }
.brand__word { height: 24px; width: auto; }
.nav-toggle { display: none; background: none; border: 2px solid var(--white); color: var(--white); font: 600 1rem var(--head); padding: 8px 14px; cursor: pointer; }
.primary-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.primary-nav a { display: block; padding: 10px 14px; color: var(--white); font: 600 1.05rem var(--head); text-decoration: none; border-bottom: 3px solid transparent; }
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current_page_item > a { border-bottom-color: var(--red); color: var(--white); }

/* Hero */
.hero { position: relative; background: var(--black); color: var(--white); overflow: hidden; padding: clamp(56px, 8vw, 120px) 0 clamp(120px, 14vw, 190px); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 64px), 0 100%); }
.hero__flag { position: absolute; right: 0; top: 0; height: 100%; width: auto; max-width: 52%; object-fit: cover; object-position: left center; animation: flag-in .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes flag-in { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.hero__inner { position: relative; z-index: 2; }
.hero__lockup { display: block; width: min(100%, 620px); }
.hero__lockup .cb17 { display: block; width: 100%; }
.hero__lockup .raceworks { display: block; width: 74%; margin: 18px 0 0 3%; }
.tagline { margin: 30px 0 0; font: 500 clamp(.95rem, 2vw, 1.15rem)/1.3 var(--head); letter-spacing: .12em; }
.tagline i { font-style: normal; color: var(--red); margin: 0 .6em; }
.hero__intro { max-width: 46ch; margin: 22px 0 34px; font-size: 1.15rem; color: #dcdcdc; }

/* Chequer strip: sits on the top edge of the footer */
.strip { display: block; height: clamp(32px, 5vw, 56px); background: url('assets/img/chequer-strip.svg') no-repeat right bottom / auto 100%; margin-bottom: -1px; }

/* Sections */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section--paper { background: var(--paper); }
.section__head { max-width: 60ch; margin-bottom: 40px; }
.section__head p { margin: 0; color: var(--grey); }

/* Pillars: columns split by a slanted red rule */
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0; }
.pillar { position: relative; padding: 8px 40px 8px 0; }
.pillar + .pillar { padding-left: 40px; }
.pillar + .pillar::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--red); transform: skewX(var(--slant)); }
.pillar img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 18px; }
.pillar h3 a { color: inherit; text-decoration: none; }
.pillar h3 a:hover { color: var(--red); }
.pillar p { margin: 0 0 1em; color: #333; }

/* News list */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; }
.post-card { background: var(--white); border-top: 5px solid var(--red); padding: 22px 24px 26px; }
.post-card img { display: block; width: calc(100% + 48px); margin: -22px -24px 18px; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card time { font-size: .9rem; color: var(--grey); }
.post-card h3 a { color: var(--black); text-decoration: none; }
.post-card h3 a:hover { color: var(--red); }

/* Contact: echoes the business card */
.contact { position: relative; background: var(--white); padding: clamp(56px, 8vw, 96px) 0; border-bottom: 14px solid var(--red); overflow: hidden; }
.contact__flag { position: absolute; right: 0; bottom: 0; height: 110%; width: auto; max-width: 42%; object-fit: cover; object-position: left center; }
.contact__inner { position: relative; z-index: 2; }
.contact-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 16px; font-size: 1.15rem; }
.contact-list li { display: flex; align-items: flex-start; gap: 16px; }
.contact-list svg { flex: none; width: 28px; height: 28px; margin-top: 2px; color: var(--red); }
.contact-list a { color: #151515; text-decoration: none; }
.contact-list a:hover { color: var(--red); text-decoration: underline; }

/* Inner pages */
.page-head { position: relative; background: var(--black); color: var(--white); padding: clamp(48px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); overflow: hidden; }
.page-head::before { content: ''; position: absolute; left: 0; top: 0; width: clamp(140px, 22vw, 269px); aspect-ratio: 269 / 78; background: url('assets/img/corner-accent.svg') no-repeat left top / contain; }
.page-head::after { content: ''; position: absolute; right: 0; bottom: 0; width: clamp(120px, 24vw, 300px); height: 12px; background: var(--red); clip-path: polygon(24px 0, 100% 0, 100% 100%, 0 100%); }
.page-head .wrap { position: relative; }
.page-head h1 { margin: 0; padding-top: clamp(12px, 3vw, 36px); }
.page-head .meta { margin-top: 10px; color: #bdbdbd; }
.content { padding: clamp(40px, 6vw, 80px) 0; }
.entry-content { max-width: 72ch; }
.entry-content > * + * { margin-top: 1.2em; }
.entry-content .alignwide { max-width: var(--wrap); }
.entry-content .alignfull { max-width: none; }
.entry-content h2, .entry-content h3 { margin-top: 1.6em; }
.entry-content blockquote { margin-inline: 0; padding-left: 22px; border-left: 5px solid var(--red); font-size: 1.15rem; }
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content th, .entry-content td { border-bottom: 1px solid #ddd; padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--black); color: var(--white); font-family: var(--head); }
.entry-content img { height: auto; }
.wp-block-button__link { background: var(--red); border-radius: 0; font-family: var(--head); font-weight: 700; }
.pagination { margin-top: 48px; display: flex; gap: 10px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 8px 16px; border: 2px solid var(--black); color: var(--black); text-decoration: none; font-family: var(--head); font-weight: 600; }
.pagination .current, .pagination .page-numbers:hover { background: var(--red); border-color: var(--red); color: var(--white); }
input[type=text], input[type=search], input[type=email], input[type=tel], textarea { width: 100%; padding: 12px 14px; border: 2px solid #bbb; font: inherit; border-radius: 0; }
input:focus, textarea:focus { border-color: var(--red); }
input[type=submit], button[type=submit] { padding: 12px 26px; background: var(--red); color: var(--white); border: 0; font: 700 1rem var(--head); cursor: pointer; }
.comments-area { max-width: 72ch; margin-top: 64px; }

/* Footer */
.site-footer { background: var(--black); color: #cfcfcf; padding: 48px 0 28px; }
.site-footer__grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.site-footer img { display: block; }
.site-footer .footer-logo { width: 220px; }
.site-footer a { color: var(--white); text-decoration-color: var(--red); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer small { display: block; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: #8c8c8c; }

/* Small screens */
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .primary-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--black); border-bottom: 4px solid var(--red); }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .primary-nav a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .hero { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 36px), 0 100%); padding-bottom: 120px; }
  .hero__flag { top: auto; bottom: 0; max-width: 70%; height: 42%; opacity: .5; }
  .pillar, .pillar + .pillar { padding: 0 0 32px; }
  .pillar + .pillar { padding-top: 32px; }
  .pillar + .pillar::before { left: 0; right: auto; top: 0; bottom: auto; width: 96px; height: 3px; }
  .contact__flag { opacity: .18; max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__flag { animation: none; }
  .btn { transition: none; }
}
