/*
Theme Name: KodeHelp
Theme URI: https://kodehelp.com
Author: KodeHelp Team
Author URI: https://kodehelp.com
Description: A modern, editorial WordPress theme for technical blogs. Features a refined reading experience, syntax highlighting, dark mode, and responsive design optimized for code tutorials and technical content.
Version: 3.0.0
Requires at least: 6.0
Tested up to: 6.7
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: kodehelp
Tags: blog, custom-menu, featured-images, threaded-comments, translation-ready, block-patterns, wide-blocks, full-site-editing

KodeHelp — clean, editorial theme for technical content creators.
*/

/* ==========================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    /* Colors — matching kodehelp.com */
    --color-ink: #222222;
    --color-ink-light: #444444;
    --color-ink-muted: #888888;
    --color-heading: #363636;
    --color-accent: #2b44ff;
    --color-accent-text: #1e3ad4; /* WCAG AA compliant on white (5.9:1) */
    --color-accent-hover: #2236cc;
    --color-accent-light: rgba(43, 68, 255, 0.08);
    --color-accent-glow: rgba(43, 68, 255, 0.15);
    --color-surface: #ffffff;
    --color-surface-raised: #fafafc;
    --color-surface-sunken: #f2f2f2;
    --color-border: #e9e8fa;
    --color-border-light: #dbdbdb;
    --color-success: #00b894;
    --color-warning: #fdcb6e;
    --color-error: #e17055;
    --color-info: #74b9ff;
    --color-code-bg: #f5f5f5;
    --color-code-text: #2d3748;

    /* Typography - matching kodehelp.com */
    --font-display: 'Krona One', Helvetica, Arial, sans-serif;
    --font-heading: 'Bitter', Helvetica, Arial, sans-serif;
    --font-body: 'Source Serif Pro', Helvetica, Arial, sans-serif;
    --font-mono: "IBM Plex Mono", Monaco, "Cascadia Code", Consolas, "Courier New", monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1.25rem;
    --text-lg: 1.375rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.25rem;
    --text-4xl: 3rem;
    --text-5xl: 3.75rem;

    --leading-tight: 1.125;
    --leading-snug: 1.35;
    --leading-normal: 1.5;

    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* Layout */
    --width-content: 900px;
    --width-wide: 1200px;
    --width-full: 1400px;
    --header-height: 72px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(26, 26, 46, 0.04);
    --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 26, 46, 0.08);
    --shadow-lg: 0 8px 32px rgba(26, 26, 46, 0.10);
    --shadow-xl: 0 16px 48px rgba(26, 26, 46, 0.12);
    --shadow-glow: 0 0 0 4px var(--color-accent-light);

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* Motion */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
html {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-weight: 400;
    color: var(--color-ink);
    background-color: var(--color-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

#page {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#primary,
#content {
    flex: 1;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 400;
    line-height: var(--leading-tight);
    color: var(--color-heading);
    margin-top: 2em;
    margin-bottom: 0.5em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-weight: 600; }

p {
    margin-bottom: 1.6em;
    line-height: var(--leading-normal);
}

a,
a:visited,
a:hover,
a:active {
    color: var(--color-accent-text);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--color-accent-hover);
}

a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

strong, b {
    font-weight: 700;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.site-container {
    max-width: var(--width-full);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.content-wrapper {
    max-width: var(--width-content);
    margin: 0 auto;
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */
code {
    font-family: var(--font-mono);
    font-size: 15px;
    background-color: var(--color-code-bg);
    padding: 0.25em 0.5em;
    border-radius: var(--radius-sm);
    color: var(--color-accent-text);
    font-weight: 500;
    border: none;
}

pre {
    background-color: var(--color-code-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    overflow-x: auto;
    margin-bottom: 1.8em;
    border: 1px solid var(--color-border-light);
    position: relative;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: var(--color-code-text);
    font-size: 0.875em;
    font-weight: 400;
    border: none;
    line-height: 1.65;
}

/* ==========================================================================
   Blockquote
   ========================================================================== */
blockquote {
    border-left: 3px solid var(--color-accent);
    padding: var(--space-6) var(--space-8);
    margin: 0 0 2rem 0;
    background-color: var(--color-accent-light);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-style: italic;
    color: var(--color-ink-light);
    font-size: var(--text-lg);
    line-height: 1.6;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Lists
   ========================================================================== */
ul, ol {
    margin-bottom: 1.6em;
    padding-left: 1.75em;
}

li {
    margin-bottom: 0.4em;
    line-height: var(--leading-normal);
}

li::marker {
    color: var(--color-accent-text);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--color-surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    clip: auto !important;
    color: var(--color-ink);
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: var(--space-4) var(--space-6);
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

.alignwide {
    max-width: var(--width-wide);
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
}

/* ==========================================================================
   WordPress Core Styles
   ========================================================================== */
.wp-block-image {
    margin-bottom: 2em;
}

.wp-block-image figcaption {
    text-align: center;
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--color-ink-muted);
    margin-top: var(--space-3);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background-color: var(--color-accent);
    color: #ffffff;
    border-color: var(--color-accent);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-ink);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--color-ink-light);
    border-color: transparent;
}

.btn-ghost:hover {
    background-color: var(--color-surface-sunken);
    color: var(--color-accent);
}

/* ==========================================================================
   Selection
   ========================================================================== */
::selection {
    background-color: var(--color-accent-glow);
    color: var(--color-ink);
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface-raised);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-ink-muted);
}

/* ==========================================================================
   Tables
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2em;
    font-size: var(--text-sm);
}

th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-ink);
    background-color: var(--color-surface-raised);
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */
hr {
    border: none;
    height: 1px;
    background-color: var(--color-border);
    margin: var(--space-12) 0;
}
