/*
Theme Name: Hey Custom
Template: hey
Version: 1.0.0
Description: Child theme of Hey — clean post list, reading time, syntax highlighting, copy buttons, Inter for content.
Text Domain: hey-custom
*/

/* ── Reading time ── */
.mt-reading-time {
    font-size: inherit;
    color: inherit;
    opacity: 0.6;
}

/* ── Copy button ── */
.mt-code-wrapper { position: relative; }
.mt-copy-btn {
    position: absolute; top: 8px; right: 8px;
    background: rgba(255,255,255,0.07); color: #999;
    border: 1px solid rgba(255,255,255,0.14); border-radius: 3px;
    padding: 2px 8px; font-size: 0.6875rem; font-family: inherit;
    cursor: pointer; opacity: 0; pointer-events: none;
    transition: all 0.15s ease; z-index: 10;
}
.mt-code-wrapper:hover .mt-copy-btn { opacity: 1; pointer-events: auto; }
.mt-copy-btn:hover { color: #ddd; background: rgba(255,255,255,0.14); }
.mt-copy-btn.mt-copied { color: #6ee7b7; border-color: rgba(110,231,183,0.3); }

/* ── Post content — Inter for readability ── */
.wp-block-post-content,
.wp-block-post-content p,
.wp-block-post-content li {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 1rem !important;
    line-height: 1.75 !important;
    font-weight: 400 !important;
}
.wp-block-post-content h2 {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 1.375rem !important; font-weight: 700 !important;
    line-height: 1.25 !important; letter-spacing: -0.02em !important;
    margin-top: 2.25em !important; margin-bottom: 0.75em !important;
}
.wp-block-post-content h3 {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 1.125rem !important; font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    margin-top: 2em !important; margin-bottom: 0.5em !important;
}
.wp-block-post-content strong { font-weight: 600 !important; }

/* ── Site logo size ── */
.wp-block-site-logo img {
    max-height: 48px !important;
    width: auto !important;
}

/* ── Site tagline in header ── */
.wp-block-site-tagline {
    font-size: var(--wp--preset--font-size--small) !important;
    opacity: 0.55;
    margin: 0 !important;
}

/* ── Navigation links ── */
.wp-block-navigation a {
    font-size: var(--wp--preset--font-size--small) !important;
}

/* ── Homepage post row: title left, date+reading-time right, adjacent ──
   WordPress generates unique container classes that override generic selectors,
   so we target the child elements directly. flex-grow:1 on title fills all
   free space, leaving date+reading-time with zero gap between them. ── */
.wp-block-post-template .wp-block-post-title {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
}
.wp-block-post-template .wp-block-post-date {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}
.wp-block-post-template .mt-reading-time {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    opacity: 0.55;
    font-size: var(--wp--preset--font-size--small) !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* ================================================================
   COSMETIC IMPROVEMENTS — all changes below this line
   To revert: delete everything from this comment to end of file
   ================================================================ */

/* #1 — DM Serif Display for post titles */
.wp-block-post-template .wp-block-post-title a,
.wp-block-post-template .wp-block-post-title {
    font-family: 'DM Serif Display', Georgia, serif !important;
    font-weight: 400 !important;
    font-size: 1.25rem !important;
    letter-spacing: 0 !important;
    line-height: 1.3 !important;
}

/* Single post H1 — display serif, large */
.wp-block-post-title:not(.wp-block-post-template .wp-block-post-title) {
    font-family: 'DM Serif Display', Georgia, serif !important;
    font-weight: 400 !important;
    font-size: clamp(1.875rem, 5vw, 2.75rem) !important;
    letter-spacing: -0.01em !important;
    line-height: 1.2 !important;
}

/* #2 — Accent colour: dark amber #b85c00 on interactive states */
.wp-block-post-template .wp-block-post-title a:hover {
    color: #b85c00 !important;
    opacity: 1 !important;
}
.wp-block-navigation a:hover { color: #b85c00 !important; }
.wp-block-post-content a:hover { color: #b85c00 !important; }

/* #3 — Post list row spacing: 1.75rem → 2.25rem */
.wp-block-post-template li {
    --row-padding: 2.25rem;
}
.wp-block-post-template .wp-block-group[style*="border-top"] {
    padding-top: 2.25rem !important;
    padding-bottom: 2.25rem !important;
}

/* #4 — Tagline: slightly more visible */
.wp-block-site-tagline {
    opacity: 0.65 !important;
    color: #787670 !important;
}

/* #5 — Post list row spacing (direct padding override) */
.wp-block-post-template > li > .wp-block-group {
    padding-top: 2.25rem !important;
    padding-bottom: 2.25rem !important;
}

/* #6 — Single post title already covered in #1 above */

/* #7 — Featured image: border-radius + subtle shadow */
.wp-block-post-featured-image img {
    border-radius: 4px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
}

/* #8 — Footer styles (for the overridden footer.html) */
.hc-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: var(--wp--preset--font-size--small);
    color: #787670;
}
.hc-footer-inner .wp-block-site-title a {
    font-size: var(--wp--preset--font-size--small) !important;
    opacity: 0.5;
    text-decoration: none !important;
}
.hc-footer-inner a { color: #787670; text-decoration: none; }
.hc-footer-inner a:hover { color: #b85c00; }

/* #9 — In-content link hover */
.wp-block-post-content a {
    transition: color 0.15s ease;
    text-decoration-color: currentColor;
    text-underline-offset: 3px;
}

/* #10 — Selection colour */
::selection {
    background: #b85c00;
    color: #ffffff;
}

/* ── Dark mode toggle button ── */
.hc-dark-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; background: transparent;
    border: 1px solid currentColor; border-radius: 4px;
    color: inherit; cursor: pointer; padding: 0;
    opacity: 0.5; transition: opacity 0.15s ease; flex-shrink: 0;
}
.hc-dark-toggle:hover { opacity: 1; }
.hc-icon-moon { display: block; }
.hc-icon-sun  { display: none;  }
html.hey-dark .hc-icon-moon { display: none;  }
html.hey-dark .hc-icon-sun  { display: block; }

/* ── Dark mode — override Hey colour tokens ── */
html.hey-dark {
    color-scheme: dark;
    --wp--preset--color--primary:    #e8e8e8;
    --wp--preset--color--background: #111111;
    --wp--preset--color--secondary:  #888888;
    --wp--preset--color--foreground: #aaaaaa;
    --wp--preset--color--tertiary:   #2a2a2a;
}
html.hey-dark body,
html.hey-dark .wp-site-blocks { background: #111111 !important; color: #e8e8e8 !important; }
html.hey-dark header, html.hey-dark footer { background: #111111 !important; }
html.hey-dark .wp-block-group { background: transparent !important; }
html.hey-dark h1,html.hey-dark h2,html.hey-dark h3,
html.hey-dark h4,html.hey-dark h5,html.hey-dark h6,
html.hey-dark p, html.hey-dark li { color: #e8e8e8 !important; }
html.hey-dark a { color: #e8e8e8 !important; }
html.hey-dark .wp-block-site-title a,
html.hey-dark .wp-block-navigation a { color: #e8e8e8 !important; }
html.hey-dark .wp-block-post-content a { color: #e8e8e8 !important; }
html.hey-dark ::selection { background: #e8e8e8; color: #111111; }

/* ── Reading progress bar ── */
.hc-progress-bar {
    position: fixed; top: 0; left: 0; width: 0; height: 2px;
    background: #b85c00; z-index: 9999; transition: width 0.1s linear;
}

/* ── Series banner ── */
.hc-series {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem;
    padding: 0.875rem 1rem; margin-bottom: 2rem;
    border: 1px solid currentColor; border-radius: 2px;
    font-size: 0.875rem;
}
.hc-series-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.hc-series-label {
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; opacity: 0.5;
}
.hc-series-name { font-weight: 500; }
.hc-series-count { opacity: 0.5; font-size: 0.8125rem; }
.hc-series-parts { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.hc-series-part {
    font-size: 0.8125rem; padding: 3px 10px;
    border: 1px solid currentColor; border-radius: 2px;
    text-decoration: none !important; opacity: 0.6;
    transition: opacity 0.15s ease;
}
.hc-series-part:hover { opacity: 1; }
.hc-series-active { opacity: 1 !important; font-weight: 600; }

/* ── Author bio ── */
.hc-author-bio {
    display: flex; align-items: flex-start; gap: 1rem;
    padding: 1.5rem 0; margin-top: 2.5rem;
    border-top: 1px solid currentColor;
}
.hc-author-img {
    width: 56px !important; height: 56px !important;
    border-radius: 50% !important; flex-shrink: 0;
}
.hc-author-label {
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; opacity: 0.45; margin-bottom: 3px;
}
.hc-author-name { font-size: 0.9375rem; font-weight: 600; margin-bottom: 4px; }
.hc-author-desc { font-size: 0.875rem; opacity: 0.65; line-height: 1.55; }

/* ── Related posts ── */
.hc-related { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid currentColor; }
.hc-related-title {
    font-size: 0.6875rem !important; font-weight: 700 !important;
    text-transform: uppercase !important; letter-spacing: 0.07em !important;
    opacity: 0.45; margin: 0 0 1rem !important;
    font-family: inherit !important;
}
.hc-related-list { list-style: none; margin: 0; padding: 0; }
.hc-related-list li { border-bottom: 1px solid currentColor; }
.hc-related-link {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 0.75rem 0; gap: 1rem; text-decoration: none !important;
    transition: opacity 0.15s ease;
}
.hc-related-link:hover { opacity: 0.6; }
.hc-related-link-title { font-size: 0.9375rem; font-weight: 400; }
.hc-related-link-meta { font-size: 0.75rem; opacity: 0.5; flex-shrink: 0; white-space: nowrap; }

/* ── Like button ── */
.hc-like-wrap {
    display: flex;
    align-items: center;
    padding: 1.5rem 0;
    border-top: 1px solid currentColor;
    margin-top: 2rem;
}

.hc-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0.5rem 1.125rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: inherit;
    opacity: 0.55;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.hc-like-btn:hover:not(.hc-liked) {
    opacity: 1;
    color: #b85c00;
    border-color: #b85c00;
}

.hc-like-btn.hc-liked {
    opacity: 1;
    color: #b85c00;
    border-color: #b85c00;
}

.hc-like-btn.hc-liked .hc-heart {
    fill: #b85c00;
    stroke: #b85c00;
}

@keyframes hc-like-bounce {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.2); }
    65%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.hc-like-btn.hc-like-anim { animation: hc-like-bounce 0.45s ease; }

.hc-like-count { font-variant-numeric: tabular-nums; min-width: 1ch; }

/* ── Dark mode: navigation submenu ── */
html.hey-dark .wp-block-navigation__submenu-container {
    background-color: #1c1c1c !important;
    border-color: #333333 !important;
}
html.hey-dark .wp-block-navigation__submenu-container a,
html.hey-dark .wp-block-navigation__submenu-container .wp-block-navigation-item__label {
    color: #e8e8e8 !important;
}
html.hey-dark .wp-block-navigation__submenu-container li:hover > a {
    color: #b85c00 !important;
}

/* ── Dark mode: override hardcoded inline colour styles in content ── */
html.hey-dark .wp-block-post-content [style*="color:#000"],
html.hey-dark .wp-block-post-content [style*="color: #000"],
html.hey-dark .wp-block-post-content [style*="color:#1f"],
html.hey-dark .wp-block-post-content [style*="color:#111"],
html.hey-dark .wp-block-post-content [style*="color:#333"],
html.hey-dark .wp-block-post-content p,
html.hey-dark .wp-block-post-content h1,
html.hey-dark .wp-block-post-content h2,
html.hey-dark .wp-block-post-content h3,
html.hey-dark .wp-block-post-content h4,
html.hey-dark .wp-block-post-content li,
html.hey-dark .wp-block-post-content span:not(.mt-reading-time):not(.hc-like-count):not(.hc-like-label):not(.hc-series-label):not(.hc-series-count) {
    color: #e8e8e8 !important;
}

/* ── Dark mode: override WordPress preset colour utility classes ──
   The block editor sets has-white-background-color / has-black-color
   directly on elements with !important — must be overridden explicitly. ── */
html.hey-dark .has-white-background-color,
html.hey-dark .has-white-background-color.has-background {
    background-color: #1c1c1c !important;
}
html.hey-dark .has-black-color,
html.hey-dark .has-black-color.has-text-color {
    color: #e8e8e8 !important;
}
html.hey-dark .wp-block-cover__background.has-white-background-color,
html.hey-dark .wp-block-cover__background.has-background-dim {
    background-color: #111111 !important;
}
html.hey-dark .wp-block-media-text.has-white-background-color {
    background-color: #1c1c1c !important;
}
html.hey-dark .wp-social-link.has-black-color {
    color: #e8e8e8 !important;
}
html.hey-dark .wp-block-group.has-black-color.has-text-color {
    color: #e8e8e8 !important;
}
html.hey-dark [class*="has-black-color"] { color: #e8e8e8 !important; }
html.hey-dark [class*="has-white-background"] { background-color: #1c1c1c !important; }
