/*
Theme Name: The Renter Ledger
Description: An editorial WordPress theme for US renter guides and calculators.
Version: 1.1.0
Requires PHP: 8.0
Text Domain: renter-ledger
*/

:root {
    --ground: #1c1c1c;
    --surface: #262626;
    --ink: #f1f1ef;
    --muted: #b9bcb5;
    --sage: #acbda8;
    --sage-dark: #25352a;
    --paper: #e1e6e2;
    --dark-ink: #202822;
    --measure: min(88vw, 1360px);
    --serif: Georgia, Cambria, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 17px/1.58 var(--sans); }
.wrap { width: var(--measure); margin-inline: auto; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--sage); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
img { display: block; width: 100%; height: auto; }
figure { margin: 0; }
p { margin: 0 0 1rem; text-wrap: pretty; }
h1, h2, h3 { margin: 0; line-height: 1.04; text-wrap: balance; font-family: var(--serif); font-weight: 400; letter-spacing: -.045em; }
h1 { font-size: clamp(2.65rem, 6.8vw, 6rem); }
h2 { font-size: clamp(2.1rem, 4.2vw, 4.2rem); }
h3 { font-size: clamp(1.3rem, 2.1vw, 2rem); }
.skip { position: absolute; top: 12px; left: 12px; z-index: 20; padding: .5rem 1rem; background: var(--paper); color: var(--dark-ink); transform: translateY(-200%); }
.skip:focus { transform: none; }

