/*
Theme Name: Beyond the Framework
Theme URI: https://terahreed.com
Author: Terah Reed
Author URI: https://terahreed.com
Description: Dark-first personal brand theme for writing on identity, access, and leadership. Ships paired light and dark modes, a warm amber accent, and full block editor support.
Version: 1.2.1
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: beyond-the-framework
Tags: blog, one-column, custom-colors, custom-logo, custom-menu, editor-style, featured-images, block-styles, wide-blocks, translation-ready, accessibility-ready
*/

/* =========================================================
   1. Design tokens
   ========================================================= */
:root {
  color-scheme: dark;
  --btf-bg: #0E1116;
  --btf-raised: #171D24;
  --btf-text: #EFE8D8;
  --btf-muted: #9BA4AA;
  --btf-border: #232A32;
  --btf-teal: #2A5F62;
  --btf-teal-text: #6FA8AC;
  --btf-amber: #E8A33D;
  --btf-amber-text: #E8A33D;
  --btf-amber-hover: #C4862B;
  --btf-on-amber: #0E1116;

  --btf-measure: 44rem;
  --btf-wide: 68rem;
  --btf-gap: 1.5rem;
  --btf-radius: 12px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --btf-bg: #FAF7F1;
  --btf-raised: #FFFFFF;
  --btf-text: #12161A;
  --btf-muted: #5A646B;
  --btf-border: #E2DCD1;
  --btf-teal: #2A5F62;
  --btf-teal-text: #2A5F62;
  --btf-amber: #C4862B;
  --btf-amber-text: #8A5A14;
  --btf-amber-hover: #8A5A14;
  --btf-on-amber: #12161A;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --btf-bg: #FAF7F1;
    --btf-raised: #FFFFFF;
    --btf-text: #12161A;
    --btf-muted: #5A646B;
    --btf-border: #E2DCD1;
    --btf-teal: #2A5F62;
    --btf-teal-text: #2A5F62;
    --btf-amber: #C4862B;
    --btf-amber-text: #8A5A14;
    --btf-amber-hover: #8A5A14;
    --btf-on-amber: #12161A;
  }
}

/* =========================================================
   2. Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

/* scroll-padding keeps #anchor targets from hiding under the sticky header. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  margin: 0;
  background: var(--btf-bg);
  color: var(--btf-text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color .2s ease, color .2s ease;
}

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

img, svg, video, iframe { max-width: 100%; }
/* Embeds such as Jetpack Likes don't declare a colour scheme; without this, browsers
   paint them on solid white in dark mode. */
iframe { color-scheme: normal; }
img, svg, video { height: auto; display: block; }

a { color: var(--btf-amber-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--btf-amber-hover); }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: 1.25rem; }

blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--btf-teal);
  color: var(--btf-muted);
  font-style: italic;
}

hr { border: 0; border-top: 1px solid var(--btf-border); margin: 2.5rem 0; }

code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .9em;
}
code { background: var(--btf-raised); padding: .12em .4em; border-radius: 4px; }
pre { background: var(--btf-raised); border: 1px solid var(--btf-border); border-radius: var(--btf-radius); padding: 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--btf-border); padding: .6rem .5rem; text-align: left; }
th { font-weight: 500; color: var(--btf-muted); }

:focus-visible { outline: 2px solid var(--btf-amber); outline-offset: 2px; border-radius: 3px; }

/* =========================================================
   3. Accessibility helpers
   ========================================================= */
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.skip-link:focus {
  position: fixed; top: .75rem; left: .75rem; z-index: 999;
  width: auto; height: auto; clip: auto; padding: .6rem 1rem;
  background: var(--btf-amber); color: var(--btf-on-amber); border-radius: 8px;
  font-size: .875rem; font-weight: 500; text-decoration: none;
}

/* =========================================================
   4. Layout
   ========================================================= */
.wrap { width: 100%; max-width: var(--btf-wide); margin-inline: auto; padding-inline: 1.25rem; }
/* minmax(0, 1fr) stops long words, code or tables from widening the column on phones. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; padding-block: 2.5rem 4rem; }
@media (min-width: 62rem) {
  .has-sidebar .layout { grid-template-columns: minmax(0, 1fr) 16rem; }
}

.site-main { min-height: 50vh; }

/* "Full width (no sidebar)" page template: centre the reading column.
   Wide and full blocks still stretch to the site width (100cqi = width of .layout). */
