/*
Theme Name: Instrument Brief
Theme URI: https://instrumentbrief.com
Description: Block theme for InstrumentBrief. Beginner instrument buying guides.
Version: 1.3.1
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: instrument-brief
*/

/* ---------- Tokens ---------- */
:root {
  --ib-ivory: #F7F4ED;
  --ib-white: #FFFFFF;
  --ib-charcoal: #252A2E;
  --ib-forest: #36584D;
  --ib-forest-dark: #2A463D;
  --ib-brass: #B18A4A;
  --ib-stone: #E6E0D3;
  --ib-mute: #4F555A;
  /* spacing scale */
  --s1: 8px; --s2: 12px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 64px; --s8: 96px;
  --ib-radius: 4px;
  --ib-border: 1px solid var(--ib-stone);
  --ib-serif: Newsreader, Georgia, "Times New Roman", serif;
  --ib-container: 1160px;
  --ib-gutter: 24px;
}
@media (max-width: 600px) { :root { --ib-gutter: 20px; } }

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a:focus-visible, button:focus-visible, .ib-card:focus-within { outline: 3px solid var(--ib-brass); outline-offset: 3px; }
.ib-card a:focus-visible { outline: none; }

.ib-wrap { max-width: var(--ib-container); margin-left: auto; margin-right: auto; padding-left: var(--ib-gutter); padding-right: var(--ib-gutter); box-sizing: content-box; }
.ib-section { padding-top: var(--s7); padding-bottom: var(--s7); }
.ib-section + .ib-section { padding-top: 0; }

/* ---------- Header ---------- */
.ib-header { border-bottom: var(--ib-border); }
.ib-header .ib-wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s3) var(--s5); flex-wrap: wrap; min-height: 72px; padding-top: var(--s2); padding-bottom: var(--s2); }
.ib-brand { font-family: var(--ib-serif); font-weight: 620; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--ib-charcoal); text-decoration: none; line-height: 1; }
.ib-brand:hover { color: var(--ib-charcoal); }
.ib-nav ul { display: flex; flex-wrap: wrap; gap: 0 var(--s4); margin: 0; padding: 0; list-style: none; }
.ib-nav a { display: inline-block; padding: var(--s2) 0; color: var(--ib-charcoal); text-decoration: none; font-size: 1rem; border-bottom: 2px solid transparent; }
.ib-nav a:hover { border-bottom-color: var(--ib-brass); }
.ib-nav a[aria-current="page"] { border-bottom-color: var(--ib-forest); }
@media (max-width: 600px) {
  .ib-header .ib-wrap { flex-direction: column; align-items: flex-start; gap: 0; padding-top: var(--s3); }
  .ib-nav ul { gap: 0 var(--s3); }
  .ib-nav a { padding: var(--s2) 0; min-height: 44px; box-sizing: border-box; }
}

.ib-brand-logo { display: block; line-height: 0; }
.ib-header .ib-brand-logo img { display: block; height: 64px; width: auto; }
.ib-footer .ib-brand-logo img { display: block; height: 64px; width: auto; }
@media (max-width: 600px) { .ib-header .ib-brand-logo img { height: 52px; } .ib-footer .ib-brand-logo img { height: 52px; } }

/* ---------- Hero ---------- */
.ib-hero { padding-top: var(--s7); padding-bottom: var(--s7); }
.ib-hero .ib-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s6); align-items: center; }
.ib-hero h1 { font-family: var(--ib-serif); font-weight: 520; font-size: clamp(2.5rem, 5.2vw, 4rem); line-height: 1.05; letter-spacing: -0.015em; margin: 0 0 var(--s4); max-width: 12ch; }
.ib-hero p { font-size: 1.1875rem; color: var(--ib-mute); max-width: 44ch; margin: 0 0 var(--s5); }
.ib-button { display: inline-block; background: var(--ib-forest); color: var(--ib-white); text-decoration: none; font-weight: 700; padding: 14px var(--s4); border-radius: var(--ib-radius); line-height: 1.2; }
.ib-button:hover { background: var(--ib-forest-dark); color: var(--ib-white); }
.ib-photo { margin: 0; border-radius: var(--ib-radius); overflow: hidden; background: var(--ib-stone); }
.ib-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ib-hero .ib-photo { aspect-ratio: 3 / 2; }
@media (max-width: 860px) {
  .ib-hero { padding-top: var(--s6); padding-bottom: var(--s6); }
  .ib-hero .ib-wrap { grid-template-columns: 1fr; gap: var(--s5); }
  .ib-hero .ib-photo { aspect-ratio: 3 / 2; }
}

