/* ================================================
   Python Brasil — Custom CSS
   Styles that Tailwind CSS cannot handle natively
   ================================================ */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

:root {
  --py-blue: #306998;
  --py-blue-dark: #1f4e73;
  --py-yellow: #ffd43b;
  --ink: #111827;
  --muted: #526070;
  --line: #d7dee8;
  --surface: #ffffff;
  --surface-cool: #eef6fb;
  --surface-warm: #f7f3ea;
  --surface-ink: #14213d;
}

body {
  background: #ffffff;
  color: var(--ink);
}

::selection {
  background: rgba(255, 212, 59, 0.55);
  color: var(--ink);
}

.site-shell {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--py-blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.72rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease,
    transform 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
.section-link:focus-visible,
.path-card:focus-visible,
.resource-card a:focus-visible,
.compact-card:focus-visible {
  outline: 3px solid rgba(255, 212, 59, 0.75);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--py-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--py-blue-dark);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--py-blue);
  color: var(--py-blue);
}

.home-hero {
  background:
    linear-gradient(90deg, rgba(238, 246, 251, 0.86) 0 60%, rgba(247, 243, 234, 0.72) 60% 100%),
    #ffffff;
  border-bottom: 1px solid var(--line);
}

.home-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(22rem, 0.75fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  min-height: clamp(34rem, 78vh, 47rem);
  padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(2.5rem, 5vw, 4rem);
}

.home-hero__copy h1 {
  max-width: 12ch;
  margin: 0.65rem 0 1rem;
  color: var(--ink);
  font-size: 4.25rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.98;
}

.home-hero__copy p {
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.65;
}

.home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.home-hero__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  color: var(--muted);
}

.home-hero__metrics span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(48, 105, 152, 0.18);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
}

.home-hero__metrics strong {
  color: var(--py-blue);
  font-size: 1.15rem;
}

.code-panel {
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 0.5rem;
  background: #111827;
  box-shadow: 0 22px 55px rgba(17, 24, 39, 0.22);
}

.code-panel__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.82rem;
}

.code-panel__bar span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--py-yellow);
}

.code-panel__bar span:nth-child(2) {
  background: #60a5fa;
}

.code-panel__bar span:nth-child(3) {
  background: #34d399;
}

.code-panel__bar strong {
  margin-left: 0.35rem;
  font-weight: 700;
}

.code-panel pre {
  margin: 0;
  padding: clamp(1rem, 3vw, 1.35rem);
  overflow-x: auto;
  color: #dbeafe;
  font-size: 0.94rem;
  line-height: 1.75;
  tab-size: 4;
}

