/*
Theme Name: WP Rookies Restored
Description: Clean native rendering of the retained WP Rookies magazine layout.
Version: 0.1.0
Requires at least: 7.1
Requires PHP: 8.3
Text Domain: wprookies-restored
*/

/* Values follow the retained Good News visual settings. Font files are local. */
:root {
  --wr-blue: #1193f6;
  --wr-blue-dark: #0876cb;
  --wr-ink: #181818;
  --wr-muted: #666;
  --wr-rule: #eaeaea;
  --wr-surface: #f3f3f3;
  --wr-content-width: 1152px;
  --wr-font: "Source Sans Pro", Arial, sans-serif;
  --wr-reading-font: "Roboto", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { margin: 0; background: #fff; color: var(--wr-ink); font: 400 16px/24px var(--wr-font); }
img { max-width: 100%; height: auto; }
svg { fill: currentColor; }
a { color: var(--wr-blue-dark); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, input[type="submit"], summary { cursor: pointer; }
button, input, textarea { max-width: 100%; }
:focus-visible { outline: 3px solid #181818; outline-offset: 4px; }
p { margin: 0 0 20px; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 20px; font-family: var(--wr-font); overflow-wrap: anywhere; }
h1 { font-size: 48px; line-height: 50px; font-weight: 400; }
h2 { font-size: 30px; line-height: 38px; font-weight: 700; }
h3 { font-size: 24px; line-height: 30px; font-weight: 300; }
h4 { font-size: 18px; line-height: 30px; font-weight: 400; }
h5 { font-size: 16px; line-height: 27px; font-weight: 400; }
h6 { font-size: 14px; line-height: 20px; font-weight: 400; }
.wr-container { width: min(calc(100% - 40px), var(--wr-content-width)); margin-inline: auto; }
.wr-main { padding-block: 32px 56px; min-height: 50vh; }
.wr-visually-hidden, .screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.wr-skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 12px 18px; background: #fff; color: #181818; transform: translateY(-180%); }
.wr-skip-link:focus { transform: translateY(0); }

/* Retained blue main menu: 80px bar and 50px logo. */
.wr-header { background: var(--wr-blue); color: #fff; }
.wr-header-inner { display: flex; align-items: center; gap: 24px; min-height: 80px; position: relative; }
.wr-logo { flex: 0 0 auto; display: block; line-height: 0; }
.wr-logo img { display: block; height: 50px; width: auto; max-width: 220px; object-fit: contain; }
.wr-nav { flex: 1 1 auto; min-width: 0; }
.wr-menu { display: flex; align-items: center; list-style: none; gap: 0; margin: 0; padding: 0; }
.wr-menu li { position: relative; margin: 0; }
.wr-menu a { display: block; color: inherit; padding: 28px 13px; font-size: 18px; line-height: 24px; white-space: nowrap; }
.wr-menu a:hover, .wr-menu .current-menu-item > a, .wr-menu .current-menu-ancestor > a { background: rgba(0, 0, 0, .1); text-decoration: none; }
.wr-header a:focus-visible, .wr-header summary:focus-visible { outline-color: #fff; }
.wr-menu .sub-menu { display: none; position: absolute; z-index: 20; top: 100%; left: 0; min-width: 220px; padding: 6px 0; margin: 0; list-style: none; background: #fff; color: var(--wr-ink); border: 1px solid var(--wr-rule); box-shadow: 0 5px 12px rgba(0, 0, 0, .08); }
.wr-menu li:hover > .sub-menu, .wr-menu li:focus-within > .sub-menu { display: block; }
.wr-menu .sub-menu a { padding: 10px 16px; font-size: 16px; white-space: normal; }
.wr-menu .sub-menu .sub-menu { top: 0; left: 100%; }
.wr-mobile-nav { display: none; }
.wr-search-toggle { flex: 0 0 auto; }
.wr-search-toggle > summary { padding: 12px 0 12px 8px; color: #fff; list-style: none; }
.wr-search-toggle > summary::-webkit-details-marker { display: none; }
.wr-search-toggle > .wr-search { position: absolute; z-index: 30; top: calc(100% + 1px); right: 0; width: min(420px, 100%); padding: 16px; border: 1px solid var(--wr-rule); background: #fff; color: var(--wr-ink); box-shadow: 0 5px 12px rgba(0, 0, 0, .08); }
.wr-search { display: flex; gap: 8px; align-items: stretch; }
.wr-search label { display: block; min-width: 0; flex: 1 1 auto; }
.wr-search input[type="search"] { width: 100%; min-width: 0; height: 44px; padding: 9px 12px; border: 1px solid #bbb; background: #fff; color: var(--wr-ink); border-radius: 0; }
.wr-search button, .wr-search input[type="submit"] { min-height: 44px; padding: 8px 16px; border: 1px solid var(--wr-blue-dark); background: var(--wr-blue-dark); color: #fff; border-radius: 0; }

/* Original builder column proportions, rendered with native layout. */
.wr-row, .wr-row-inner { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 30px; }
.wr-row + .wr-row { margin-top: 30px; }
.wr-column { min-width: 0; }
.wr-col-full { flex: 1 1 100%; width: 100%; }
.wr-col-half { flex: 0 0 calc((100% - 30px) / 2); width: calc((100% - 30px) / 2); }
.wr-col-quarter { flex: 0 0 calc((100% - 90px) / 4); width: calc((100% - 90px) / 4); }
.wr-col-three-quarters { flex: 0 0 calc((100% - 30px) * 3 / 4); width: calc((100% - 30px) * 3 / 4); }
.wr-col-third { flex: 0 0 calc((100% - 60px) / 3); width: calc((100% - 60px) / 3); }
.wr-col-two-thirds { flex: 0 0 calc((100% - 30px) * 2 / 3); width: calc((100% - 30px) * 2 / 3); }
.wr-col-two-thirds + .wr-col-third { flex-basis: calc((100% - 30px) / 3); width: calc((100% - 30px) / 3); }
.wr-section { margin-bottom: 36px; min-width: 0; }
.wr-section:last-child { margin-bottom: 0; }
.wr-section-title { margin: 0 0 22px; padding: 0 0 12px; border-bottom: 1px solid var(--wr-rule); font: 400 24px/30px var(--wr-font); }
.wr-cards { display: grid; gap: 28px 24px; }
.wr-cols-1 { grid-template-columns: minmax(0, 1fr); }
.wr-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wr-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wr-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wr-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.wr-card { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.wr-thumbnail { display: block; margin-bottom: 12px; line-height: 0; background: var(--wr-surface); }
.wr-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 1.965 / 1; object-fit: cover; }
.wr-thumbnail-empty { display: flex; align-items: center; justify-content: center; aspect-ratio: 1.965 / 1; color: #888; font-size: 40px; font-weight: 300; line-height: 1; }
.wr-card-content { min-width: 0; }
.wr-card-title { margin: 0 0 var(--wr-title-margin, 9px); font: var(--wr-title-weight, 700) var(--wr-title-size, 22px)/var(--wr-title-line, 28px) var(--wr-font); }
.wr-card-title a { color: var(--wr-ink); }
.wr-card-title a:hover { color: var(--wr-blue-dark); text-decoration: none; }
.wr-category { display: block; margin-bottom: 7px; color: var(--wr-blue-dark); font-size: 13px; line-height: 18px; }
.wr-category a { color: inherit; }
.wr-meta { color: var(--wr-muted); font-size: 13px; line-height: 20px; margin: 8px 0; }
.wr-meta > * + * { margin-left: 12px; }
.wr-excerpt { margin: 0 0 var(--wr-excerpt-margin, 10px); color: #555; font: var(--wr-excerpt-weight, 400) var(--wr-excerpt-size, 16px)/var(--wr-excerpt-line, 24px) var(--wr-font); }
.wr-excerpt p:last-child { margin-bottom: 0; }

/* Featured style 2: one lead story, then thumbnail-and-text rows. */
.wr-view-featured { grid-template-columns: minmax(0, 1fr); gap: 22px; }
.wr-view-featured .wr-card:not(.wr-card-featured) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; padding-top: 20px; border-top: 1px solid var(--wr-rule); }
.wr-view-featured .wr-card:not(.wr-card-featured) > .wr-card-content:only-child { grid-column: 1 / -1; }
.wr-view-featured .wr-card:not(.wr-card-featured) .wr-thumbnail { margin-bottom: 0; }
.wr-view-featured .wr-card-featured .wr-card-title { font-size: var(--wr-featured-title-size, 32px); line-height: var(--wr-featured-title-line, 38px); font-weight: var(--wr-featured-title-weight, 700); margin-bottom: var(--wr-featured-title-margin, 12px); }
.wr-view-featured .wr-card-featured .wr-excerpt { font-size: var(--wr-featured-excerpt-size, 18px); line-height: var(--wr-featured-excerpt-line, 27px); font-weight: var(--wr-featured-excerpt-weight, 400); margin-bottom: var(--wr-featured-excerpt-margin, 12px); }
.wr-view-featured.wr-featured-style-1 .wr-card:not(.wr-card-featured) { display: block; }
.wr-view-featured.wr-featured-style-1 .wr-card:not(.wr-card-featured) > .wr-thumbnail { display: none; }
.wr-view-list .wr-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; }
.wr-view-list .wr-card > .wr-card-content:only-child { grid-column: 1 / -1; }
.wr-view-list .wr-thumbnail { margin: 0; }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) { counter-reset: wr-ranked-story; gap: 0; }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) .wr-card { counter-increment: wr-ranked-story; position: relative; padding: 14px 0 14px 30px; border-bottom: 1px solid var(--wr-rule); }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) .wr-card::before { content: counter(wr-ranked-story); position: absolute; top: 14px; left: 0; color: var(--wr-blue-dark); font-size: 18px; line-height: 24px; }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) .wr-card-title { font-size: var(--wr-title-size, 16px); line-height: var(--wr-title-line, 22px); font-weight: var(--wr-title-weight, 400); }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) .wr-thumbnail { float: left; width: 72px; margin: 0 12px 6px 0; }
.wr-view-ranking .wr-thumbnail { display: none; }
:is(.wr-view-ranking, .wr-view-ranking-thumbs) .wr-card::after { content: ""; display: block; clear: both; }
.wr-sidebar .wr-section-title { font-size: 22px; line-height: 28px; }
.wr-sidebar .wr-card-title { font-size: var(--wr-title-size, 18px); line-height: var(--wr-title-line, 24px); }
.wr-sidebar .wr-card-featured .wr-card-title { font-size: var(--wr-featured-title-size, 22px); line-height: var(--wr-featured-title-line, 28px); }
.wr-sidebar .wr-excerpt { font-size: var(--wr-excerpt-size, 15px); line-height: var(--wr-excerpt-line, 22px); }
.wr-sidebar .wr-view-featured .wr-card:not(.wr-card-featured) { gap: 12px; padding-top: 14px; }

/* Retained article hierarchy; long imported content stays within its column. */
.wr-article-header { max-width: 920px; margin-bottom: 28px; }
.wr-article-title { margin: 0 0 18px; font: 400 48px/50px var(--wr-font); }
.wr-article-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 40px; align-items: start; }
.wr-article-layout:has(> :only-child) { display: block; max-width: 860px; }
.wr-article-content { min-width: 0; font: 400 18px/27px var(--wr-reading-font); overflow-wrap: anywhere; }
.wr-article-excerpt { margin-bottom: 26px; font: 300 24px/36px var(--wr-reading-font); }
.wr-article-content > :first-child { margin-top: 0; }
.wr-article-content p, .wr-article-content ul, .wr-article-content ol, .wr-article-content blockquote { margin-bottom: 24px; }
.wr-article-content ul, .wr-article-content ol { padding-left: 28px; }
.wr-article-content li { margin-bottom: 8px; }
.wr-article-content h2, .wr-article-content h3, .wr-article-content h4 { margin-top: 32px; }
.wr-article-content h2 { font-size: 30px; line-height: 38px; }
.wr-article-content h3 { font-size: 24px; line-height: 30px; }
.wr-article-content a { text-decoration: underline; }
.wr-article-content .wp-caption, .wr-article-content figure { max-width: 100%; margin: 0 0 24px; }
.wr-article-content img { max-width: 100%; height: auto; }
.wr-article-content iframe, .wr-article-content video { max-width: 100%; }
.wr-article-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.wr-article-content th, .wr-article-content td { padding: 10px 12px; border: 1px solid var(--wr-rule); text-align: left; }
.wr-article-content pre { max-width: 100%; overflow-x: auto; padding: 18px; background: var(--wr-surface); font-size: 14px; line-height: 22px; }
.wr-article-content blockquote { margin-inline: 0; padding: 8px 0 8px 24px; border-left: 3px solid var(--wr-blue); color: #555; }
.wr-article-media { margin: 0 0 26px; }
.wr-article-media img { display: block; width: 100%; height: auto; }
.wr-article-sidebar { min-width: 0; font: 400 16px/24px var(--wr-font); }
.wr-article-sidebar h2 { font-size: 24px; line-height: 30px; font-weight: 400; }
.wr-article-sidebar ul { margin: 0; padding: 0; list-style: none; }
.wr-article-sidebar li { padding: 12px 0; border-bottom: 1px solid var(--wr-rule); }
.wr-article-sidebar li a { color: var(--wr-ink); }
.alignleft { float: left; margin: 6px 22px 16px 0; }
.alignright { float: right; margin: 6px 0 16px 22px; }
.aligncenter { display: block; margin-inline: auto; }
.wp-caption-text, figcaption { margin-top: 8px; font-size: 14px; line-height: 21px; color: var(--wr-muted); }
.wr-empty { padding: 18px 20px; background: var(--wr-surface); color: #555; }
.wr-page-title { margin-bottom: 28px; }
.wr-archive-header { margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--wr-rule); }
.wr-archive-header .wr-page-title { margin-bottom: 12px; }
.wr-archive-description { max-width: 780px; color: #555; }
.wr-button-row { margin: 0 0 24px; }
.wr-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; background: var(--wr-blue-dark); color: #fff; }
.wr-button:hover { background: #075f9f; color: #fff; text-decoration: none; }
.wr-pagination { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--wr-rule); }
.wr-pagination a, .wr-pagination .page-numbers, .wr-pagination span.current { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px 14px; border: 1px solid var(--wr-rule); color: var(--wr-ink); }
.wr-pagination a:hover, .wr-pagination .current { background: var(--wr-blue-dark); border-color: var(--wr-blue-dark); color: #fff; text-decoration: none; }
.wr-footer { border-top: 1px solid var(--wr-rule); padding-block: 28px; background: var(--wr-surface); color: #555; font-size: 15px; }
.wr-footer p:last-child { margin: 0; }

@media (max-width: 1060px) {
  .wr-header-inner { gap: 14px; }
  .wr-menu a { padding-inline: 10px; font-size: 17px; }
  .wr-logo img { max-width: 180px; }
  .wr-article-layout { gap: 30px; }
}

@media (max-width: 920px) {
  .wr-header-inner { flex-wrap: wrap; justify-content: space-between; gap: 0 16px; }
  .wr-nav { display: none; }
  .wr-mobile-nav { display: block; margin-left: auto; }
  .wr-mobile-nav > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 0 12px 12px; color: #fff; list-style: none; font-size: 18px; }
  .wr-mobile-nav > summary::-webkit-details-marker { display: none; }
  .wr-mobile-nav > summary::before { content: ""; width: 18px; height: 13px; border-top: 2px solid; border-bottom: 2px solid; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }
  .wr-mobile-nav > nav { position: absolute; left: -20px; right: -20px; top: 100%; z-index: 25; background: var(--wr-blue-dark); padding: 8px 20px 16px; }
  .wr-mobile-nav > nav > .wr-menu { display: block; }
  .wr-mobile-nav .wr-menu a { white-space: normal; padding: 12px 16px; font-size: 18px; }
  .wr-mobile-nav .wr-menu .sub-menu { position: static; display: block; min-width: 0; padding: 0 0 0 16px; background: transparent; color: #fff; border: 0; box-shadow: none; }
  .wr-mobile-nav .wr-menu .sub-menu a { font-size: 16px; }
  .wr-search-toggle > summary { min-height: 48px; padding: 12px 0; }
  .wr-article-title { font-size: 42px; line-height: 46px; }
}

@media (max-width: 849px) {
  .wr-main { padding-top: 24px; }
  .wr-hidden-xs { display: none !important; }
  .wr-col-half, .wr-col-third, .wr-col-two-thirds, .wr-col-quarter, .wr-col-three-quarters, .wr-col-two-thirds + .wr-col-third { flex: 1 1 100%; width: 100%; }
  .wr-cols-3, .wr-cols-4, .wr-cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wr-article-layout { display: block; }
  .wr-article-sidebar { margin-top: 36px; border-top: 1px solid var(--wr-rule); padding-top: 24px; }
  .wr-article-header { max-width: none; }
}

@media (max-width: 599px) {
  .wr-container { width: calc(100% - 32px); }
  .wr-header-inner { min-height: 72px; }
  .wr-logo img { height: 44px; max-width: 150px; }
  .wr-mobile-nav > summary { font-size: 16px; gap: 7px; }
  .wr-mobile-nav > nav { left: -16px; right: -16px; padding-inline: 16px; }
  .wr-search-toggle > summary { font-size: 15px; }
  .wr-cards { gap: 24px; }
  .wr-cols-2, .wr-cols-3, .wr-cols-4, .wr-cols-5 { grid-template-columns: minmax(0, 1fr); }
  .wr-section { margin-bottom: 30px; }
  .wr-section-title { margin-bottom: 18px; }
  .wr-view-featured .wr-card-featured .wr-card-title { font-size: min(var(--wr-featured-title-size, 32px), 32px); line-height: 1.12; }
  .wr-view-featured .wr-card:not(.wr-card-featured), .wr-view-list .wr-card { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; }
  .wr-view-featured .wr-card:not(.wr-card-featured) .wr-card-title { font-size: min(var(--wr-title-size, 20px), 20px); line-height: 1.25; }
  .wr-article-title, h1 { font-size: 36px; line-height: 40px; }
  .wr-article-content { font-size: 18px; line-height: 27px; }
  .wr-article-content h2 { font-size: 28px; line-height: 34px; }
  .alignleft, .alignright { float: none; display: block; margin: 0 auto 22px; }
}

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

@media (max-width: 380px) {
  .wr-header-inner { gap: 0 10px; }
  .wr-logo img { height: 40px; max-width: 136px; }
}