.page-template-full-width .layout { container-type: inline-size; }
.page-template-full-width .content-area { width: 100%; max-width: var(--btf-measure); margin-inline: auto; }
.page-template-full-width .entry-content > .alignwide,
.page-template-full-width .entry-content > .alignfull { width: 100cqi; max-width: none; margin-inline: calc(50% - 50cqi); }

/* =========================================================
   5. Header
   ========================================================= */
.site-header {
  border-bottom: 1px solid var(--btf-border);
  background: var(--btf-raised);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(8px);
}
/* Keep the sticky header below the WordPress toolbar when logged in. */
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }
.header-inner { display: flex; align-items: center; gap: 1rem; padding-block: .85rem; }

.brand { display: flex; align-items: center; gap: .7rem; margin-right: auto; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-title {
  font-size: .78rem; font-weight: 500; letter-spacing: .16em;
  text-transform: uppercase; color: var(--btf-text); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-title:hover { color: var(--btf-amber-text); }
.site-tagline { font-size: .68rem; color: var(--btf-muted); letter-spacing: .04em; }

.btf-mark { flex: none; }
.custom-logo-link { flex: none; }
.custom-logo { max-height: 3rem; width: auto; }
.btf-mark rect { fill: none; stroke: var(--btf-teal); stroke-width: 3; }
.btf-mark path { fill: none; stroke: var(--btf-amber); stroke-width: 5; stroke-linecap: round; }

.site-nav .menu { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { font-size: .82rem; color: var(--btf-muted); text-decoration: none; letter-spacing: .02em; }
.site-nav a:hover, .site-nav .current-menu-item > a { color: var(--btf-amber-text); }

/* Mobile menu button: only shown on small screens when JavaScript is running. */
.menu-toggle { display: none; }
.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .2s ease, background-color .2s ease;
}
.menu-toggle-bars { position: relative; }
.menu-toggle-bars::before,
.menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -6px; }
.menu-toggle-bars::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::before { transform: translateY(6px) rotate(45deg); background: var(--btf-text); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); background: var(--btf-text); }

@media (max-width: 46rem) {
  .header-inner { gap: .6rem; }
  .site-title { white-space: normal; letter-spacing: .12em; }
  .site-tagline { display: none; }

  /* Without JavaScript the menu simply wraps onto its own row. */
  .header-inner { flex-wrap: wrap; }
  .site-nav { order: 4; width: 100%; }
  .site-nav .menu { flex-wrap: wrap; gap: .25rem 1.25rem; }

  .js .header-inner { flex-wrap: nowrap; }
  .js .menu-toggle {
    order: 3; display: inline-flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem; flex: none;
    background: transparent; border: 1px solid var(--btf-border); border-radius: 999px;
    color: var(--btf-muted); cursor: pointer;
  }
  .js .menu-toggle:hover,
  .js .menu-toggle[aria-expanded="true"] { border-color: var(--btf-teal); color: var(--btf-text); }

  .js .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--btf-raised); border-bottom: 1px solid var(--btf-border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .25);
    max-height: calc(100vh - 4rem); overflow-y: auto;
  }
  .js .site-nav.is-open { display: block; }
  .js .site-nav .menu { flex-direction: column; gap: 0; padding: .5rem 1.25rem 1rem; }
  .js .site-nav li { border-bottom: 1px solid var(--btf-border); }
  .js .site-nav li:last-child { border-bottom: 0; }
  .js .site-nav a { display: block; padding: .85rem 0; font-size: 1rem; color: var(--btf-text); }

  /* Icon-only colour toggle with a comfortable tap size. */
  .theme-toggle { width: 2.75rem; height: 2.75rem; padding: 0; justify-content: center; flex: none; }
  .theme-toggle-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
  }
}

.theme-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  background: transparent; border: 1px solid var(--btf-border); color: var(--btf-muted);
  border-radius: 999px; padding: .35rem .7rem .35rem .5rem;
  font: inherit; font-size: .75rem; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--btf-teal); color: var(--btf-text); }
.theme-toggle-icon {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--btf-amber);
  background: linear-gradient(to right, var(--btf-amber) 50%, transparent 50%);
}
.theme-toggle-label { letter-spacing: .04em; }

/* =========================================================
   6. Hero
   ========================================================= */
