/* ==========================================================================
   TechAzhon Blog: list + detail (uses brand tokens from custom.css)
   ========================================================================== */

.tb {
    --tb-accent: var(--if-primary, #0070ad);
    --tb-accent-2: var(--if-cyan, #00b4d8);
    --tb-dark: var(--if-dark, #060b17);
    --tb-navy: var(--if-navy, #0d1b3e);
    --tb-heading: var(--if-text-heading, #0a1128);
    --tb-body: var(--if-text-body, #334155);
    --tb-muted: var(--if-text-muted, #64748b);
    --tb-border: var(--if-border, #e2e8f0);
    --tb-surface: var(--if-bg-surface, #f4f6f9);
    --tb-radius: 18px;
    font-family: var(--if-font, 'Inter', sans-serif);
    color: var(--tb-body);
    background: #fff;
}

.tb *, .tb *::before, .tb *::after { box-sizing: border-box; }
.tb a { text-decoration: none; }
.tb-wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- Hero ---------- */
.tb-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(900px 420px at 85% -10%, rgba(0, 180, 216, .28), transparent 60%),
        radial-gradient(700px 380px at 0% 110%, rgba(0, 112, 173, .35), transparent 60%),
        linear-gradient(160deg, var(--tb-dark) 0%, var(--tb-navy) 100%);
    padding: 80px 0 72px;
}
.tb-hero::after {
    content: "";
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
    pointer-events: none;
}
.tb-hero .tb-wrap { position: relative; z-index: 1; }
.tb-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
    color: var(--tb-accent-2);
    background: rgba(0, 180, 216, .1);
    border: 1px solid rgba(0, 180, 216, .3);
    padding: 6px 14px; border-radius: 999px;
}
.tb-hero h1 {
    color: #fff;
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
    margin: 20px 0 16px; max-width: 900px;
}
.tb-hero p.tb-sub { font-size: 18px; line-height: 1.6; color: rgba(255,255,255,.72); max-width: 640px; margin: 0; }

.tb-search {
    margin-top: 32px; max-width: 520px; position: relative;
}
.tb-search input {
    width: 100%; height: 54px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: #fff; font-size: 16px; padding: 0 22px 0 52px;
    outline: none; transition: border-color .2s, background .2s;
}
.tb-search input::placeholder { color: rgba(255,255,255,.5); }
.tb-search input:focus { border-color: var(--tb-accent-2); background: rgba(255,255,255,.12); }
.tb-search i { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.6); font-size: 18px; }

/* ---------- Cover (image or generated gradient) ---------- */
.tb-cover {
    position: relative; overflow: hidden;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(120% 90% at 100% 0%, hsla(var(--h), 90%, 60%, .55), transparent 55%),
        radial-gradient(90% 90% at 0% 100%, hsla(calc(var(--h) + 40), 85%, 45%, .6), transparent 60%),
        linear-gradient(135deg, var(--tb-dark), var(--tb-navy));
}
/* Whole image always visible (covers often have text baked in); a blurred copy fills the spare space. */
.tb-cover img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tb-cover .tb-cover-bg { object-fit: cover; filter: blur(22px) brightness(.75) saturate(1.1); transform: scale(1.2); }
.tb-cover .tb-cover-img { object-fit: contain; transition: transform .6s ease; }
.tb-cover-mark {
    position: absolute; inset: 0;
    display: flex; align-items: flex-end; padding: 22px;
    font-size: 64px; font-weight: 900; letter-spacing: -.04em; line-height: .9;
    color: rgba(255,255,255,.14);
}

/* ---------- Featured post ---------- */
.tb-main { padding: 64px 0 96px; background: var(--tb-surface); }
.tb-featured {
    display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
    background: #fff; border-radius: var(--tb-radius); overflow: hidden;
    box-shadow: var(--if-shadow-md, 0 10px 30px rgba(0,0,0,.07));
    margin-bottom: 56px; color: inherit;
    transition: transform .3s ease, box-shadow .3s ease;
}
.tb-featured:hover { transform: translateY(-4px); box-shadow: var(--if-shadow-lg, 0 20px 45px rgba(6,11,23,.12)); }
.tb-featured:hover .tb-cover-img { transform: scale(1.03); }
.tb-featured .tb-cover { aspect-ratio: auto; min-height: 340px; height: 100%; }
.tb-featured-body { padding: 44px 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.tb-featured-body h2 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.2; font-weight: 800; color: var(--tb-heading); margin: 14px 0 14px; letter-spacing: -.01em; }
.tb-featured-body p { font-size: 16.5px; line-height: 1.7; color: var(--tb-muted); margin: 0 0 26px; }
.tb-tag {
    display: inline-block; align-self: flex-start;
    font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--tb-accent); background: rgba(0,112,173,.08);
    padding: 5px 12px; border-radius: 999px;
}

/* ---------- Grid ---------- */
.tb-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.tb-section-head h2 { font-size: 24px; font-weight: 800; color: var(--tb-heading); margin: 0; }
.tb-count { font-size: 14px; color: var(--tb-muted); }

.tb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.tb-card {
    display: flex; flex-direction: column;
    background: #fff; border-radius: var(--tb-radius); overflow: hidden;
    border: 1px solid var(--tb-border); color: inherit;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.tb-card:hover { transform: translateY(-6px); box-shadow: var(--if-shadow-lg, 0 20px 45px rgba(6,11,23,.12)); border-color: transparent; }
.tb-card:hover .tb-cover-img { transform: scale(1.03); }
.tb-card-body { padding: 24px 24px 22px; display: flex; flex-direction: column; flex: 1; }
.tb-card h3 { font-size: 19px; line-height: 1.35; font-weight: 700; color: var(--tb-heading); margin: 0 0 10px; }
.tb-card p { font-size: 15px; line-height: 1.65; color: var(--tb-muted); margin: 0 0 20px; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.tb-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--tb-muted); }
.tb-meta i { margin-right: 5px; }
.tb-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--tb-accent), var(--tb-accent-2));
}
.tb-author { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--tb-heading); }
.tb-readmore { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; color: var(--tb-accent); }
.tb-readmore i { transition: transform .2s; }
.tb-featured:hover .tb-readmore i, .tb-card:hover .tb-readmore i { transform: translateX(4px); }

.tb-empty { text-align: center; padding: 64px 20px; color: var(--tb-muted); font-size: 17px; }
.tb-empty i { font-size: 40px; display: block; margin-bottom: 12px; color: var(--tb-accent); }

/* ---------- CTA band ---------- */
.tb-cta {
    margin-top: 72px; border-radius: 24px; padding: 48px;
    display: flex; align-items: center; justify-content: space-between; gap: 32px;
    color: #fff;
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(0,180,216,.35), transparent 60%),
        linear-gradient(135deg, var(--tb-navy), var(--tb-dark));
}
.tb-cta h3 { color: #fff; font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; margin: 0 0 8px; }
.tb-cta p { color: rgba(255,255,255,.72); margin: 0; font-size: 16px; line-height: 1.6; }
.tb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 50px; padding: 0 26px; border-radius: 999px; border: 0;
    font-weight: 600; font-size: 15.5px; white-space: nowrap; cursor: pointer;
    background: linear-gradient(135deg, var(--tb-accent), var(--tb-accent-2));
    color: #fff !important; box-shadow: 0 10px 24px rgba(0,112,173,.3);
    transition: transform .2s, box-shadow .2s;
}
.tb-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,112,173,.4); }
.tb-btn-ghost { background: rgba(255,255,255,.1); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.tb-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ==========================================================================
   Detail page
   ========================================================================== */
.tb-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 10000;
    background: linear-gradient(90deg, var(--if-primary, #0070ad), var(--if-cyan, #00b4d8));
    transition: width .1s linear;
}
.tb-post-hero { padding: 64px 0 60px; }
.tb-crumbs { font-size: 14px; color: rgba(255,255,255,.6); margin-bottom: 22px; }
.tb-crumbs a { color: rgba(255,255,255,.8); }
.tb-crumbs a:hover { color: #fff; }
.tb-crumbs span { margin: 0 8px; opacity: .5; }
.tb-post-hero h1 { max-width: 920px; font-size: clamp(30px, 4.4vw, 52px); }
.tb-post-hero .tb-meta { color: rgba(255,255,255,.7); font-size: 15px; gap: 10px 22px; margin-top: 28px; }
.tb-post-hero .tb-author { color: #fff; }
.tb-post-hero .tb-avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 14px; }

.tb-post-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px;
    padding: 56px 0 40px; align-items: start;
}

/* Article typography */
.tb-article { font-size: 18px; line-height: 1.8; color: var(--tb-body); min-width: 0; }
.tb-article > *:first-child { margin-top: 0; }
.tb-article p { margin: 0 0 1.3em; }
.tb-article p.lead { font-size: 21px; line-height: 1.7; color: var(--tb-heading); font-weight: 400; margin-bottom: 1.6em; }
.tb-article h2 {
    font-size: clamp(24px, 2.4vw, 30px); font-weight: 800; color: var(--tb-heading);
    line-height: 1.25; letter-spacing: -.01em; margin: 2.1em 0 .7em; scroll-margin-top: 110px;
}
.tb-article h3 { font-size: 21px; font-weight: 700; color: var(--tb-heading); margin: 1.8em 0 .6em; scroll-margin-top: 110px; }
.tb-article a { color: var(--tb-accent); text-decoration: underline; text-decoration-color: rgba(0,112,173,.35); text-underline-offset: 3px; }
.tb-article a:hover { text-decoration-color: var(--tb-accent); }
.tb-article ul, .tb-article ol { padding-left: 1.3em; margin: 0 0 1.4em; }
.tb-article li { margin-bottom: .55em; padding-left: .2em; }
.tb-article li::marker { color: var(--tb-accent); font-weight: 700; }
.tb-article strong { color: var(--tb-heading); }
.tb-article img { max-width: 100%; height: auto; border-radius: 14px; margin: 1em 0; }
.tb-article blockquote {
    margin: 1.8em 0; padding: 18px 24px; border-left: 4px solid var(--tb-accent);
    background: var(--tb-surface); border-radius: 0 12px 12px 0; font-size: 19px; color: var(--tb-heading);
}
.tb-article code {
    font-family: Consolas, 'SFMono-Regular', Menlo, monospace; font-size: .85em;
    background: #eef2f7; color: #0b4a6f; padding: 2px 7px; border-radius: 6px; word-break: break-word;
}
.tb-article pre { background: var(--tb-dark); color: #e2e8f0; padding: 20px; border-radius: 12px; overflow-x: auto; font-size: 15px; }
.tb-article pre code { background: none; color: inherit; padding: 0; }
.tb-article table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 16px; display: block; overflow-x: auto; }
.tb-article th, .tb-article td { border: 1px solid var(--tb-border); padding: 12px 14px; text-align: left; vertical-align: top; }
.tb-article thead th { background: var(--tb-navy); color: #fff; border-color: var(--tb-navy); font-weight: 600; }
.tb-article tbody tr:nth-child(even) td { background: var(--tb-surface); }
.tb-article small { color: var(--tb-muted); }

/* Sidebar */
.tb-aside { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 22px; }
.tb-box { background: #fff; border: 1px solid var(--tb-border); border-radius: 16px; padding: 22px; }
.tb-box-title { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tb-muted); margin: 0 0 14px; }
.tb-toc { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; }
.tb-toc li { margin: 0; }
.tb-toc a {
    display: block; padding: 7px 0 7px 14px; border-left: 2px solid var(--tb-border);
    font-size: 14px; line-height: 1.45; color: var(--tb-muted); transition: color .2s, border-color .2s;
}
.tb-toc a:hover { color: var(--tb-heading); }
.tb-toc a.active { color: var(--tb-accent); border-left-color: var(--tb-accent); font-weight: 600; }

.tb-share { display: flex; gap: 10px; flex-wrap: wrap; }
.tb-share a, .tb-share button {
    width: 42px; height: 42px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--tb-border); background: #fff; color: var(--tb-heading);
    font-size: 17px; cursor: pointer; transition: all .2s;
}
.tb-share a:hover, .tb-share button:hover { background: var(--tb-accent); border-color: var(--tb-accent); color: #fff; }
.tb-share .copied { background: var(--if-emerald, #10b981) !important; border-color: var(--if-emerald, #10b981) !important; color: #fff !important; }

.tb-box-cta {
    border: 0; color: #fff;
    background: radial-gradient(260px 200px at 100% 0%, rgba(0,180,216,.4), transparent 60%), linear-gradient(150deg, var(--tb-navy), var(--tb-dark));
}
.tb-box-cta h4 { color: #fff; font-size: 19px; font-weight: 700; margin: 0 0 8px; line-height: 1.35; }
.tb-box-cta p { color: rgba(255,255,255,.72); font-size: 14.5px; line-height: 1.6; margin: 0 0 18px; }
.tb-box-cta .tb-btn { width: 100%; height: 46px; font-size: 15px; }
.tb-box-cta .tb-btn + .tb-btn { margin-top: 10px; }

/* Author card */
.tb-author-card {
    display: flex; gap: 18px; align-items: center;
    border-top: 1px solid var(--tb-border); border-bottom: 1px solid var(--tb-border);
    padding: 26px 0; margin: 40px 0 0;
}
.tb-author-card .tb-avatar { width: 56px; height: 56px; flex-basis: 56px; font-size: 19px; }
.tb-author-card strong { display: block; color: var(--tb-heading); font-size: 17px; }
.tb-author-card span { color: var(--tb-muted); font-size: 15px; }

/* Related */
.tb-related { background: var(--tb-surface); padding: 72px 0; }

/* Comments */
.tb-comments { padding: 72px 0 96px; }
.tb-comments-inner { max-width: 760px; }
.tb-comments h2 { font-size: 26px; font-weight: 800; color: var(--tb-heading); margin: 0 0 8px; }
.tb-comments .tb-hint { color: var(--tb-muted); font-size: 15px; margin: 0 0 28px; }
.tb-comment { display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--tb-border); }
.tb-comment .tb-avatar { width: 42px; height: 42px; flex-basis: 42px; font-size: 14px; }
.tb-comment-head { font-size: 15px; margin-bottom: 4px; }
.tb-comment-head strong { color: var(--tb-heading); margin-right: 8px; }
.tb-comment-head span { color: var(--tb-muted); font-size: 13.5px; }
.tb-comment p { margin: 0; font-size: 16px; line-height: 1.7; white-space: pre-line; }

.tb-form { margin-top: 36px; background: var(--tb-surface); border-radius: 20px; padding: 32px; }
.tb-form h3 { font-size: 21px; font-weight: 700; color: var(--tb-heading); margin: 0 0 6px; }
.tb-form .tb-hint { margin-bottom: 22px; }
.tb-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tb-field { margin-bottom: 16px; }
.tb-field label { display: block; font-size: 14px; font-weight: 600; color: var(--tb-heading); margin-bottom: 6px; }
.tb-field input, .tb-field textarea {
    width: 100%; border: 1px solid var(--tb-border); border-radius: 12px; background: #fff;
    padding: 12px 16px; font-size: 16px; color: var(--tb-heading); font-family: inherit;
    transition: border-color .2s, box-shadow .2s; box-shadow: none; height: auto;
}
.tb-field textarea { min-height: 130px; resize: vertical; }
.tb-field input:focus, .tb-field textarea:focus { outline: none; border-color: var(--tb-accent); box-shadow: 0 0 0 4px rgba(0,112,173,.12); }
.tb-field .text-danger { font-size: 13px; margin-top: 4px; display: block; }
.tb-alert { border-radius: 12px; padding: 14px 18px; font-size: 15px; margin-bottom: 20px; }
.tb-alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tb-alert-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .tb-grid { grid-template-columns: repeat(2, 1fr); }
    .tb-post-layout { grid-template-columns: 1fr; gap: 40px; }
    .tb-aside { position: static; }
    .tb-toc-box { display: none; }
}
@media (max-width: 768px) {
    .tb-hero { padding: 56px 0 48px; }
    .tb-featured { grid-template-columns: 1fr; }
    .tb-featured .tb-cover { min-height: 0; aspect-ratio: 16 / 9; }
    .tb-featured-body { padding: 28px 24px; }
    .tb-cta { flex-direction: column; align-items: flex-start; padding: 32px 24px; }
    .tb-article { font-size: 17px; }
    .tb-article p.lead { font-size: 19px; }
    .tb-form { padding: 24px 18px; }
    .tb-form-row { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 600px) {
    .tb-wrap { padding: 0 16px; }
    .tb-grid { grid-template-columns: 1fr; gap: 20px; }
    .tb-main { padding: 40px 0 64px; }
}
@media (prefers-reduced-motion: reduce) {
    .tb *, .tb-progress { transition: none !important; }
}

/* ---------- Split post hero (cover set in /admin/blogs) ---------- */
.tb-post-hero--split { padding: 56px 0 64px; }
.tb-post-hero--split .tb-wrap {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 56px; align-items: center;
}
.tb-post-hero--split h1 { font-size: clamp(28px, 3.2vw, 44px); }
.tb-post-hero--split .tb-sub { font-size: 17px; }
.tb-post-hero-cover {
    margin: 0; border-radius: 20px; overflow: hidden;
    background: rgba(255,255,255,.06);
    box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08);
}
.tb-post-hero-cover img { width: 100%; height: auto; display: block; } /* natural shape, never cropped */
@media (max-width: 1024px) {
    .tb-post-hero--split .tb-wrap { grid-template-columns: 1fr; gap: 32px; }
    .tb-post-hero-cover { max-width: 760px; }
}

/* ---------- Heading colours ----------
   custom.css sets "body.v2-redesign h1..h6 { color: var(--if-text-heading) }", which outranks a single
   class selector and turned headings on dark backgrounds dark. These selectors are more specific on purpose. */
body.v2-redesign .tb .tb-hero h1,
body.v2-redesign .tb .tb-cta h3,
body.v2-redesign .tb .tb-box-cta h4 { color: #fff; }
body.v2-redesign .tb .tb-featured-body h2,
body.v2-redesign .tb .tb-card h3,
body.v2-redesign .tb .tb-section-head h2,
body.v2-redesign .tb .tb-article h2,
body.v2-redesign .tb .tb-article h3,
body.v2-redesign .tb .tb-comments h2,
body.v2-redesign .tb .tb-form h3 { color: var(--tb-heading); }