.masthead { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.wordmark { display: inline-flex; gap: .7rem; align-items: center; text-decoration: none; white-space: nowrap; font-size: clamp(.95rem, 2.1vw, 1.22rem); font-weight: 650; letter-spacing: -.045em; }
.keymark { display: inline-block; width: 16px; height: 20px; border: 1.5px solid var(--sage); position: relative; }
.keymark::after { content: ""; position: absolute; background: var(--sage); width: 3px; height: 3px; right: 3px; top: 8px; }
.masthead nav, .footer-top nav, .library-nav { display: flex; align-items: center; flex-wrap: wrap; column-gap: clamp(1.1rem, 3vw, 3rem); row-gap: .5rem; font-size: .94rem; }
.masthead nav a, .footer-top nav a { text-decoration: none; }
.masthead nav a:hover, .footer-top nav a:hover { text-decoration: underline; }
.nav-tool { color: var(--sage); }

.hero { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: auto 1fr; column-gap: 1.2rem; align-items: center; padding: clamp(34px, 6vw, 95px) 0 clamp(52px, 8vw, 125px); min-height: 550px; }
.hero-photo { grid-column: 5 / -1; grid-row: 1 / span 2; align-self: stretch; min-height: 390px; background: var(--surface); }
.hero-photo img { width: 100%; height: 100%; aspect-ratio: 1.65; object-fit: cover; object-position: 49% 56%; }
.hero-copy { grid-column: 1 / 7; grid-row: 1 / span 2; justify-self: start; padding: clamp(24px, 4vw, 56px) clamp(16px, 3vw, 48px) clamp(24px, 4vw, 56px) 0; background: var(--ground); position: relative; }
.hero-copy h1 { max-width: 12ch; }
.hero-copy p { max-width: 35ch; margin: 1.55rem 0 1.65rem; color: var(--muted); font-size: clamp(1.05rem, 1.65vw, 1.27rem); }
.button-main { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 650; background: var(--sage); color: var(--dark-ink); padding: .83rem 1.24rem; min-height: 44px; transition: background-color .18s; }
.button-main:hover { color: var(--dark-ink); background: var(--paper); }

.tool-section { background: var(--sage); color: var(--dark-ink); padding: clamp(48px, 7vw, 100px) 0; scroll-margin: 24px; }
.tool-layout { display: grid; grid-template-columns: .73fr 1.27fr; gap: clamp(38px, 7vw, 105px); align-items: start; }
.tool-layout h2 { max-width: 11ch; }
.tool-layout p { max-width: 33ch; margin-top: 1.35rem; }
.inline-link { font-weight: 600; }
.tool-layout a:hover { color: #344a38; }
.tool-photo { margin-top: 2rem; width: 64%; aspect-ratio: 1.45; overflow: hidden; }
.tool-photo img { height: 100%; object-fit: cover; object-position: center 48%; }
.ledger-calculator { background: var(--sage-dark); color: var(--ink); padding: clamp(20px, 4vw, 48px); margin: 0; width: 100%; }
.calc-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1.2rem; }
.calc-fields label { display: grid; grid-template-rows: 1fr auto; gap: .3rem; min-width: 0; font-size: .92rem; line-height: 1.35; }
.money-input { display: flex; align-items: center; gap: .45rem; padding: .35rem .56rem; background: var(--paper); color: var(--dark-ink); border: 1px solid transparent; }
.money-input:focus-within { outline: 2px solid var(--paper); outline-offset: 2px; }
.money-input input { width: 100%; background: transparent; color: inherit; border: 0; min-width: 0; font: inherit; padding: .29rem .1rem; outline: none; font-variant-numeric: tabular-nums; }
.calc-result { display: grid; gap: .1rem; margin-top: 1.5rem; }
.calc-result p { margin: 0; color: var(--sage); }
.calc-result output { font: 400 clamp(2rem, 4.8vw, 3.6rem)/1.05 var(--serif); font-variant-numeric: tabular-nums; }
.calc-result small { margin-top: .45rem; display: block; color: var(--muted); font-size: .85rem; }

.library { padding: clamp(56px, 8vw, 125px) 0; }
.library > h2 { max-width: 19ch; }
.library-nav { margin: 1.55rem 0 2.5rem; color: var(--sage); }
.guide-section { display: grid; grid-template-columns: .73fr 1.27fr; gap: clamp(36px, 7vw, 104px); padding: clamp(28px, 5vw, 73px) 0; scroll-margin: 20px; }
.topic-intro h2 { font-size: clamp(2rem, 4vw, 3.8rem); }
.topic-intro p { color: var(--muted); margin: .9rem 0 1.36rem; max-width: 33ch; }
.topic-intro figure { width: 74%; aspect-ratio: 1.38; overflow: hidden; }
.topic-intro img { height: 100%; object-fit: cover; }
.guide-section:nth-of-type(2) figure { width: 58%; aspect-ratio: .87; margin-left: 12%; }
.guide-section:nth-of-type(3) figure { width: 89%; aspect-ratio: 1.95; }
.guide-list, .archive-list { display: grid; gap: .12rem; }
.guide-row { background: var(--surface); padding: clamp(14px, 2.7vw, 25px) clamp(14px, 2.9vw, 32px); }
.guide-row h3 a { text-decoration: none; }
.guide-row h3 a:hover { text-decoration: underline; }
.deck { color: var(--muted); font-size: 1rem; margin: .55rem 0 0; max-width: 62ch; }

.site-footer { padding: clamp(28px, 6vw, 80px) 0 1rem; background: var(--paper); color: var(--dark-ink); }
.footer-top { display: flex; align-items: start; justify-content: space-between; gap: 1.4rem; padding-bottom: clamp(30px, 5vw, 76px); }
.footer-top p { max-width: 38ch; }
.footer-top nav a:hover, .footer-brand:hover { color: #455f49; }
.footer-brand { display: block; text-decoration: none; font: 400 clamp(2.4rem, 10.15vw, 9rem)/1.02 var(--serif); letter-spacing: -.08em; }

.inner { padding: clamp(26px, 6vw, 82px) 0 clamp(50px, 9vw, 132px); }
.article-head { width: min(100%, 820px); margin: 0 auto 1.75rem; }
.article-head h1 { font-size: clamp(2.25rem, 5.6vw, 5rem); max-width: 20ch; }
.breadcrumb, .byline { color: var(--sage); font-size: .88rem; }
.article-deck { margin: 1rem 0; max-width: 50ch; color: var(--muted); font-size: clamp(1.03rem, 2.1vw, 1.34rem); }
.article-photo { width: min(100%, 1060px); margin: 0 auto clamp(29px, 5vw, 70px); }
.article-photo img { aspect-ratio: 2.65; object-fit: cover; object-position: center; }
.article-body { width: min(100%, 820px); margin-inline: auto; }
.article-body h2 { margin: 2.2rem 0 .75rem; font-size: clamp(1.7rem, 3vw, 2.65rem); }
.article-body table { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 1.2rem 0; text-align: left; overflow-wrap: anywhere; }
.article-body th, .article-body td { padding: .55rem .65rem; vertical-align: top; border: 1px solid #5b6159; }
.article-body th { background: var(--surface); font-weight: 600; }
.article-body li { margin: .5rem 0; }
.article-body ul, .article-body ol { padding-inline-start: 1.45rem; }
.article-body a { color: var(--sage); }
.article-body .ledger-calculator { margin: 1.35rem 0 1.8rem; }
.archive-list { max-width: 840px; margin-top: 1.8rem; }
.pagination { margin-top: 1rem; }

@media (max-width: 850px) {
    .hero { gap: 0; min-height: auto; }
    .hero-copy { grid-column: 1 / 8; }
    .hero-photo { min-height: 295px; }
    .tool-layout, .guide-section { grid-template-columns: .8fr 1.2fr; gap: 5vw; }
}

@media (max-width: 650px) {
    :root { --measure: 90vw; }
    .masthead { min-height: auto; padding: 1rem 0; display: grid; gap: .75rem; }
    .masthead nav { justify-content: flex-start; }
    .hero { display: flex; flex-direction: column-reverse; align-items: stretch; padding-top: 10px; }
    .hero-copy { padding: 1.25rem 0 1.55rem; }
    .hero-copy h1 { max-width: 18ch; }
    .hero-copy p { margin: .8rem 0 1.1rem; }
    .hero-photo { min-height: 0; }
    .hero-photo img { height: auto; aspect-ratio: 1.48; }
    .tool-layout, .guide-section { grid-template-columns: minmax(0, 1fr); gap: 1.35rem; }
    .tool-layout h2 { max-width: 13ch; }
    .tool-photo { margin-top: 1.25rem; width: 55%; margin-left: auto; }
    .calc-fields { gap: .72rem; }
    .library-nav { margin: 1.2rem 0 1.4rem; }
    .guide-section { padding: 1.8rem 0; }
    .guide-section:nth-of-type(2) figure { aspect-ratio: 1.2; margin-left: auto; }
    .guide-section:nth-of-type(3) figure { width: 77%; }
    .topic-intro figure { width: 68%; max-height: 190px; }
    .footer-top { display: grid; gap: .5rem; }
    .article-photo img { aspect-ratio: 1.75; }
}

@media (max-width: 345px) {
    .calc-fields { grid-template-columns: minmax(0, 1fr); }
    .article-body th, .article-body td { padding: .35rem; font-size: .9rem; }
}

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

@media (prefers-reduced-motion: no-preference) {
    @keyframes ledger-arrive {
        from { transform: translateY(10px); opacity: .84; }
        to { transform: translateY(0); opacity: 1; }
    }
    .hero-copy { animation: ledger-arrive .42s ease-out both; }
    @supports (animation-timeline: view()) {
        .topic-intro figure { animation: ledger-arrive linear both; animation-timeline: view(); animation-range: entry 0% cover 22%; }
    }
}

/* Publication layout. The established article and calculator components share these tokens. */
:root {
    color-scheme: light;
    --ground: #f5f7f3;
    --paper: #fff;
    --surface: #eaf0e9;
    --ink: #172e2b;
    --dark-ink: #172e2b;
    --muted: #4a625d;
    --sage: #2c6559;
    --sage-dark: #183d37;
    --measure: min(90vw, 1270px);
    --lime: #dcebb1;
    --edge: #ccd9d1;
}
.news-header { background: var(--paper); }
.news-masthead { display: flex; align-items: center; gap: clamp(1rem, 4vw, 3rem); min-height: 83px; padding-block: .7rem; }
.mast-brand, .footer-id { display: inline-flex; align-items: center; gap: .72rem; text-decoration: none; font-family: var(--serif); font-weight: 700; letter-spacing: -.045em; }
.mast-brand { font-size: clamp(1.42rem, 2.55vw, 2.06rem); max-width: 100%; }
.mast-brand img, .footer-id img { width: 46px; height: 46px; flex: 0 0 46px; }
.mast-description { margin: 0 auto 0 0; color: var(--muted); font-size: .92rem; }
.mast-action { background: var(--lime); color: var(--dark-ink); text-decoration: none; font-weight: 650; padding: .65rem 1rem; text-align: center; }
.mast-action:hover { color: var(--dark-ink); background: #cce0ab; }
.news-nav { background: #17332f; color: #f4fbf1; }
.news-menu { margin: 0; padding: .25rem 0; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0 clamp(.95rem, 3vw, 2.65rem); }
.news-menu a { display: block; padding: .73rem 0; text-decoration: none; font-weight: 550; font-size: .95rem; }
.news-menu a:hover, .news-menu .current-menu-item a { color: var(--lime); text-decoration: underline; text-underline-offset: .3em; }

.news-home { padding-bottom: clamp(40px, 6vw, 96px); }
.news-opening { padding-top: clamp(26px, 4.3vw, 60px); }
.edition { margin-bottom: clamp(19px, 3.2vw, 42px); }
.edition h1 { font-size: clamp(2.5rem, 8vw, 7.2rem); letter-spacing: -.075em; line-height: .98; }
.edition p { margin: .65rem 0 0; font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--muted); }
.feature-layout { display: grid; grid-template-columns: minmax(0, 1.78fr) minmax(260px, 1fr); align-items: start; gap: clamp(16px, 2.8vw, 42px); }
.lead-story { background: var(--paper); border: 1px solid var(--edge); }
.story-image { display: block; overflow: hidden; background: var(--surface); }
.story-image img { display: block; aspect-ratio: 1.7; height: auto; object-fit: cover; }
.lead-story .story-image img { aspect-ratio: 2.35; }
.lead-copy { padding: clamp(17px, 3.1vw, 39px); }
.story-topic { color: var(--sage); font-size: .92rem; font-weight: 690; margin-bottom: .55rem; }
.lead-copy h2 { font-size: clamp(2rem, 4.5vw, 4.1rem); margin-bottom: .65rem; }
.lead-copy h2 a, .story-body h4 a { text-decoration: none; }
.lead-copy p:not(.story-topic), .story-body p { color: var(--muted); }
.story-link { font-weight: 650; }
.featured-sidebar { padding: clamp(15px, 2.2vw, 28px); background: var(--surface); }
.featured-sidebar > h2 { font-size: clamp(1.75rem, 3vw, 2.35rem); margin-bottom: 1rem; }
.featured-sidebar > div + div { margin-top: .9rem; }
.story-card { border: 1px solid var(--edge); background: var(--paper); min-width: 0; }
.story-card:hover { border-color: #8aa79b; }
.story-body { padding: clamp(14px, 2vw, 22px); }
.story-body h4 { font-size: clamp(1.22rem, 2.25vw, 1.8rem); font-weight: 400; line-height: 1.15; font-family: var(--serif); letter-spacing: -.035em; margin: 0; text-wrap: pretty; }
.story-body h4 a:hover { text-decoration: underline; }
.story-body p { margin: .55rem 0 0; font-size: 1rem; }
.story-compact { display: grid; grid-template-columns: 40% minmax(0, 1fr); align-items: stretch; }
.story-compact .story-image img { min-height: 89px; height: 100%; aspect-ratio: 1.52; }
.story-compact .story-body { padding: .7rem .65rem; align-self: center; }
.story-compact h4 { font-size: clamp(1.08rem, 1.75vw, 1.45rem); }

.tools-banner { margin-block: clamp(28px, 5vw, 66px); padding: clamp(17px, 3.4vw, 43px); display: grid; align-items: center; grid-template-columns: minmax(0, 1.2fr) minmax(185px, .8fr); gap: 1.15rem; background: #234942; color: #f4fbf1; }
.tools-banner h2 { font-size: clamp(1.9rem, 3.5vw, 3.36rem); margin-bottom: .65rem; }
.tools-banner p { margin: 0; }
.tools-actions { display: grid; justify-items: start; gap: .55rem; justify-self: end; }
.tools-actions a:hover { color: var(--lime); }
.button-main { background: var(--lime); color: var(--dark-ink); font-size: .98rem; }
.button-main:hover, .tools-actions .button-main:hover { background: var(--paper); color: var(--dark-ink); }

.library-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: .6rem 1.2rem; }
.library-header h2 { font-size: clamp(2rem, 4.6vw, 4rem); }
.topic-jumps { display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--sage); font-size: .95rem; }
.topic-block { margin-top: clamp(26px, 4.5vw, 59px); scroll-margin: 12px; }
.topic-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .4rem 1.1rem; margin-bottom: 1rem; }
.topic-header h3 { font-size: clamp(1.7rem, 3.4vw, 2.8rem); }
.topic-header p { margin: .35rem 0 0; color: var(--muted); }
.topic-header a { color: var(--sage); }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2.35vw, 32px); }
.archive-grid { margin-top: 1.4rem; }
.archive-intro { margin-top: .75rem; color: var(--muted); }

.news-footer { background: #17332f; color: #f4fbf1; padding: clamp(27px, 5vw, 62px) 0 1.1rem; }
.news-footer-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) repeat(3, minmax(0, 1fr)); gap: clamp(14px, 3.1vw, 38px); }
.footer-id { font-size: clamp(1.2rem, 2.55vw, 1.75rem); }
.news-footer-grid > div p { color: #d2e0d7; margin: .8rem 0 0; max-width: 29ch; }
.news-footer-grid nav { display: grid; gap: .43rem; align-content: start; }
.news-footer-grid nav p { margin: 0 0 .2rem; font-weight: 700; }
.news-footer-grid nav a { color: #d2e0d7; text-decoration: none; font-size: .96rem; }
.news-footer a:hover { color: var(--lime); text-decoration: underline; }
.news-legal { color: #d2e0d7; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; border-top: 1px solid #62847b; margin-top: 2rem; padding-top: .9rem; font-size: .87rem; }

.article-body table th { background: var(--surface); }
.article-body table :is(th,td) { border-color: var(--edge); }
.article-photo img { aspect-ratio: 2.1; }
.reviewed-line { color: var(--muted); font-size: .9rem; }
.reviewed-line a { margin-left: .45rem; }
.article-body .wp-block-image { margin: clamp(24px, 4.2vw, 56px) 0; }
.article-body .wp-block-image img { background: var(--surface); }
.article-body .review-end img { aspect-ratio: 2; object-fit: cover; }
.article-body figcaption { margin: .55rem 0 0; color: var(--muted); font-size: .94rem; }
.ledger-calculator { color: #f4fbf1; }
.calc-result p { color: #e4f0d1; }
.calc-result small { color: #ccdcd3; }
.ledger-contact { display: grid; gap: 1rem; padding: clamp(18px, 3.5vw, 38px); background: var(--surface); }
.ledger-contact label { display: grid; gap: .35rem; }
.ledger-contact :is(input, textarea) { width: 100%; border: 1px solid #67877b; color: var(--ink); background: #fff; padding: .65rem; font: inherit; }
.ledger-contact button { justify-self: start; border: 0; }
.contact-honey { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 850px) {
    .mast-description { display: none; }
    .mast-action { margin-left: auto; }
    .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .news-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.55rem; }
}
@media (max-width: 640px) {
    .news-masthead { min-height: 63px; gap: .45rem; padding-block: .55rem; }
    .mast-brand { font-size: 1.2rem; gap: .45rem; }
    .mast-brand img { width: 34px; height: 34px; flex-basis: 34px; }
    .mast-action { font-size: .82rem; padding: .55rem .45rem; }
    .news-menu { column-gap: 1rem; padding-block: .3rem; }
    .news-menu a { font-size: .88rem; padding: .42rem 0; }
    .feature-layout, .tools-banner { grid-template-columns: minmax(0, 1fr); }
    .lead-story .story-image img { aspect-ratio: 1.8; }
    .tools-actions { justify-self: start; }
    .story-body p { font-size: .96rem; }
}
@media (max-width: 420px) {
    .story-grid { grid-template-columns: minmax(0, 1fr); }
    .story-grid .story-image img { aspect-ratio: 1.92; }
    .news-footer-grid { gap: 1.2rem; }
    .news-footer-grid > div { grid-column: 1 / -1; }
    .article-photo img { aspect-ratio: 1.5; }
}
