/*
 * Portfolio theme for codelab-elements.
 *
 * Overrides the default Google codelab look with the design tokens from the
 * Docusaurus portfolio site (Inter typeface, #2563eb blue, slate text,
 * subtle borders, rounded corners). Loaded after codelab-elements.css so
 * equal-specificity rules win.
 */

:root {
  --pf-primary: #2563eb;
  --pf-primary-dark: #1d4ed8;
  --pf-text: #334155;
  --pf-heading: #0f172a;
  --pf-muted: #64748b;
  --pf-border: #e2e8f0;
  --pf-border-muted: #f1f5f9;
  --pf-surface: #f8fafc;
  --pf-tint: #eff6ff;
  --pf-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pf-mono: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pf-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --pf-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* ---------- Base ---------- */
body {
  font-family: var(--pf-font);
  color: var(--pf-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

google-codelab #main {
  background: linear-gradient(180deg, #ffffff 0%, var(--pf-surface) 100%);
}

/* ---------- Top app bar (-> portfolio navbar) ---------- */
google-codelab #codelab-title {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: none;
  border-bottom: 1px solid var(--pf-border);
  color: var(--pf-heading);
}

google-codelab #codelab-title h1 {
  font-family: var(--pf-font);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--pf-heading);
}

google-codelab #codelab-title .time-remaining {
  color: var(--pf-muted);
}

google-codelab #codelab-nav-buttons #arrow-back {
  display: none !important;
}

google-codelab #codelab-nav-buttons #menu {
  color: var(--pf-muted);
}

/* ---------- Drawer / step navigation (-> portfolio sidebar) ---------- */
google-codelab #drawer {
  background: #ffffff;
  border-right: 1px solid var(--pf-border);
}

google-codelab #drawer ol li a {
  font-family: var(--pf-font);
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  min-height: 44px;
  margin: 2px 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}

google-codelab #drawer ol li a:hover {
  background: var(--pf-surface);
  color: var(--pf-heading);
}

google-codelab #drawer ol li a:active,
google-codelab #drawer ol li a:focus {
  background: var(--pf-tint);
  border-color: transparent !important;
  outline: 0;
}

google-codelab #drawer ol li[selected] a,
google-codelab #drawer ol li a:focus {
  color: var(--pf-primary);
  font-weight: 600;
  background: var(--pf-tint);
  border-color: transparent;
  box-shadow: none;
}

google-codelab #drawer ol li .step:before {
  width: 24px;
  min-width: 24px;
  height: 24px;
  line-height: 24px;
  background: #cbd5e1;
  color: #ffffff;
  font-weight: 600;
}

google-codelab #drawer ol li[selected] .step:before {
  background: var(--pf-primary);
}

google-codelab #drawer ol li[completed] a {
  color: var(--pf-heading);
}

google-codelab #drawer ol li[completed] .step:before {
  background: var(--pf-primary);
}

google-codelab #drawer .metadata {
  color: var(--pf-muted);
}

google-codelab #drawer .metadata a {
  color: var(--pf-primary);
}

/* ---------- Step heading ---------- */
google-codelab-step h2.step-title {
  font-family: var(--pf-font) !important;
  font-size: 1.875rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.025em;
  color: var(--pf-heading);
  margin: 0 0 1.5rem !important;
}

/* ---------- Instructions card ---------- */
google-codelab:not([theme="minimal"]) google-codelab-step .instructions {
  max-width: 800px;
  background: #ffffff;
  border: 1px solid var(--pf-border);
  border-radius: 0.75rem;
  box-shadow: var(--pf-shadow-sm);
  font-family: var(--pf-font);
  font-size: 1rem;
  line-height: 1.75;
}

google-codelab-step .instructions .inner {
  padding: 2rem;
}

/* Content links */
google-codelab:not([theme="minimal"]) google-codelab-step .instructions a,
google-codelab:not([theme="minimal"]) google-codelab-step .instructions a:visited {
  color: var(--pf-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #bfdbfe;
  transition: text-decoration-color 0.15s ease;
}

google-codelab-step .instructions a:hover {
  text-decoration-color: currentColor;
}

/* Content headings */
google-codelab:not([theme="minimal"]) google-codelab-step .instructions h2 {
  font-family: var(--pf-font);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pf-heading);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--pf-border-muted);
}

google-codelab:not([theme="minimal"]) google-codelab-step .instructions h3 {
  font-family: var(--pf-font);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--pf-heading);
  margin: 2rem 0 0.75rem;
}

google-codelab-step .instructions h4 {
  font-family: var(--pf-font);
  font-weight: 600;
  color: var(--pf-heading);
}

google-codelab-step .instructions p {
  color: var(--pf-text);
  margin: 0 0 1.25rem;
}

google-codelab-step .instructions strong {
  font-weight: 600;
  color: var(--pf-heading);
}

google-codelab-step .instructions li {
  margin: 0.4em 0;
  color: var(--pf-text);
}

/* ---------- Tables (Microsoft-style: header band, horizontal rules only) ---------- */
google-codelab-step .instructions table {
  width: 100%;
  margin: 0 0 1.25rem;
  border-collapse: collapse;
  border-top: 2px solid var(--pf-border);
  border-bottom: 2px solid var(--pf-border);
}

google-codelab-step .instructions table tr {
  border-bottom: 1px solid var(--pf-border);
}

google-codelab-step .instructions table tr:last-child {
  border-bottom: none;
}

