﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #0c0c0e;
      --bg-surface: #131316;
      --bg-card: #18181d;
      --bg-card-hover: #1e1e25;
      --border: rgba(255,255,255,0.07);
      --border-hover: rgba(255,255,255,0.15);
      --text-primary: #f0eff5;
      --text-secondary: #8a8898;
      --text-muted: #4a4a5a;
      --accent: #7c6af7;
      --accent-glow: rgba(124,106,247,0.15);
      --accent-dim: rgba(124,106,247,0.08);
      --tag-prog: #1a2e1a;       --tag-prog-text: #5fc97a;
      --tag-interop: #1a1f2e;    --tag-interop-text: #5b8ff7;
      --tag-tut: #2a1f10;        --tag-tut-text: #e8a04a;
      --tag-tools: #251a2a;      --tag-tools-text: #c46ef0;
      --font-display: 'Syne', sans-serif;
      --font-body: 'DM Sans', sans-serif;
      --font-mono: 'DM Mono', monospace;
      --px: 1.25rem;
      --content-w: 720px;
    }

    @media (min-width: 640px)  { :root { --px: 2rem; } }
    @media (min-width: 1024px) { :root { --px: clamp(2rem, 5vw, 4rem); } }

    html { scroll-behavior: smooth; scroll-padding-top: 60px; }

    body {
      background: var(--bg);
      color: var(--text-primary);
      font-family: var(--font-body);
      font-size: 16px;
      line-height: 1.7;
      min-height: 100vh;
      overflow-x: hidden;
      padding-top: 60px;
    }

    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
      pointer-events: none;
      z-index: 0;
      opacity: 0.4;
    }

    /* â”€â”€ NAV â”€â”€ */
    .nav {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 var(--px);
      height: 60px;
      background: rgba(12,12,14,0.92);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border);
    }

    .nav-brand { display: flex; align-items: center; text-decoration: none; }

    .nav-name {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 16px;
      color: var(--text-primary);
      letter-spacing: -0.3px;
    }

    .nav-links {
      display: none;
      align-items: center;
      gap: 1.5rem;
      list-style: none;
    }

    .nav-links a {
      color: var(--text-secondary);
      text-decoration: none;
      font-size: 14px;
      transition: color 0.2s;
    }

    .nav-links a:hover, .nav-links a.active { color: var(--text-primary); }

    .nav-cta {
      background: var(--accent-dim);
      border: 1px solid rgba(124,106,247,0.3);
      color: var(--accent) !important;
      padding: 6px 14px;
      border-radius: 6px;
      font-size: 13px !important;
      transition: background 0.2s !important;
    }

    .nav-cta:hover { background: var(--accent-glow) !important; }

    .nav-hamburger {
      display: flex;
      flex-direction: column;
      gap: 5px;
      background: none;
      border: none;
      cursor: pointer;
      padding: 6px;
      border-radius: 6px;
      transition: background 0.2s;
    }

    .nav-hamburger span {
      display: block;
      width: 22px;
      height: 2px;
      background: var(--text-secondary);
      border-radius: 2px;
      transition: transform 0.25s, opacity 0.25s, width 0.25s;
    }

    .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
    .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .nav-drawer {
      display: none;
      position: fixed;
      top: 60px;
      left: 0; right: 0;
      z-index: 99;
      background: rgba(12,12,14,0.97);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border);
      padding: 1rem var(--px) 1.5rem;
      flex-direction: column;
    }

    .nav-drawer.open { display: flex; }

    .nav-drawer a {
      display: block;
      color: var(--text-secondary);
      text-decoration: none;
      font-size: 15px;
      padding: 0.75rem 0;
      border-bottom: 1px solid var(--border);
      transition: color 0.2s;
    }

    .nav-drawer a:last-child { border-bottom: none; }
    .nav-drawer a:hover { color: var(--text-primary); }
    .nav-drawer .nav-cta { margin-top: 0.75rem; display: inline-block; border-bottom: none !important; }

    @media (min-width: 768px) {
      .nav-links { display: flex; }
      .nav-hamburger { display: none; }
      .nav-drawer { display: none !important; }
    }

    /* â”€â”€ PROGRESS BAR â”€â”€ */
    .reading-progress {
      position: fixed;
      top: 60px;
      left: 0;
      width: 0%;
      height: 2px;
      background: var(--accent);
      z-index: 101;
      transition: width 0.1s linear;
    }

    /* â”€â”€ BREADCRUMB â”€â”€ */
    .breadcrumb {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 1rem var(--px) 0;
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--text-muted);
      flex-wrap: wrap;
    }

    .breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
    .breadcrumb a:hover { color: var(--accent); }
    .breadcrumb-sep { opacity: 0.4; }
    .breadcrumb-current { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

    /* â”€â”€ ARTICLE HERO â”€â”€ */
    .article-hero {
      padding: 1.5rem var(--px) 0;
    }

    @media (min-width: 640px) { .article-hero { padding-top: 2rem; } }

    .article-tag {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: 0.05em;
      padding: 3px 9px;
      border-radius: 5px;
      text-transform: uppercase;
      margin-bottom: 1rem;
    }

    .tag-programacao        { background: var(--tag-prog);   color: var(--tag-prog-text); }
    .tag-interoperabilidade { background: var(--tag-interop); color: var(--tag-interop-text); }
    .tag-tutoriais          { background: var(--tag-tut);    color: var(--tag-tut-text); }
    .tag-ferramentas        { background: var(--tag-tools);  color: var(--tag-tools-text); }

    .article-title {
      font-family: var(--font-display);
      font-size: clamp(1.6rem, 5vw, 2.6rem);
      font-weight: 800;
      line-height: 1.15;
      letter-spacing: -0.03em;
      color: var(--text-primary);
      margin-bottom: 1rem;
    }

    .article-meta {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.4rem 1rem;
      margin-bottom: 1.5rem;
    }

    .article-author { display: flex; align-items: center; gap: 8px; }

    .author-avatar {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--accent-dim);
      border: 1px solid rgba(124,106,247,0.3);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-display);
      font-size: 11px;
      font-weight: 700;
      color: var(--accent);
      flex-shrink: 0;
      overflow: hidden;
    }

    .author-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .author-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
    .meta-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }
    .meta-item { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

    /* â”€â”€ COVER IMAGE â”€â”€ */
    .article-cover {
      padding: 0 var(--px);
      margin-top: 0;
    }

    .article-cover img {
      width: 100%;
      height: 200px;
      object-fit: cover;
      border-radius: 12px;
      display: block;
      border: 1px solid var(--border);
    }

    .article-cover .cover-empty--article {
      width: 100%;
      height: 200px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-card);
      color: var(--text-muted);
      border: 1px dashed var(--border);
      border-radius: 12px;
    }

    .article-cover .cover-empty--article svg {
      opacity: 0.35;
      flex-shrink: 0;
    }

    @media (min-width: 480px) {
      .article-cover img,
      .article-cover .cover-empty--article { height: 260px; }
    }
    @media (min-width: 640px) {
      .article-cover img,
      .article-cover .cover-empty--article { height: 340px; border-radius: 14px; }
    }
    @media (min-width: 900px) {
      .article-cover img,
      .article-cover .cover-empty--article { height: 420px; }
    }

    .rel-cover .cover-empty--related {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      background: #0e0e12;
      color: var(--text-muted);
    }

    .rel-cover .cover-empty--related svg {
      width: 32px;
      height: 32px;
      opacity: 0.35;
      flex-shrink: 0;
    }

    /* â”€â”€ ARTICLE LAYOUT: mobile = single col, desktop = content + sidebar â”€â”€ */
    .article-layout {
      display: grid;
      grid-template-columns: 1fr;
      gap: 0;
      padding: 2rem var(--px) 3rem;
    }

    @media (min-width: 1024px) {
      .article-layout {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 4rem;
        align-items: start;
        padding-bottom: 4rem;
      }
    }

    /* â”€â”€ ARTICLE CONTENT â”€â”€ */
    .article-content {
      min-width: 0;
      max-width: 720px;
    }

    .article-content h2 {
      font-family: var(--font-display);
      font-size: clamp(1.2rem, 3.5vw, 1.5rem);
      font-weight: 700;
      letter-spacing: -0.02em;
      color: var(--text-primary);
      margin: 2rem 0 0.9rem;
      line-height: 1.25;
    }

    .article-content h3 {
      font-family: var(--font-display);
      font-size: clamp(1.05rem, 3vw, 1.2rem);
      font-weight: 700;
      letter-spacing: -0.01em;
      color: var(--text-primary);
      margin: 1.75rem 0 0.65rem;
    }

    .article-content p {
      color: var(--text-secondary);
      margin-bottom: 1.25rem;
      font-size: 15px;
      line-height: 1.8;
    }

    @media (min-width: 640px) { .article-content p { font-size: 16px; } }

    .article-content strong { color: var(--text-primary); font-weight: 600; }

    .article-content a {
      color: var(--accent);
      text-decoration: underline;
      text-decoration-color: rgba(124,106,247,0.3);
      transition: text-decoration-color 0.2s;
    }

    .article-content a:hover { text-decoration-color: var(--accent); }

    .article-content ul, .article-content ol {
      color: var(--text-secondary);
      padding-left: 1.25rem;
      margin-bottom: 1.25rem;
    }

    .article-content li { margin-bottom: 0.4rem; line-height: 1.75; font-size: 15px; }
    @media (min-width: 640px) { .article-content li { font-size: 16px; } }

    .article-content blockquote {
      border-left: 3px solid var(--accent);
      padding: 0.75rem 1rem;
      margin: 1.5rem 0;
      background: var(--accent-dim);
      border-radius: 0 8px 8px 0;
    }

    .article-content blockquote p { color: var(--text-primary); margin: 0; font-style: italic; font-size: 15px; }

    .article-content pre {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 1rem;
      overflow-x: auto;
      margin: 1.25rem 0;
      scrollbar-width: thin;
      /* prevent pre from stretching layout on mobile */
      max-width: 100%;
    }

    @media (min-width: 640px) { .article-content pre { padding: 1.25rem 1.5rem; } }

    .article-content code {
      font-family: var(--font-mono);
      font-size: 12px;
      line-height: 1.7;
      color: #c8c0f8;
    }

    @media (min-width: 640px) { .article-content code { font-size: 13px; } }

    .article-content p code, .article-content li code {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 2px 5px;
      font-size: 12px;
      color: var(--accent);
    }

    .article-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

    .article-content img {
      width: 100%;
      border-radius: 10px;
      border: 1px solid var(--border);
      margin: 1.25rem 0;
      display: block;
    }

    /* â”€â”€ SIDEBAR â”€â”€ */
    /* On mobile: sidebar shows below content as a flat strip, no card style */
    .article-sidebar {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      margin-top: 2rem;
      padding-top: 2rem;
      border-top: 1px solid var(--border);
    }

    @media (min-width: 1024px) {
      .article-sidebar {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        position: sticky;
        top: 80px;
        gap: 1.5rem;
      }
    }

    .sidebar-widget {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 1rem;
    }

    /* On mobile TOC: collapse to a scrollable horizontal strip */
    @media (max-width: 1023px) {
      .sidebar-toc { display: none; }
    }

    .sidebar-widget-title {
      font-family: var(--font-mono);
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 0.75rem;
    }

    .toc-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

    .toc-item a {
      display: block;
      font-size: 13px;
      color: var(--text-secondary);
      text-decoration: none;
      padding: 4px 8px;
      border-radius: 6px;
      border-left: 2px solid transparent;
      transition: all 0.2s;
      line-height: 1.4;
    }

    .toc-item a:hover { color: var(--text-primary); background: var(--bg-card); }
    .toc-item.active a { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }
    .toc-item.sub a { padding-left: 1.25rem; font-size: 12px; }

    /* AUTHOR WIDGET */
    .author-widget {
      display: flex;
      align-items: center;
      gap: 1rem;
      text-align: left;
    }

    @media (min-width: 1024px) {
      .author-widget { flex-direction: column; align-items: center; text-align: center; }
    }

    .author-widget-avatar {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--accent-dim);
      border: 2px solid rgba(124,106,247,0.3);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-display);
      font-size: 15px;
      font-weight: 800;
      color: var(--accent);
      flex-shrink: 0;
      overflow: hidden;
    }

    .author-widget-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .author-widget-name { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text-primary); }
    .author-widget-bio  { font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-top: 2px; }

    /* â”€â”€ RELATED ARTICLES â”€â”€ */
    .related-section {
      padding: 0 var(--px) 3rem;
      border-top: 1px solid var(--border);
    }

    .related-header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 2rem 0 1.25rem;
      font-family: var(--font-display);
      font-size: 17px;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: var(--text-primary);
    }

    .related-header::after {
      content: '';
      display: block;
      width: 28px;
      height: 2px;
      background: var(--accent);
      border-radius: 2px;
    }

    .related-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px;
    }

    @media (min-width: 480px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }
    @media (min-width: 900px) { .related-grid { grid-template-columns: repeat(3, 1fr); } }

    .rel-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
      text-decoration: none;
      display: flex;
      flex-direction: column;
      transition: border-color 0.2s, transform 0.22s, background 0.2s;
      -webkit-tap-highlight-color: transparent;
    }

    @media (hover: hover) {
      .rel-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-3px); }
      .rel-card:hover .rel-cover img { transform: scale(1.04); }
      .rel-card:hover .rel-arrow { background: var(--accent-glow); }
    }

    .rel-cover { position: relative; height: 140px; overflow: hidden; background: #0e0e12; }
    .rel-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; opacity: 0.85; }
    .rel-cover-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.55) 100%); }

    .rel-body { padding: 0.9rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; }

    .rel-title {
      font-family: var(--font-display);
      font-size: 14px;
      font-weight: 700;
      line-height: 1.35;
      letter-spacing: -0.01em;
      color: var(--text-primary);
      flex: 1;
    }

    .rel-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid var(--border); margin-top: 0.75rem; }
    .rel-date   { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

    .rel-arrow {
      width: 24px; height: 24px; border-radius: 6px;
      background: var(--accent-dim); border: 1px solid rgba(124,106,247,0.2);
      display: flex; align-items: center; justify-content: center;
      color: var(--accent); font-size: 13px; transition: background 0.2s;
    }

    /* â”€â”€ FOOTER â”€â”€ */
    .footer {
      border-top: 1px solid var(--border);
      padding: 1.5rem var(--px);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1rem;
      text-align: center;
    }

    @media (min-width: 640px) { .footer { flex-direction: row; justify-content: space-between; text-align: left; } }

    .footer-brand { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text-primary); }
    .footer-links { display: flex; gap: 1.25rem; list-style: none; flex-wrap: wrap; justify-content: center; }
    .footer-links a { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
    .footer-links a:hover { color: var(--text-primary); }
    .footer-copy { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
