/*
Theme Name: Tinnitus Explained
Theme URI: https://tinnitusexplained.com
Author: Tinnitus Explained
Description: Editorial theme for Tinnitus Explained. Built around an audio-engineering visual language: a quiet ground, IBM Plex typography, and an audiogram as the site's signature graphic. Rust is reserved for meaning (the 4 kHz notch, medical red flags), never decoration.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tinnitus-explained
*/

:root{
  --ground:#EEF1EE;
  --surface:#FFFFFF;
  --ink:#141A18;
  --muted:#5B6764;
  --line:#D3D9D4;
  --line-soft:#E2E7E3;
  --accent:#35564C;
  --accent-soft:#E5EDE9;
  --signal:#B4503A;--signal-ink:#9A412D;
  --signal-soft:#F7EAE6;
  --serif:"IBM Plex Serif","Plex Serif Fallback",Georgia,"Times New Roman",serif;
  --sans:"IBM Plex Sans","Plex Sans Fallback","Helvetica Neue",Arial,sans-serif;
  --mono:"IBM Plex Mono","Plex Mono Fallback","SF Mono",Menlo,Consolas,monospace;
  --col:37rem;
  --wide:70rem;
}
@media (prefers-color-scheme:dark){
  :root{
    --ground:#0E1211;
    --surface:#151A19;
    --ink:#E4E9E6;
    --muted:#94A19D;
    --line:#283230;
    --line-soft:#1E2523;
    --accent:#84AC9D;
    --accent-soft:#1B2724;
    --signal:#DC8469;
    --signal-soft:#2A1C18;
  }
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  background:var(--ground);
  color:var(--ink);
  font-family:var(--sans);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
img{max-width:100%;height:auto;display:block}
a{color:var(--accent)}
a:focus-visible,button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
h1,h2,h3,h4{font-family:var(--serif);text-wrap:balance;margin:0;font-weight:600;letter-spacing:-.011em}
p{margin:0}
.skip-link{position:absolute;left:-9999px}
.skip-link:focus{left:.5rem;top:.5rem;z-index:99;background:var(--surface);padding:.5rem .75rem;border:1px solid var(--accent)}

.lbl{font-family:var(--mono);font-size:.6875rem;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.shell{max-width:var(--wide);margin:0 auto;background:var(--surface);border-left:1px solid var(--line);border-right:1px solid var(--line);min-height:100vh}

/* ---------- header ---------- */
.site-head{display:flex;align-items:center;justify-content:space-between;gap:2rem;padding:1.125rem 2.25rem;border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:.625rem;font-family:var(--serif);font-size:1.0625rem;font-weight:600;letter-spacing:-.01em;text-decoration:none;color:var(--ink)}
.brand svg{display:block;flex:none}
.nav-main ul{display:flex;gap:1.5rem;list-style:none;margin:0;padding:0;flex-wrap:wrap}
.nav-main a{font-size:.8125rem;color:var(--muted);text-decoration:none}
.nav-main a:hover,.nav-main .current-menu-item > a{color:var(--accent)}
.nav-toggle{display:none;background:none;border:1px solid var(--line);color:var(--ink);font-family:var(--mono);font-size:.6875rem;letter-spacing:.12em;text-transform:uppercase;padding:.4375rem .75rem;cursor:pointer}

/* ---------- hero ---------- */
.hero{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:3.5rem;align-items:center;padding:4rem 2.25rem 3.75rem;border-bottom:1px solid var(--line)}
.hero h1{font-size:clamp(2rem,3.6vw,2.9rem);line-height:1.12}
.hero .dek{margin-top:1.25rem;font-family:var(--serif);font-size:1.0625rem;line-height:1.65;color:var(--muted);max-width:32rem}
.hero .eyebrow{margin-bottom:1.125rem;display:block}
.byline-card{margin-top:2rem;padding-top:1.25rem;border-top:1px solid var(--line-soft);display:flex;gap:.875rem;align-items:flex-start;max-width:30rem}
.byline-card .rule{width:2px;background:var(--accent);align-self:stretch;flex:none}
.byline-card p{font-size:.8125rem;line-height:1.55;color:var(--muted)}
.byline-card strong{color:var(--ink);font-weight:600}
.byline-card a{color:inherit}

/* ---------- audiogram ---------- */
.audiogram{background:var(--ground);border:1px solid var(--line);padding:1.5rem 1.5rem 1.125rem;margin:0}
.audiogram figcaption{margin-top:1rem;font-size:.75rem;line-height:1.5;color:var(--muted)}
.audiogram figcaption b{font-family:var(--mono);font-weight:500;color:var(--signal-ink);font-size:.7188rem}
.ag-grid{stroke:var(--line);stroke-width:1}
.ag-axis{fill:var(--muted);font-family:"IBM Plex Mono",monospace;font-size:9px;letter-spacing:.04em}
.ag-band{fill:var(--accent-soft)}
.ag-curve{fill:none;stroke:var(--accent);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ag-dot{fill:var(--surface);stroke:var(--accent);stroke-width:2}
.ag-notch{fill:var(--signal)}
.ag-drop{stroke:var(--signal);stroke-width:1.5;stroke-dasharray:3 3}
.ag-note{fill:var(--signal);font-family:"IBM Plex Mono",monospace;font-size:10px;letter-spacing:.02em}
@media (prefers-reduced-motion:no-preference){
  .ag-curve{stroke-dasharray:640;stroke-dashoffset:640;animation:ag-draw 1.6s cubic-bezier(.22,.61,.36,1) .15s forwards}
  .ag-dot,.ag-notch,.ag-drop,.ag-note{opacity:0;animation:ag-fade .5s ease 1.35s forwards}
}
@keyframes ag-draw{to{stroke-dashoffset:0}}
@keyframes ag-fade{to{opacity:1}}

/* ---------- hubs ---------- */
.hubs{padding:3.5rem 2.25rem 1rem}
.hubs > .lbl{display:block;margin-bottom:.25rem}
.hubs > h2{font-size:1.5rem;margin-bottom:2rem;max-width:26rem}
.hub{display:grid;grid-template-columns:8.5rem minmax(0,1fr);gap:2rem;padding:1.75rem 0;border-top:1px solid var(--line-soft)}
.hub:last-of-type{border-bottom:1px solid var(--line-soft)}
.hub-meta .lbl{display:block;color:var(--accent)}
.hub-meta .count{font-family:var(--mono);font-size:.75rem;color:var(--muted);margin-top:.375rem;display:block;font-variant-numeric:tabular-nums}
.hub h3{font-size:1.0625rem;margin-bottom:.5rem}
.hub h3 a{color:inherit;text-decoration:none}
.hub h3 a:hover{color:var(--accent)}
.hub-desc{font-size:.875rem;color:var(--muted);max-width:38rem}
.hub ul{margin:.875rem 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:.375rem}
.hub li{font-family:var(--serif);font-size:.9375rem;line-height:1.45}
.hub li a{color:inherit;text-decoration:none}
.hub li a:hover{color:var(--accent);text-decoration:underline;text-underline-offset:3px}
.hub li::before{content:"";display:inline-block;width:.5rem;height:1px;background:var(--accent);vertical-align:middle;margin-right:.625rem;margin-bottom:.1875rem}

/* ---------- trust strip ---------- */
.trust{margin-top:3.25rem;padding:2rem 2.25rem;border-top:1px solid var(--line);background:var(--ground);display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2rem}
.trust h3{font-family:var(--sans);font-size:.8125rem;font-weight:600;margin:0 0 .4375rem}
.trust p{font-size:.8125rem;color:var(--muted);line-height:1.55}

/* ---------- article ---------- */
.art{padding:3.25rem 2.25rem 3rem}
.art-head{max-width:var(--col);margin:0 auto}
.crumb{display:flex;gap:.5rem;align-items:center;margin-bottom:1.5rem;flex-wrap:wrap}
.crumb a{color:var(--muted);text-decoration:none}
.crumb a:hover{color:var(--accent)}
.crumb .sep{color:var(--line)}
.art h1{font-size:clamp(1.75rem,2.9vw,2.3rem);line-height:1.18;margin-bottom:1.5rem}
.art-by{display:flex;flex-wrap:wrap;gap:.5rem .75rem;align-items:center;padding-bottom:1.75rem;border-bottom:1px solid var(--line);margin-bottom:2rem}
.art-by .dot{width:3px;height:3px;border-radius:50%;background:var(--line);flex:none}
.art-by a{color:inherit;text-decoration:none}
.art-by a:hover{color:var(--accent)}
.disclosure{max-width:var(--col);margin:0 auto 2rem;padding:.75rem 1rem;border:1px solid var(--line);font-size:.75rem;color:var(--muted);line-height:1.5}
.disclosure b{color:var(--ink);font-weight:600}
.featured{max-width:var(--wide);margin:0 auto 2rem}
.featured img{width:100%;aspect-ratio:16/9;height:auto}
.featured figcaption{font-size:.75rem;color:var(--muted);margin-top:.5rem}

.entry-content{max-width:var(--col);margin:0 auto;font-family:var(--serif);font-size:1.0625rem;line-height:1.72}
.entry-content > p{margin-bottom:1.25rem}
.entry-content h2{font-size:1.3125rem;margin:2.5rem 0 1rem}
.entry-content h3{font-size:1.125rem;margin:2rem 0 .75rem}
.entry-content ul,.entry-content ol{margin:0 0 1.25rem;padding-left:1.25rem;display:flex;flex-direction:column;gap:.4375rem}
.entry-content a{color:var(--accent);text-underline-offset:3px}
.entry-content blockquote{margin:1.75rem 0;padding-left:1.25rem;border-left:2px solid var(--line);color:var(--muted);font-style:italic}
.entry-content table{width:100%;border-collapse:collapse;font-family:var(--sans);font-size:.875rem}
.entry-content th,.entry-content td{border:1px solid var(--line);padding:.625rem .75rem;text-align:left}
.entry-content th{background:var(--ground);font-weight:600}
.table-scroll{overflow-x:auto;margin-bottom:1.25rem}

/* editorial components emitted by the publisher */
.answer{border-left:2px solid var(--accent);background:var(--accent-soft);padding:1.125rem 1.375rem;margin-bottom:1.5rem}
.answer p{font-family:var(--serif);font-size:1.0625rem;line-height:1.55;font-weight:500;margin:0}
.flag{border:1px solid var(--signal);background:var(--signal-soft);padding:1.125rem 1.25rem;margin:1.75rem 0}
.flag .lbl{color:var(--signal-ink);display:block;margin-bottom:.625rem}
.flag ul{margin:0;padding-left:1.125rem;font-size:.9375rem;line-height:1.6;display:flex;flex-direction:column;gap:.3125rem}
.src{margin-top:2.5rem;padding-top:1.25rem;border-top:1px solid var(--line);font-family:var(--sans);font-size:.8125rem;color:var(--muted)}
.src h2,.src h3,.src h4{font-size:.8125rem;margin:0 0 .5rem;font-family:var(--sans);font-weight:600;color:var(--ink)}
.src ol{margin:0;padding-left:1.125rem;display:flex;flex-direction:column;gap:.375rem}

.next{max-width:var(--col);margin:2.5rem auto 0;border:1px solid var(--line);padding:1.25rem 1.375rem}
.next .lbl{display:block;margin-bottom:.5rem}
.next a{font-family:var(--serif);font-size:1.0625rem;font-weight:500;text-decoration:none;display:block;line-height:1.4;color:var(--ink)}
.next a:hover{color:var(--accent)}
.related{max-width:var(--col);margin:1rem auto 0;display:grid;gap:.5rem}
.related .lbl{display:block;margin-bottom:.25rem}
.related a{font-family:var(--serif);font-size:.9375rem;text-decoration:none;color:var(--ink);line-height:1.45}
.related a:hover{color:var(--accent)}

.author-box{max-width:var(--col);margin:2.5rem auto 0;padding:1.375rem;background:var(--ground);border:1px solid var(--line);display:flex;gap:1rem;align-items:flex-start}
.author-box .rule{width:2px;background:var(--accent);align-self:stretch;flex:none}
.author-box h2{font-family:var(--sans);font-size:.8125rem;font-weight:600;margin:0 0 .375rem}
.author-box p{font-size:.8125rem;color:var(--muted);line-height:1.6}
.author-box .author-photo,.byline-card .author-photo{width:72px;height:72px;flex:none;display:block;object-fit:cover;border:1px solid var(--line)}
@media(max-width:600px){.author-box .author-photo,.byline-card .author-photo{width:56px;height:56px}}

/* ---------- archive / list ---------- */
.archive-head{padding:3.25rem 2.25rem 1.5rem;border-bottom:1px solid var(--line)}
.archive-head h1{font-size:clamp(1.625rem,2.6vw,2.1rem);line-height:1.2;max-width:34rem}
.archive-head .lbl{display:block;margin-bottom:.75rem}
.archive-head .desc{margin-top:1rem;font-family:var(--serif);font-size:1rem;color:var(--muted);max-width:38rem}
.post-list{padding:.5rem 2.25rem 2.5rem}
.post-row{display:grid;grid-template-columns:8.5rem minmax(0,1fr);gap:2rem;padding:1.5rem 0;border-bottom:1px solid var(--line-soft)}
.post-row .meta .lbl{display:block}
.post-row h2{font-size:1.125rem;line-height:1.35;margin-bottom:.4375rem}
.post-row h2 a{color:inherit;text-decoration:none}
.post-row h2 a:hover{color:var(--accent)}
.post-row p{font-size:.875rem;color:var(--muted);max-width:40rem}
.pagination{display:flex;gap:.75rem;padding:1.5rem 2.25rem 3rem;font-family:var(--mono);font-size:.75rem}
.pagination .page-numbers{padding:.375rem .625rem;border:1px solid var(--line);text-decoration:none;color:var(--muted)}
.pagination .current{border-color:var(--accent);color:var(--accent)}

/* ---------- page ---------- */
.page-wrap{padding:3.25rem 2.25rem 3rem}
.page-wrap .art-head h1{margin-bottom:1rem}

/* ---------- footer ---------- */
.site-foot{padding:2rem 2.25rem;border-top:1px solid var(--line);display:flex;justify-content:space-between;gap:2rem;flex-wrap:wrap;font-size:.75rem;color:var(--muted)}
.site-foot ul{display:flex;gap:1.125rem;flex-wrap:wrap;list-style:none;margin:0;padding:0}
.site-foot a{color:var(--muted);text-decoration:none}
.site-foot a:hover{color:var(--accent)}
.foot-note{max-width:var(--col);font-size:.75rem;line-height:1.55}

@media (max-width:860px){
  .shell{border:0}
  .hero{grid-template-columns:1fr;gap:2.5rem;padding:2.75rem 1.5rem}
  .hub,.post-row{grid-template-columns:1fr;gap:.75rem}
  .trust{grid-template-columns:1fr;gap:1.5rem}
  .site-head,.hubs,.art,.page-wrap,.site-foot,.archive-head,.post-list,.pagination,.trust{padding-left:1.5rem;padding-right:1.5rem}
  .nav-main{display:none;width:100%}
  .nav-main.is-open{display:block}
  .nav-main ul{flex-direction:column;gap:.75rem;padding-top:1rem}
  .site-head{flex-wrap:wrap}
  .nav-toggle{display:block}
}
