/* Tech Interview homepage — code-influenced, brand: #2980b9 blue + #2ecc71 green */

:root {
    --ti-blue: #2980b9;
    --ti-blue-dark: #1f5f8b;
    --ti-blue-light: #3498db;
    --ti-green: #2ecc71;
    --ti-green-dark: #27ae60;
    --ti-navy: #0b1220;
    --ti-ink: #0f172a;
    --ti-text: #2d3748;
    --ti-muted: #5b6b7e;
    --ti-border: #e3e8ef;
    --ti-surface: #ffffff;
    --ti-surface-alt: #f5f7fa;
    --ti-mono: ui-monospace, "SF Mono", Menlo, Consolas, "JetBrains Mono", "Fira Code", monospace;
}

.ti-homepage {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ti-text);
}
.ti-homepage a { color: var(--ti-blue); }
.ti-container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.ti-section { padding: 64px 0; }
.ti-section:nth-child(even) { background: var(--ti-surface-alt); }

/* ======= HERO ======= */
.ti-hero {
    background:
        radial-gradient(circle at 18% 20%, rgba(41,128,185,0.35) 0%, transparent 50%),
        radial-gradient(circle at 85% 80%, rgba(46,204,113,0.22) 0%, transparent 55%),
        linear-gradient(135deg, #0b1220 0%, #122036 55%, #0b1220 100%);
    color: #f0f6ff;
    padding: 88px 0 72px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.ti-hero::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
    pointer-events: none;
}
.ti-hero .ti-container { position: relative; }
.ti-hero-tag {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--ti-mono); font-size: 0.8rem; letter-spacing: 0.04em;
    color: #9ec9ff;
    background: rgba(52,152,219,0.14);
    border: 1px solid rgba(52,152,219,0.35);
    padding: 6px 14px; border-radius: 999px;
    margin-bottom: 22px;
}
.ti-hero-tag .ti-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ti-green); box-shadow: 0 0 12px var(--ti-green); }

.ti-hero h1 {
    color: #ffffff !important;
    font-size: clamp(2.1rem, 4.8vw, 3.4rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 18px;
    letter-spacing: -0.02em;
}
.ti-hero h1 .ti-accent {
    color: #4fc3f7 !important;
    -webkit-text-fill-color: #4fc3f7 !important;
    font-family: var(--ti-mono);
    font-weight: 700;
    text-shadow: 0 0 24px rgba(79,195,247,0.35);
}
.ti-hero-sub {
    color: #c5d3e3 !important;
    font-size: 1.12rem;
    max-width: 720px;
    margin: 0 auto 34px;
    line-height: 1.65;
}
.ti-hero-sub code {
    font-family: var(--ti-mono); font-size: 0.92em;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 2px 7px; border-radius: 4px;
    color: #e5f0ff;
}
.ti-search {
    max-width: 640px; margin: 0 auto 36px;
    display: flex; gap: 0;
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
    border-radius: 10px;
}
.ti-search input {
    flex: 1; padding: 16px 20px; font-size: 1rem;
    border: none; border-radius: 10px 0 0 10px;
    background: #ffffff; color: var(--ti-ink); outline: none;
    font-family: inherit;
}
.ti-search input::placeholder { color: #8a9aae; }
.ti-search button {
    padding: 16px 32px; font-size: 1rem; font-weight: 600;
    background: var(--ti-blue); color: #fff; border: none;
    border-radius: 0 10px 10px 0; cursor: pointer;
    transition: background 0.15s ease;
}
.ti-search button:hover { background: var(--ti-blue-dark); }

.ti-hero-stats {
    display: flex; justify-content: center; gap: 48px;
    font-family: var(--ti-mono); font-size: 0.88rem;
    color: #9ec9ff;
}
.ti-hero-stats span { display: flex; flex-direction: column; align-items: center; }
.ti-hero-stats strong {
    color: #ffffff; font-size: 1.55rem; font-weight: 700;
    font-family: var(--ti-mono); margin-bottom: 2px;
}

/* ======= SECTION HEADERS ======= */
.ti-section h2 {
    font-size: 1.75rem; font-weight: 700;
    margin: 0 0 8px; color: var(--ti-ink);
    letter-spacing: -0.01em;
}
.ti-section h2::before {
    content: "// ";
    color: var(--ti-green-dark);
    font-family: var(--ti-mono); font-weight: 500;
    opacity: 0.75;
    letter-spacing: -0.02em;
}
.ti-section-sub { color: var(--ti-muted); margin: 0 0 28px; font-size: 1rem; max-width: 780px; }
.ti-view-all {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 20px; color: var(--ti-blue);
    font-weight: 600; text-decoration: none; font-size: 0.95rem;
    font-family: var(--ti-mono);
}
.ti-view-all:hover { color: var(--ti-blue-dark); text-decoration: underline; }

/* ======= CARDS (3-COL) ======= */
.ti-cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.ti-card {
    background: var(--ti-surface);
    border: 1px solid var(--ti-border); border-radius: 14px;
    padding: 26px 26px 22px; text-decoration: none; color: var(--ti-text);
    display: block; position: relative; overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.15s ease;
}
.ti-card::after {
    content: "";
    position: absolute; left: 0; right: 0; top: 0; height: 4px;
    background: linear-gradient(90deg, transparent, transparent);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.ti-card:hover {
    box-shadow: 0 16px 40px rgba(15,23,42,0.10);
    transform: translateY(-3px);
    border-color: var(--ti-blue);
}
.ti-card:hover::after { opacity: 1; }
.ti-card h2, .ti-card h3 {
    margin: 0 0 8px; color: var(--ti-ink);
    font-size: 1.25rem; font-weight: 700;
}
.ti-card h2::before, .ti-card h3::before { content: none; }
.ti-card p { margin: 0 0 14px; color: var(--ti-muted); font-size: 0.95rem; line-height: 1.55; }

.ti-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.ti-card-icon {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, rgba(41,128,185,0.10), rgba(46,204,113,0.10));
    border: 1px solid var(--ti-border);
    border-radius: 10px;
}
.ti-card-count {
    font-family: var(--ti-mono); font-size: 0.78rem; font-weight: 600;
    color: var(--ti-blue);
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--ti-surface-alt);
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--ti-border);
}
.ti-card-count::before { content: "→"; color: var(--ti-green); }