.hero { padding-block: clamp(3rem, 9vw, 6rem) clamp(2rem, 5vw, 3.5rem); border-bottom: 1px solid var(--btf-border); }
.hero-rule { width: 3rem; height: 3px; background: var(--btf-amber); border-radius: 3px; margin-bottom: 1.5rem; }
.eyebrow { font-size: .75rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--btf-amber-text); margin: 0 0 .9rem; }
.hero-title { font-size: clamp(2.1rem, 6vw, 3.6rem); margin: 0 0 1rem; max-width: 20ch; }
.hero-lede { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--btf-muted); max-width: 46ch; margin: 0 0 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
@media (max-width: 30rem) {
  .hero-actions .btn { flex: 1 1 100%; text-align: center; }
}

/* Homepage sections under the hero */
.home-content { padding-block: 3rem 0; }
.home-latest { padding-block: 3rem; }
.home-more { margin: 1.5rem 0 0; font-size: .9rem; }

/* Social logos after the latest posts (Appearance > Menus > Social links) */
.home-social { padding-block: 0 1.5rem; }
.home-social-title {
  font-size: .78rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--btf-muted); margin: 0 0 1rem;
}
.social-links { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; margin: 0; padding: 0; }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 1px solid var(--btf-border); color: var(--btf-muted);
  transition: color .15s ease, border-color .15s ease;
}
.social-link svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.social-link:hover, .social-link:focus-visible { color: var(--btf-amber-text); border-color: var(--btf-amber); }

.btn {
  display: inline-block; padding: .7rem 1.3rem; border-radius: 8px;
  font-size: .875rem; font-weight: 500; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--btf-amber); color: var(--btf-on-amber); }
.btn-primary:hover { background: var(--btf-amber-hover); color: var(--btf-on-amber); }
.btn-ghost { border-color: var(--btf-teal); color: var(--btf-teal-text); }
.btn-ghost:hover { border-color: var(--btf-amber); color: var(--btf-amber-text); }

/* =========================================================
   7. Post cards
   ========================================================= */
.card-grid { display: grid; gap: 1.25rem; }
@media (min-width: 44rem) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  border: 1px solid var(--btf-border); border-radius: var(--btf-radius);
  background: var(--btf-raised); overflow: hidden; display: flex; flex-direction: column;
}
.card-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .45rem; }
.card-tag { font-size: .68rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--btf-amber-text); text-decoration: none; }
.card-title { font-size: 1.15rem; margin: 0; }
.card-title a { color: var(--btf-text); text-decoration: none; }
.card.sticky { border-color: var(--btf-teal); }
.card-title a:hover { color: var(--btf-amber-text); }
.card-excerpt { font-size: .92rem; color: var(--btf-muted); margin: 0; }
.card-meta { font-size: .75rem; color: var(--btf-muted); margin: 0; }

/* =========================================================
   8. Entry
   ========================================================= */
.entry-head { margin-bottom: 2rem; }
.entry-title { margin: .4rem 0 .8rem; }
.entry-meta { font-size: .82rem; color: var(--btf-muted); }
.entry-media { margin: 0 0 2rem; border-radius: var(--btf-radius); overflow: hidden; }
.entry-content > * { max-width: var(--btf-measure); }
.entry-content > .alignwide { max-width: var(--btf-wide); }
.entry-content > .alignfull { max-width: none; }
.entry-content a { color: var(--btf-amber-text); }
.entry-content img, .entry-content figure { border-radius: var(--btf-radius); }
.entry-content::after { content: ""; display: table; clear: both; }
.entry-content > table { display: block; overflow-x: auto; }

/* Image alignment (classic editor and older content) */
.alignleft { float: left; margin: .3rem 1.5rem 1rem 0; }
.alignright { float: right; margin: .3rem 0 1rem 1.5rem; }
.aligncenter { display: block; margin-inline: auto; }
@media (max-width: 36rem) {
  .alignleft, .alignright { float: none; margin-inline: 0; }
}
.wp-caption { max-width: 100%; }

.wp-caption-text, figcaption, .gallery-caption { font-size: .8rem; color: var(--btf-muted); text-align: center; }
.entry-foot { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--btf-border); font-size: .82rem; color: var(--btf-muted); }

/* =========================================================
   9. Sidebar, widgets, pagination
   ========================================================= */