.code-panel code {
  font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", ui-monospace,
    SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.terminal-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.7rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.terminal-line span {
  color: var(--py-yellow);
}

.terminal-line strong {
  grid-column: 1 / -1;
  color: #86efac;
  font-family: inherit;
  font-weight: 700;
}

.quick-paths {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.quick-paths__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.path-card {
  display: grid;
  gap: 0.35rem;
  min-height: 9rem;
  padding: 1.1rem;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
}

.path-card:hover strong {
  color: var(--py-blue);
}

.path-card span {
  color: var(--py-blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.path-card strong {
  align-self: end;
  font-size: 1.25rem;
  line-height: 1.15;
  transition: color 160ms ease;
}

.path-card small {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.content-band {
  padding-block: clamp(3rem, 7vw, 5rem);
  background: #ffffff;
}

.content-band--warm {
  background: var(--surface-warm);
  border-block: 1px solid rgba(17, 24, 39, 0.08);
}

.content-band--blue {
  background: var(--surface-cool);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.career-strip h2 {
  margin: 0.35rem 0 0;
  color: var(--ink);
  font-size: 2.45rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
}

.section-heading p,
.career-strip p {
  max-width: 42rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.section-heading--stacked,
.section-heading--center {
  display: block;
}

.section-heading--center {
  margin-bottom: 0;
  text-align: center;
}

.section-heading--center p,
.section-heading--center .home-hero__actions {
  justify-content: center;
  margin-inline: auto;
}

.section-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--py-blue);
  font-weight: 800;
  text-decoration: none;
}

.section-link:hover {
  color: var(--py-blue-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.resource-card {
  display: flex;
  min-height: 17rem;
  flex-direction: column;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #ffffff;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.resource-card:hover {
  border-color: rgba(48, 105, 152, 0.55);
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
  transform: translateY(-2px);
}

.resource-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: #697586;
  font-size: 0.82rem;
  line-height: 1.35;
}

.resource-card h3 {
  margin: 0.85rem 0 0.55rem;
  font-size: 1.22rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.2;
}

.resource-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.resource-card h3 a:hover {
  color: var(--py-blue);
}

.resource-card p {
  display: -webkit-box;
  flex: 1;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.resource-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.resource-card__tags span {
  padding: 0.22rem 0.45rem;
  border: 1px solid rgba(48, 105, 152, 0.18);
  border-radius: 0.375rem;
  background: var(--surface-cool);
  color: var(--py-blue-dark);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.2;
}

.split-band {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.compact-card {
  display: grid;
  gap: 0.4rem;
  min-height: 7rem;
  padding: 0.95rem;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-decoration: none;
}

.compact-card:hover {
  border-color: var(--py-blue);
}

.compact-card strong {
  color: var(--py-blue-dark);
  font-size: 1rem;
  line-height: 1.2;
}

.compact-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.career-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding-block: 0.5rem;
}

.career-strip__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  min-width: min(100%, 15rem);
}

@media (max-width: 900px) {
  .home-hero__copy h1 {
    font-size: 3.2rem;
  }

  .home-hero__grid,
  .split-band,
  .career-strip {
    grid-template-columns: 1fr;
  }

  .home-hero__grid {
    min-height: auto;
  }

  .quick-paths__grid,
  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .career-strip__actions {
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 1rem, 72rem);
  }

  .home-hero__copy h1 {
    max-width: 11ch;
    font-size: 2.45rem;
  }

  .home-hero__copy p {
    font-size: 1.05rem;
  }

  .code-panel pre {
    font-size: 0.78rem;
  }

  .section-heading h2,
  .career-strip h2 {
    font-size: 1.9rem;
  }

  .home-hero__actions,
  .career-strip__actions {
    display: grid;
  }

  .home-hero__actions .btn,
  .career-strip__actions .btn {
    width: 100%;
  }

  .quick-paths__grid,
  .article-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .path-card {
    min-height: 7rem;
  }

  .section-heading {
    display: block;
  }

  .section-link {
    margin-top: 0.75rem;
  }

  .code-panel pre {
    max-height: 15rem;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------
   Code block styling for Hugo syntax highlighting
   ------------------------------------------------ */

/* Hugo wraps highlighted code in .highlight > pre > code */
.highlight {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}

.highlight pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 4;
  -webkit-overflow-scrolling: touch;
}

.highlight pre code {
  font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", "Cascadia Code",
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: transparent;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Inline code (not inside pre) */
:not(pre) > code {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  background-color: #f1f5f9;
  color: #0f172a;
  word-break: break-word;
}

/* Dark mode inline code */
.dark :not(pre) > code {
  background-color: #334155;
  color: #e2e8f0;
}

/* Code copy button positioning */
.code-copy-btn {
  opacity: 0;
  transition: opacity 0.2s ease;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

/* ------------------------------------------------
   Table of Contents (TOC) styling
   ------------------------------------------------ */

.toc {
  border-left: 3px solid #3b82f6;
  padding-left: 1rem;
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc ul ul {
  padding-left: 1rem;
}

.toc a {
  text-decoration: none;
  color: #64748b;
  transition: color 0.15s ease;
}

.toc a:hover {
  color: #3b82f6;
}

/* ------------------------------------------------
   Article content typography enhancements
   ------------------------------------------------ */

.prose table {
  font-size: 0.875rem;
}

.prose table th {
  white-space: nowrap;
}

.prose img {
  border-radius: 0.5rem;
}

/* ------------------------------------------------
   Skip to content (accessibility)
   ------------------------------------------------ */

.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: #1e293b;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.skip-to-content:focus {
  top: 0;
}

/* ------------------------------------------------
   Print styles
   ------------------------------------------------ */

@media print {
  /* Hide non-essential elements */
  nav,
  footer,
  .code-copy-btn,
  .toc,
  [data-menu-toggle],
  [data-menu] {
    display: none !important;
  }

  /* Reset backgrounds and colors for printing */
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Ensure links are visible */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Don't show URL for internal links */
  a[href^="/"]::after,
  a[href^="#"]::after {
    content: "";
  }

  /* Code blocks */
  pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #ccc;
    padding: 0.5rem;
    page-break-inside: avoid;
  }

  /* Avoid breaking inside headings and images */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Tables */
  table {
    border-collapse: collapse;
  }

  table th,
  table td {
    border: 1px solid #ccc;
    padding: 0.25rem 0.5rem;
  }
}


/* Revenue validation CTAs */
.content-band--newsletter {
  background: linear-gradient(135deg, #111827 0%, #1f4e73 100%);
  color: #ffffff;
}

.newsletter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.55fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.newsletter-panel .eyebrow { color: var(--py-yellow); }
.newsletter-panel h2 { margin: 0.35rem 0 0; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; line-height: 1; }
.newsletter-panel p { margin-top: 1rem; color: #dbeafe; line-height: 1.7; }
.newsletter-benefits { display: grid; gap: 0.45rem; margin: 1.25rem 0 0; padding-left: 1.2rem; color: #f8fafc; }
.newsletter-form { display: grid; gap: 0.75rem; padding: 1rem; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 0.75rem; background: rgba(255, 255, 255, 0.1); }
.newsletter-form input { min-height: 48px; width: 100%; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 0.5rem; padding: 0.75rem 0.9rem; background: #ffffff; color: var(--ink); }
.newsletter-form button:disabled { cursor: wait; opacity: 0.72; }
.newsletter-status { min-height: 1.25rem; color: #e5e7eb; font-size: 0.9rem; font-weight: 700; }
.newsletter-status--success { color: #bbf7d0; }
.newsletter-status--error { color: #fecaca; }
.newsletter-fineprint { margin: 0; color: #cbd5e1; font-size: 0.82rem; line-height: 1.45; }
.newsletter-form--inline { grid-template-columns: minmax(0, 1fr) auto; align-items: center; max-width: 42rem; padding: 0; border: 0; background: transparent; }
.newsletter-form--inline .newsletter-status { grid-column: 1 / -1; color: var(--muted); }
.newsletter-form--inline .newsletter-status--success { color: #166534; }
.newsletter-form--inline .newsletter-status--error { color: #991b1b; }
.article-revenue-cta, .job-revenue-cta { margin: 2rem 0; padding: 1.25rem; border: 1px solid rgba(48, 105, 152, 0.22); border-radius: 0.75rem; background: var(--surface-cool); }
.article-revenue-cta h2, .job-revenue-cta h2 { margin: 0.35rem 0 0; color: var(--ink); font-size: 1.55rem; font-weight: 900; line-height: 1.1; }
.article-revenue-cta p, .job-revenue-cta p { margin: 0.75rem 0 1rem; color: var(--muted); line-height: 1.6; }
.job-revenue-cta { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }

@media (max-width: 760px) {
  .newsletter-panel { grid-template-columns: 1fr; }
  .job-revenue-cta { display: block; }
  .newsletter-form--inline { grid-template-columns: 1fr; }
  .job-revenue-cta .btn, .newsletter-form--inline .btn { width: 100%; }
}