/* Card preview (pill row at the bottom) */
.ti-card-pills {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 4px;
}
.ti-card-pills span {
    font-family: var(--ti-mono); font-size: 0.74rem; font-weight: 500;
    color: var(--ti-muted);
    background: var(--ti-surface-alt);
    border: 1px solid var(--ti-border);
    padding: 3px 9px; border-radius: 6px;
    white-space: nowrap;
}

/* Card logo strip (Company Guides card) */
.ti-card-logos {
    display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
    margin-top: 4px; overflow: hidden;
}
.ti-card-logos img {
    width: 24px; height: 24px;
    border-radius: 5px;
    background: var(--ti-surface);
    padding: 2px;
    border: 1px solid var(--ti-border);
    flex-shrink: 0;
    transition: transform 0.18s ease;
}
.ti-card:hover .ti-card-logos img { transform: translateY(-1px); }

/* Per-card colour accents */
.ti-card-sd { border-top: 3px solid var(--ti-blue); }
.ti-card-sd .ti-card-icon { background: linear-gradient(135deg, rgba(41,128,185,0.16), rgba(41,128,185,0.06)); border-color: rgba(41,128,185,0.30); }
.ti-card-sd:hover { border-color: var(--ti-blue); }
.ti-card-sd::after { background: linear-gradient(90deg, var(--ti-blue), var(--ti-blue-light)); }

.ti-card-coding { border-top: 3px solid var(--ti-green); }
.ti-card-coding .ti-card-icon { background: linear-gradient(135deg, rgba(46,204,113,0.16), rgba(46,204,113,0.06)); border-color: rgba(46,204,113,0.30); }
.ti-card-coding:hover { border-color: var(--ti-green); }
.ti-card-coding .ti-card-count { color: var(--ti-green-dark); }
.ti-card-coding::after { background: linear-gradient(90deg, var(--ti-green-dark), var(--ti-green)); }

