/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 44px; padding: 0.62rem 1.1rem; border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: var(--paper); font-weight: 650; font-size: 0.94rem; text-decoration: none;
  transition: background 0.16s, border-color 0.16s, transform 0.16s, color 0.16s; white-space: nowrap;
}
.btn:hover { background: var(--blue); border-color: var(--blue); color: var(--paper); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--panel); color: var(--ink); border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--panel); color: var(--ink); border-color: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--paper); border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.86rem; }
.btn .arrow { transition: transform 0.16s; }
.btn:hover .arrow { transform: translateX(3px); }
.grid-symbol { width: 0.3rem; height: 0.3rem; margin: 0 0.4rem 0.4rem 0; background: currentColor; box-shadow: 0.38rem 0 currentColor, 0 0.38rem currentColor, 0.38rem 0.38rem currentColor; flex: none; }
.text-link { font-weight: 650; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.text-link:hover { color: var(--blue); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

/* ---------- chips, badges */
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; font-weight: 600; padding: 0.22rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); white-space: nowrap; }
.chip-swatch { width: 0.6rem; height: 0.6rem; border: 1px solid var(--line-strong); flex: none; }
.badge { display: inline-flex; align-items: center; gap: 0.35rem; font: 650 0.68rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 0.3rem 0.5rem; border-radius: 3px; border: 1px solid var(--line); background: var(--surface); }
.badge-published { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-soft); }
.badge-draft { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
.badge-done { color: var(--paper); background: var(--success); border-color: var(--success); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow); }
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.4rem; }
.grid { display: grid; gap: clamp(1rem, 1.8vw, 1.5rem); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* course card: a "print" cover + caption, like the studio work grid */
.course-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.course-card .cover { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line-strong); overflow: hidden; background: var(--panel); }
.course-card .cover svg { width: 100%; height: 100%; transition: transform 0.35s var(--ease); }
.course-card:hover .cover svg { transform: scale(1.03); }
.course-card .body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.course-card .meta { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font: 600 0.7rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.course-card h3 { font-size: 1.22rem; margin: 0.1rem 0 0; }
.course-card h3 a { text-decoration: none; }
.course-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.course-card p { color: var(--muted); font-size: 0.9rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.course-card .foot { margin-top: auto; padding-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: var(--muted); }
.course-card.is-draft .cover { filter: grayscale(0.55) contrast(0.92); opacity: 0.85; }
.course-card .badge { position: relative; z-index: 2; }

/* ---------- progress */
.progress { --value: 0%; height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; flex: 1; min-width: 60px; }
.progress > span { display: block; height: 100%; width: var(--value); background: var(--blue); border-radius: inherit; transition: width 0.5s var(--ease); }
.progress.is-complete > span { background: var(--success); }
.ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--panel-2) 0); flex: none; }
.ring::before { content: attr(data-label); width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 700 0.74rem/1 var(--font-display); }

/* ---------- studio band */
.studio-band { background: var(--band); color: var(--band-ink); border-block: 1px solid #20202c; overflow: hidden; }
.band-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem var(--gutter); max-width: var(--max); margin-inline: auto; font: 650 0.76rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.11em; flex-wrap: wrap; }
.band-inner i { color: var(--band-accent); font-style: normal; }
.band-inner a { color: inherit; text-decoration: none; }
.band-inner a:hover { text-decoration: underline; }

/* ---------- forms */
.field { display: grid; gap: 0.4rem; font-size: 0.9rem; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input[type="text"], input[type="search"], input[type="email"], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 0.6rem 0.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 400;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.checkrow { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 400; }
.checkrow:hover { border-color: var(--line-strong); }
.checkrow input { margin-top: 0.25rem; accent-color: var(--blue); width: 1.05rem; height: 1.05rem; flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); padding: 0.5rem 0.85rem; font-size: 0.86rem; font-weight: 600; border-right: 1px solid var(--line); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- section heads */
.section { padding-block: clamp(3rem, 6vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: clamp(1.4rem, 3vw, 2.2rem); flex-wrap: wrap; }
.section-head h2 { font-size: var(--step-4); letter-spacing: -0.06em; margin: 0.4rem 0 0; line-height: 0.98; }
.section-head h2 .dot { color: var(--orange); }
.section-head > p { max-width: 38ch; color: var(--muted); margin: 0; }
.page-head { padding-block: clamp(2rem, 4.5vw, 3.6rem) clamp(1.2rem, 2.5vw, 2rem); }
.page-head h1 { margin: 0.6rem 0 0.8rem; }
.breadcrumbs { font-size: 0.85rem; color: var(--muted); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--line-strong); }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- empty / error states */
.empty { text-align: center; padding: 3rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); }
.empty h2, .empty h3 { margin-bottom: 0.5rem; }
.notice { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-size: 0.92rem; }
.notice.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.notice.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.notice.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice p { margin: 0; }

/* ---------- modal (command palette search) */
dialog.palette { border: 1px solid var(--line-strong); border-radius: 14px; padding: 0; width: min(680px, 94vw); max-height: min(76vh, 680px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); margin-top: 9vh; }
dialog.palette::backdrop { background: #18171c99; backdrop-filter: blur(3px); }
.palette-input { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 1rem; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.palette-input input { border: 0; background: transparent; min-height: 54px; font-size: 1.05rem; padding: 0; }
.palette-input input:focus-visible { outline: none; }
.palette-results { overflow: auto; max-height: calc(min(76vh, 680px) - 110px); padding: 0.4rem; }
.palette-results a { display: grid; grid-template-columns: auto 1fr auto; gap: 0.8rem; align-items: center; padding: 0.65rem 0.75rem; border-radius: 8px; text-decoration: none; }
.palette-results a[aria-selected="true"], .palette-results a:hover { background: var(--panel); }
.palette-results .kind { font: 650 0.66rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.palette-results strong { display: block; font-weight: 650; }
.palette-results small { color: var(--muted); }
.palette-foot { display: flex; gap: 1rem; padding: 0.55rem 1rem; border-top: 1px solid var(--line); font-size: 0.76rem; color: var(--muted); }
.palette-foot kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 0.3rem; }
mark { background: color-mix(in srgb, var(--orange) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- code */
.code-block { position: relative; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--code-bg); }
.code-block pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.6; tab-size: 2; }
.code-lang { position: absolute; top: 0.45rem; right: 0.6rem; font: 650 0.64rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.tok-string { color: var(--tok-string); }
.tok-number { color: var(--tok-number); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-fn { color: var(--tok-fn); }
.tok-type { color: var(--tok-type); }
.tok-tag { color: var(--tok-tag); }
.tok-attr { color: var(--tok-attr); }

/* Long labels such as "Start with <course title>" must wrap on narrow screens instead of widening the page. */
@media (max-width: 640px) { .actions .btn { white-space: normal; max-width: 100%; text-align: start; } }