/* ---------- Section headings ---------- */
.ib-section-head { margin: 0 0 var(--s5); max-width: 60ch; }
.ib-section-head h2 { font-family: var(--ib-serif); font-weight: 540; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; margin: 0 0 var(--s2); }
.ib-section-head p { margin: 0; color: var(--ib-mute); }

/* ---------- Instrument cards ---------- */
.ib-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.ib-card { position: relative; display: flex; flex-direction: column; background: var(--ib-white); border: var(--ib-border); border-radius: var(--ib-radius); overflow: hidden; transition: border-color .15s ease; }
.ib-card:hover { border-color: var(--ib-brass); }
.ib-card { grid-column: span 2; }
.ib-card-lead { grid-column: span 3; }
.ib-card-lead h3 { font-size: 1.75rem; }
.ib-card .ib-photo { aspect-ratio: 3 / 2; border-radius: 0; }
.ib-card-body { display: flex; flex-direction: column; flex: 1; padding: var(--s4); }
.ib-card h3 { font-family: var(--ib-serif); font-weight: 560; font-size: 1.5rem; line-height: 1.2; margin: 0 0 var(--s1); }
.ib-card p { margin: 0 0 var(--s4); font-size: 1rem; color: var(--ib-mute); }
.ib-card a { margin-top: auto; color: var(--ib-forest); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ib-card a::after { content: ""; position: absolute; inset: 0; }
@media (max-width: 1000px) { .ib-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ib-card, .ib-card-lead { grid-column: span 1; } .ib-card:last-child { grid-column: 1 / -1; } .ib-card:last-child .ib-photo { aspect-ratio: 16 / 7; } }
@media (max-width: 560px) {
  .ib-cards { grid-template-columns: 1fr; gap: var(--s3); }
  .ib-card, .ib-card-lead, .ib-card:last-child { grid-column: auto; }
  .ib-card:last-child .ib-photo { aspect-ratio: auto; }
  .ib-card-lead h3 { font-size: 1.3rem; }
  .ib-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .ib-card .ib-photo { aspect-ratio: auto; height: 100%; min-height: 112px; }
  .ib-card-body { padding: var(--s3); }
  .ib-card h3 { font-size: 1.3rem; }
  .ib-card p { margin-bottom: var(--s2); font-size: 0.97rem; }
}

/* ---------- Featured guides (hidden until a post exists) ---------- */
.ib-featured:not(:has(.wp-block-post)) { display: none; }
.ib-featured .wp-block-post-template { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-rows: auto 1fr; align-items: start; gap: var(--s4) var(--s5); margin: 0; padding: 0; list-style: none; }
.ib-featured .wp-block-post:first-child { grid-row: span 2; }
.ib-featured .wp-block-post-featured-image { margin: 0 0 var(--s3); border-radius: var(--ib-radius); overflow: hidden; }
.ib-featured .wp-block-post-featured-image img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.ib-featured .wp-block-post:not(:first-child) .wp-block-post-featured-image { display: none; }
.ib-featured .wp-block-post:not(:first-child) { border-top: var(--ib-border); padding-top: var(--s4); }
.ib-featured .wp-block-post-title { font-family: var(--ib-serif); font-weight: 560; margin: 0 0 var(--s1); font-size: 1.375rem; }
.ib-featured .wp-block-post:first-child .wp-block-post-title { font-size: 2rem; }
.ib-featured .wp-block-post-title a { color: var(--ib-charcoal); text-decoration: none; }
.ib-featured .wp-block-post-title a:hover { text-decoration: underline; text-decoration-color: var(--ib-brass); }
.ib-featured .wp-block-post-excerpt { color: var(--ib-mute); margin: 0; }
.ib-featured .wp-block-post-excerpt__excerpt { margin: 0; }
@media (max-width: 860px) { .ib-featured .wp-block-post-template { grid-template-columns: 1fr; } .ib-featured .wp-block-post:first-child { grid-row: auto; } }

/* ---------- Approach / trust ---------- */
.ib-approach .ib-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s6); padding-top: var(--s6); background: linear-gradient(var(--ib-charcoal), var(--ib-charcoal)) top left / 100% 1px no-repeat; background-origin: content-box; background-clip: content-box; }
.ib-approach .ib-wrap > * { padding-top: var(--s6); }
.ib-approach .ib-wrap { padding-top: 0; }
.ib-approach h2 { font-family: var(--ib-serif); font-weight: 540; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; margin: 0; max-width: 14ch; }
.ib-approach p { margin: 0 0 var(--s3); max-width: 60ch; }
.ib-approach p:last-child { margin-bottom: 0; }
@media (max-width: 860px) { .ib-approach .ib-wrap { grid-template-columns: 1fr; gap: var(--s4); } .ib-approach .ib-wrap > *:not(:first-child) { padding-top: 0; } }