.ti-card-company { border-top: 3px solid #f39c12; }
.ti-card-company .ti-card-icon { background: linear-gradient(135deg, rgba(243,156,18,0.16), rgba(243,156,18,0.06)); border-color: rgba(243,156,18,0.30); }
.ti-card-company:hover { border-color: #f39c12; }
.ti-card-company .ti-card-count { color: #b8780b; }
.ti-card-company::after { background: linear-gradient(90deg, #f39c12, #f5b041); }

.ti-card-beginner { border-left: 4px solid var(--ti-green); }
.ti-card-intermediate { border-left: 4px solid var(--ti-blue); }
.ti-card-advanced { border-left: 4px solid #9b59b6; }

/* ======= TOPIC / PATTERN GRID ======= */
.ti-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin: 8px 0 4px;
}
.ti-grid-item {
    display: block; padding: 14px 16px;
    background: var(--ti-surface);
    border: 1px solid var(--ti-border); border-radius: 8px;
    text-decoration: none; color: var(--ti-text);
    font-size: 0.92rem; font-weight: 500;
    transition: all 0.15s ease;
    position: relative; padding-left: 30px;
}
.ti-grid-item::before {
    content: "›";
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--ti-blue); font-family: var(--ti-mono);
    font-weight: 700;
    transition: transform 0.15s ease;
}
a.ti-grid-item:hover {
    background: #eaf4fb; border-color: var(--ti-blue);
    color: var(--ti-blue-dark);
}
a.ti-grid-item:hover::before { transform: translate(3px, -50%); }
span.ti-grid-item { opacity: 0.45; cursor: default; }

/* ======= COMPANY CHIPS (with logos) ======= */
.ti-company-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px; margin-top: 22px;
}
.ti-company-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; min-height: 48px;
    background: var(--ti-surface);
    border: 1px solid var(--ti-border); border-radius: 10px;
    text-decoration: none; color: var(--ti-text);
    font-size: 0.9rem; font-weight: 600;
    transition: all 0.15s ease;
    overflow: hidden;
}
.ti-company-chip:hover {
    background: var(--ti-surface);
    border-color: var(--ti-blue);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(41,128,185,0.12);
}
.ti-chip-logo {
    width: 24px; height: 24px;
    border-radius: 5px;
    background: var(--ti-surface);
    flex-shrink: 0;
    object-fit: contain;
    /* DDG sometimes returns a transparent or invalid icon — fade in to hide flicker */
    transition: opacity 0.2s ease;
}
.ti-chip-mono {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--ti-blue), var(--ti-blue-light));
    color: #fff; font-family: var(--ti-mono); font-size: 0.78rem; font-weight: 700;
    flex-shrink: 0;
}
.ti-chip-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ti-ink);
}
.ti-company-chip:hover .ti-chip-name { color: var(--ti-blue-dark); }

/* ======= LATEST POSTS ======= */
.ti-latest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ti-latest-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 18px; background: var(--ti-surface);
    border: 1px solid var(--ti-border); border-radius: 8px;
    text-decoration: none; color: var(--ti-text);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.ti-latest-item:hover { border-color: var(--ti-blue); background: #f8fbfe; }
.ti-latest-title { font-weight: 500; font-size: 0.93rem; flex: 1; margin-right: 12px; color: var(--ti-ink); }
.ti-latest-date {
    font-family: var(--ti-mono); color: var(--ti-muted);
    font-size: 0.78rem; white-space: nowrap;
    padding: 3px 8px; background: var(--ti-surface-alt);
    border-radius: 4px;
}

/* ======= TERMINAL CURSOR — blinks after hero H1 ======= */
.ti-hero h1::after {
    content: "";
    display: inline-block;
    width: 0.55em; height: 0.95em;
    background: var(--ti-green);
    margin-left: 0.18em;
    vertical-align: -0.05em;
    box-shadow: 0 0 18px rgba(46, 204, 113, 0.55);
    animation: ti-cursor-blink 1.05s steps(2) infinite;
    border-radius: 1px;
}
@keyframes ti-cursor-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .ti-hero h1::after { animation: none; opacity: 1; }
}

/* ======= SECTION ORNAMENTS — { } in corners (alternating sections) ======= */
.ti-section { position: relative; }
.ti-section:not(.ti-hero):nth-child(odd)::before,
.ti-section:not(.ti-hero):nth-child(odd)::after {
    font-family: var(--ti-mono);
    color: rgba(41, 128, 185, 0.10);
    font-size: 7rem;
    line-height: 1;
    font-weight: 700;
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}
.ti-section:not(.ti-hero):nth-child(odd)::before {
    content: "{";
    top: 18px; left: 14px;
}
.ti-section:not(.ti-hero):nth-child(odd)::after {
    content: "}";
    bottom: 18px; right: 14px;
}
.ti-section .ti-container { position: relative; z-index: 1; }

/* ======= MICRO-LABEL above each section h2 — // section_name ======= */
.ti-sd-section .ti-container > h2,
.ti-patterns-section .ti-container > h2,
.ti-famous-section .ti-container > h2,
.ti-roadmap-section .ti-container > h2,
.ti-company-section .ti-container > h2,
.ti-cheatsheet-section .ti-container > h2,
.ti-latest-section .ti-container > h2 {
    margin-top: 0;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 900px) {
    .ti-cards-3 { grid-template-columns: 1fr; }
    .ti-grid { grid-template-columns: repeat(2, 1fr); }
    .ti-latest-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .ti-section { padding: 48px 0; }
    .ti-hero { padding: 64px 0 56px; }
    .ti-hero-stats { flex-wrap: wrap; gap: 28px; }
    .ti-search { flex-direction: column; box-shadow: none; }
    .ti-search input { border-radius: 8px; margin-bottom: 8px; }
    .ti-search button { border-radius: 8px; }
    .ti-section:not(.ti-hero):nth-child(odd)::before,
    .ti-section:not(.ti-hero):nth-child(odd)::after { font-size: 4.5rem; }
}