.widget { margin-bottom: 2rem; }
/* .site-sidebar h2 covers block widgets, which bring their own heading. */
.widget-title, .site-sidebar h2, .site-sidebar h3 { font-size: .78rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--btf-muted); margin: 0 0 .75rem; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.site-sidebar .wp-block-group > :first-child { margin-top: 0; }
/* Plain link lists (recent posts, categories). Social Icons set their own size, so skip them. */
.widget li:not(.wp-social-link) { padding: .3rem 0; border-bottom: 1px solid var(--btf-border); font-size: .9rem; }

.pagination { margin-top: 2.5rem; }
.pagination .page-numbers {
  display: inline-block; padding: .35rem .7rem; margin: 0 .25rem .4rem 0;
  border: 1px solid var(--btf-border); border-radius: 7px;
  font-size: .85rem; text-decoration: none; color: var(--btf-muted);
}
.pagination .current { background: var(--btf-amber); color: var(--btf-on-amber); border-color: var(--btf-amber); }
.pagination a:hover { border-color: var(--btf-amber); color: var(--btf-amber-text); }

.post-navigation, .comment-navigation { margin: 3rem 0; padding-top: 1.5rem; border-top: 1px solid var(--btf-border); font-size: .85rem; }
.comment-navigation { margin: 1.5rem 0; }
.post-navigation .nav-links, .comment-navigation .nav-links { display: flex; justify-content: space-between; gap: 1rem; }
.post-navigation .nav-next, .comment-navigation .nav-next { text-align: right; margin-left: auto; }
@media (max-width: 36rem) {
  .post-navigation .nav-links { flex-direction: column; }
  .post-navigation .nav-next { margin-left: 0; }
}

/* =========================================================
   10. Footer
   ========================================================= */
.site-footer { border-top: 1px solid var(--btf-border); background: var(--btf-raised); padding-block: 2rem; margin-top: 3rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.footer-inner p { margin: 0; font-size: .8rem; color: var(--btf-muted); }
.footer-nav ul { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.footer-nav a { font-size: .8rem; color: var(--btf-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--btf-amber-text); }

/* =========================================================
   11. Blocks and comments
   ========================================================= */
.wp-block-button__link { background: var(--btf-amber); color: var(--btf-on-amber); border-radius: 8px; }
.wp-block-quote { border-left: 3px solid var(--btf-teal); padding-left: 1.25rem; }
.wp-block-separator { border-color: var(--btf-border); }
.comments-area { margin-top: 3rem; }
.comment-list, .comment-list .children { list-style: none; padding: 0; margin: 0; }
.comment-list .children { padding-left: 1.25rem; border-left: 1px solid var(--btf-border); }
@media (max-width: 36rem) { .comment-list .children { padding-left: .6rem; } }
.comment-body { border-bottom: 1px solid var(--btf-border); padding: 1rem 0; }
.comment-author { display: flex; align-items: center; gap: .6rem; }
.comment-author .avatar { border-radius: 50%; flex: none; }
.comment-author .says { display: none; }
.bypostauthor > .comment-body .fn { color: var(--btf-amber-text); }
.comment-meta { font-size: .78rem; color: var(--btf-muted); }
.comment-metadata a { color: inherit; }
.comment-content { overflow-wrap: anywhere; }
.reply { font-size: .8rem; }
.comment-respond { margin-top: 2rem; }
.comment-form label { display: block; font-size: .85rem; margin-bottom: .3rem; }
.comment-form .comment-form-cookies-consent { display: flex; gap: .5rem; align-items: flex-start; }
.comment-form .comment-form-cookies-consent label { margin: 0; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], textarea {
  width: 100%; background: var(--btf-bg); color: var(--btf-text);
  border: 1px solid var(--btf-border); border-radius: 8px; padding: .6rem .75rem; font: inherit; font-size: .92rem;
}
input:focus, textarea:focus { border-color: var(--btf-amber); outline: none; }
button[type="submit"], input[type="submit"] {
  background: var(--btf-amber); color: var(--btf-on-amber); border: 0;
  border-radius: 8px; padding: .6rem 1.1rem; font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
}
button[type="submit"]:hover, input[type="submit"]:hover { background: var(--btf-amber-hover); }

.search-form { display: flex; gap: .5rem; align-items: stretch; }
.search-form label { flex: 1; min-width: 0; }

/* =========================================================
   12. Print
   ========================================================= */
@media print {
  .site-header, .theme-toggle, .menu-toggle, .site-footer, .post-navigation, .comment-respond { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
}