/* ---------- Footer ---------- */
.ib-footer { border-top: var(--ib-border); margin-top: 0; padding-top: var(--s6); padding-bottom: var(--s6); font-size: 0.9375rem; }
.ib-footer .ib-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4) var(--s6); align-items: start; }
.ib-footer .ib-brand { font-size: 1.25rem; }
.ib-footer-about p { margin: var(--s2) 0 0; color: var(--ib-mute); max-width: 44ch; }
.ib-footer ul { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0; padding: 0; list-style: none; }
.ib-footer a { color: var(--ib-charcoal); }
.ib-footer .ib-copy { grid-column: 1 / -1; margin: 0; color: var(--ib-mute); }
@media (max-width: 600px) { .ib-footer .ib-wrap { grid-template-columns: 1fr; } }

/* ---------- Articles and pages ---------- */
.ib-article-head { padding-top: var(--s6); padding-left: var(--ib-gutter); padding-right: var(--ib-gutter); }
.ib-article-head h1 { font-family: var(--ib-serif); font-weight: 540; font-size: clamp(2.125rem, 4.4vw, 3rem); line-height: 1.1; margin: var(--s1) 0 var(--s3); }
.ib-meta { color: var(--ib-mute); font-size: 0.9375rem; display: flex; gap: var(--s3); flex-wrap: wrap; }
.ib-meta .wp-block-post-terms a { color: var(--ib-forest); font-weight: 700; text-decoration: none; }
.ib-feature { padding-left: var(--ib-gutter); padding-right: var(--ib-gutter); }
.ib-feature img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: var(--ib-radius); display: block; }
main > .ib-body { padding: var(--s5) var(--ib-gutter) var(--s6); }
.ib-body { font-size: 1.125rem; }
.ib-body h2 { margin-top: var(--s6); margin-bottom: var(--s3); }
.ib-body h3 { margin-top: var(--s5); margin-bottom: var(--s2); }
.ib-body table { border-collapse: collapse; width: 100%; font-size: 1rem; }
.ib-body th, .ib-body td { border-bottom: var(--ib-border); padding: var(--s2) var(--s2); text-align: left; vertical-align: top; }
.ib-body th { background: var(--ib-white); }
.ib-body .wp-block-table { overflow-x: auto; }
.ib-body img { border-radius: var(--ib-radius); }
.ib-body blockquote { border-left: 3px solid var(--ib-brass); margin-left: 0; padding-left: var(--s4); }

/* ---------- Archives ---------- */
.ib-archive-head { padding-top: var(--s6); padding-bottom: var(--s5); max-width: 60ch; }
.ib-archive-head h1 { font-family: var(--ib-serif); font-weight: 540; font-size: clamp(2.125rem, 4.4vw, 3rem); margin: 0 0 var(--s2); }
.ib-archive-head .wp-block-term-description { color: var(--ib-mute); }
.ib-archive-head .wp-block-term-description p { margin: 0; }
.ib-list .wp-block-post-template { gap: var(--s4); }
.ib-list .wp-block-post { background: var(--ib-white); border: var(--ib-border); border-radius: var(--ib-radius); overflow: hidden; padding-bottom: var(--s4); }
.ib-list .wp-block-post-featured-image { margin: 0 0 var(--s3); }
.ib-list .wp-block-post-featured-image img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.ib-list .wp-block-post-title, .ib-list .wp-block-post-excerpt { padding-left: var(--s4); padding-right: var(--s4); }
.ib-list .wp-block-post-title { font-family: var(--ib-serif); font-weight: 560; font-size: 1.375rem; margin: 0 0 var(--s1); }
.ib-list .wp-block-post-title a { color: var(--ib-charcoal); text-decoration: none; }
.ib-list .wp-block-post-excerpt { color: var(--ib-mute); margin: 0; }
.ib-empty { border-left: 3px solid var(--ib-brass); padding: var(--s1) 0 var(--s1) var(--s4); max-width: 60ch; }
.ib-empty p { margin: 0 0 var(--s2); }
.ib-empty p:last-child { margin: 0; }

.ib-404 { padding-top: var(--s7); padding-bottom: var(--s8); }
.ib-404 h1 { font-family: var(--ib-serif); font-weight: 540; }

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