google-codelab-step .instructions table thead th,
google-codelab-step .instructions table tr:first-child td {
  background: var(--pf-surface);
  font-weight: 600;
  color: var(--pf-heading);
  border-bottom: 1px solid var(--pf-border);
}

google-codelab-step .instructions table th,
google-codelab-step .instructions table td {
  padding: 0.625rem 1rem;
  text-align: left;
  vertical-align: top;
  border: 0;
}

google-codelab-step .instructions table td p,
google-codelab-step .instructions table th p {
  margin: 0;
}

google-codelab-step .instructions table td:first-child {
  font-weight: 500;
  color: var(--pf-heading);
}

/* ---------- Inline code & code blocks (light, GitHub-ish) ---------- */
google-codelab-step code {
  font-family: var(--pf-mono);
  background-color: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: 0.375rem;
  padding: 0.15rem 0.35rem;
  color: var(--pf-heading);
  font-size: 0.9em;
}

google-codelab-step pre {
  background-color: var(--pf-surface);
  color: var(--pf-heading);
  border: 1px solid var(--pf-border);
  border-radius: 0.75rem;
  box-shadow: var(--pf-shadow-sm);
  padding: 1rem 1.25rem;
  font-family: var(--pf-mono);
  line-height: 1.6;
}

google-codelab-step pre > code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

google-codelab-step .instructions table code,
google-codelab-step .instructions h2 code {
  background: var(--pf-surface);
}

google-codelab-step pre .kwd, google-codelab-step code .kwd { color: #cf222e; }
google-codelab-step pre .str, google-codelab-step code .str { color: #0a3069; }
google-codelab-step pre .com, google-codelab-step code .com { color: #6e7781; font-style: italic; }
google-codelab-step pre .typ, google-codelab-step code .typ { color: #953800; }
google-codelab-step pre .lit, google-codelab-step code .lit { color: #0550ae; }
google-codelab-step pre .pun, google-codelab-step code .pun { color: #24292f; }
google-codelab-step pre .pln, google-codelab-step code .pln { color: #24292f; }
google-codelab-step pre .tag, google-codelab-step code .tag { color: #116329; }
google-codelab-step pre .atn, google-codelab-step code .atn { color: #0550ae; }
google-codelab-step pre .atv, google-codelab-step code .atv { color: #0a3069; }
google-codelab-step pre .dec, google-codelab-step code .dec { color: #0550ae; }
google-codelab-step code em { color: #0550ae; }

/* ---------- Admonitions / callouts ---------- */
google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside {
  border-radius: 0.5rem;
  border-left: 4px solid;
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
}

google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside.note,
google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside.notice,
google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside.warning {
  border-color: #f59e0b;
  background: #fffbeb;
  color: var(--pf-text);
}

google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside.tip,
google-codelab:not([theme="minimal"]) google-codelab-step .instructions aside.special {
  border-color: #10b981;
  background: #ecfdf5;
  color: var(--pf-text);
}

google-codelab-step .instructions aside.callout {
  background-color: var(--pf-tint);
  border-left: 4px solid var(--pf-primary);
  border-radius: 0.5rem;
  color: var(--pf-text);
}

google-codelab-step aside.callout b {
  color: var(--pf-primary-dark);
}

/* ---------- Bottom navigation buttons ---------- */
#previous-step,
#next-step,
#done {
  font-family: var(--pf-font);
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  border-radius: 0.375rem;
  box-shadow: var(--pf-shadow-sm);
}

#previous-step {
  background: #ffffff;
  color: #475569;
  border: 1px solid var(--pf-border);
}

#previous-step:hover {
  background: var(--pf-surface);
}

#next-step {
  background: var(--pf-primary);
  color: #ffffff;
}

#next-step:hover {
  background: var(--pf-primary-dark);
}

#done {
  background: var(--pf-primary);
  color: #ffffff;
}

#done:hover {
  background: var(--pf-primary-dark);
}

/* In-content buttons */
google-codelab-step .instructions paper-button {
  font-family: var(--pf-font);
  border-radius: 0.375rem;
  background-color: var(--pf-primary);
  color: #ffffff;
}

/* ---------- Survey ---------- */
google-codelab-survey {
  background: var(--pf-tint);
  border-left: 4px solid var(--pf-primary);
  border-radius: 0.5rem;
  color: var(--pf-text);
}

.custom-radio-button {
  border-color: var(--pf-primary);
}

.survey-option-wrapper .custom-radio-button:after {
  background: var(--pf-primary);
}

/* ---------- Right-side mini TOC (Docusaurus-style) ---------- */
.codelab-toc {
  position: fixed;
  top: 5rem;
  width: 14rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  padding: 0 0 1rem 1.25rem;
  border-left: 1px solid var(--pf-border);
  z-index: 10;
}

.codelab-toc__title {
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pf-heading);
}

.codelab-toc__list,
.codelab-toc__sublist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.codelab-toc__sublist {
  margin: 0.125rem 0 0.375rem 0;
  padding-left: 0.875rem;
  border-left: 1px solid var(--pf-border-muted);
}

.codelab-toc__item--child .codelab-toc__link {
  font-size: 0.8125rem;
  font-weight: 400;
}

.codelab-toc__link {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--pf-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.codelab-toc__link:hover,
.codelab-toc__link--active {
  color: var(--pf-primary);
}

@media (max-width: 1360px) {
  .codelab-toc {
    display: none;
  }
}
