/* ============================================
   tamir.info - Design System
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

/* --- Custom Properties (Dark Mode Default) --- */
:root {
  /* Backgrounds */
  --bg: hsl(220, 15%, 7%);
  --bg-hover: hsl(220, 15%, 11%);
  --bg-highlighted: hsl(220, 15%, 14%);
  --bg-card: hsl(220, 15%, 10%);

  /* Borders */
  --border: hsl(220, 10%, 16%);
  --border-hover: hsl(220, 10%, 24%);

  /* Foreground */
  --foreground: hsl(220, 10%, 62%);
  --foreground-highlighted: hsl(220, 10%, 93%);
  --foreground-faded: hsl(220, 10%, 38%);

  /* Accent */
  --accent: hsl(210, 100%, 62%);
  --accent-hover: hsl(210, 100%, 70%);
  --accent-faded: hsla(210, 100%, 62%, 0.12);

  /* Dock */
  --dock-bg: hsla(220, 15%, 12%, 0.72);
  --dock-border: hsla(220, 10%, 24%, 0.5);
  --dock-shadow: rgba(0, 0, 0, 0.35);

  /* Spacing */
  --content-width: 560px;
  --page-padding: 1.5rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* --- Light Mode --- */
[data-theme="light"] {
  color-scheme: light;

  --bg: hsl(0, 0%, 98%);
  --bg-hover: hsl(0, 0%, 93%);
  --bg-highlighted: hsl(0, 0%, 96%);
  --bg-card: hsl(0, 0%, 100%);

  --border: hsl(0, 0%, 88%);
  --border-hover: hsl(0, 0%, 78%);

  --foreground: hsl(220, 10%, 40%);
  --foreground-highlighted: hsl(220, 15%, 12%);
  --foreground-faded: hsl(220, 5%, 58%);

  --accent: hsl(210, 100%, 45%);
  --accent-hover: hsl(210, 100%, 38%);
  --accent-faded: hsla(210, 100%, 50%, 0.08);

  --dock-bg: hsla(0, 0%, 100%, 0.78);
  --dock-border: hsla(0, 0%, 0%, 0.08);
  --dock-shadow: rgba(15, 23, 42, 0.12);
}

/* --- Body --- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--foreground);
  background-color: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  color: var(--foreground-highlighted);
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.0625rem;
  font-weight: 600;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

a {
  color: var(--foreground);
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: var(--foreground-highlighted);
}

/* Inline link style (for body text) */
a.link {
  color: var(--foreground-highlighted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease, color 150ms ease;
}

a.link:hover {
  text-decoration-color: var(--foreground-highlighted);
}

p {
  margin-bottom: 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

/* Code */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  background: var(--bg-highlighted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--foreground-highlighted);
}

pre {
  background: var(--bg-highlighted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* --- Layout --- */
.page-wrapper {
  position: relative;
  min-height: 100vh;
  padding: 7.5rem var(--page-padding) 10rem;
}

.content-container {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* --- Header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.site-logo {
  display: flex;
  align-items: center;
  color: var(--foreground-highlighted);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  transition: opacity 150ms ease;
}

.site-logo:hover {
  opacity: 0.8;
  color: var(--foreground-highlighted);
}

.site-logo svg {
  width: 32px;
  height: 32px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--foreground-faded);
  font-size: 0.8125rem;
  transition: color 150ms ease, background-color 150ms ease;
}

.header-link:hover {
  color: var(--foreground-highlighted);
  background-color: var(--bg-hover);
}

.header-link svg {
  width: 14px;
  height: 14px;
}

/* --- Sections --- */
.section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-margin-top: 100px;
}

.section-separator {
  height: 1px;
  background: var(--border);
  border: none;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: -1.25rem;
}

.section-anchor {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--foreground-faded);
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, background-color 150ms ease;
}

.section-header:hover .section-anchor,
.section-anchor:focus-visible {
  opacity: 1;
}

.section-anchor:hover {
  color: var(--foreground-highlighted);
  background-color: var(--bg-hover);
}

.section-anchor svg {
  width: 12px;
  height: 12px;
}

/* --- Hero / Intro --- */
.intro-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.intro-name {
  margin-bottom: 0.5rem;
  font-size: 1.375rem;
  line-height: 1;
}

.intro-bio {
  color: var(--foreground);
  max-width: 480px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--foreground-faded);
  transition: color 150ms ease, background-color 150ms ease;
}

.social-link:hover {
  color: var(--foreground-highlighted);
  background-color: var(--bg-hover);
}

.social-link svg {
  width: 16px;
  height: 16px;
}

/* --- Video Showcase --- */
.video-showcase {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-highlighted);
  border: 1px solid var(--border);
  cursor: pointer;
}

.video-showcase video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-showcase:hover {
  border-color: var(--border-hover);
}

/* --- List Rows (Work Life / Education) --- */
.list-rows {
  display: flex;
  flex-direction: column;
  margin: 0.25rem -0.5rem 0;
}

.list-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--foreground);
  transition: background-color 150ms ease;
  cursor: pointer;
}

.list-row:hover {
  background-color: var(--bg-hover);
  color: var(--foreground);
}

.list-row-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  overflow: hidden;
}

.list-row-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.list-row-title {
  font-size: 0.875rem;
  color: var(--foreground-highlighted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-subtitle {
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-date {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--foreground-faded);
  letter-spacing: -0.02em;
  text-align: right;
  white-space: nowrap;
}

/* --- Accordion Bullets (expandable details) --- */
.accordion-row {
  cursor: pointer;
  user-select: none;
}

.accordion-row .chevron-icon {
  width: 14px;
  height: 14px;
  color: var(--foreground-faded);
  transition: transform 250ms var(--ease-out);
  flex-shrink: 0;
}

.accordion-row[aria-expanded="true"] .chevron-icon {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms var(--ease-out), opacity 250ms ease;
  opacity: 0;
}

.accordion-content.expanded {
  opacity: 1;
}

.accordion-bullets {
  padding: 0.375rem 0 0.625rem 2.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.accordion-bullet {
  font-size: 0.8125rem;
  color: var(--foreground);
  line-height: 1.5;
  position: relative;
  padding-left: 1rem;
}

.accordion-bullet::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--foreground-faded);
  font-size: 0.75rem;
}

.accordion-link {
  font-size: 0.8125rem;
  line-height: 1.5;
  position: relative;
  padding-left: 1.125rem;
  margin-top: 0.125rem;
}

.accordion-link::before {
  content: '🔗';
  position: absolute;
  left: 0;
  font-size: 0.75rem;
}

.accordion-link a {
  color: var(--foreground-faded);
  text-decoration: none;
  border-bottom: 1px dotted var(--foreground-faded);
  transition: color 0.2s, border-color 0.2s;
}

.accordion-link a:hover {
  color: var(--foreground);
  border-bottom: 1px solid var(--foreground);
}

/* --- Side Quests Grid --- */
.side-quests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1.25rem 0.75rem;
  margin-top: 0.25rem;
}

.side-quest-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: transform 200ms var(--ease-spring);
}

.side-quest-item:active {
  transform: scale(0.95);
}

.side-quest-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-highlighted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: box-shadow 200ms ease, transform 200ms var(--ease-spring);
}

[data-theme="light"] .side-quest-icon {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

.side-quest-item:hover .side-quest-icon {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.side-quest-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--foreground);
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

/* --- Featured Writing Cards --- */
.featured-writing-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -0.5rem;
}

.featured-writing-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--foreground);
  transition: background-color 150ms ease;
}

.featured-writing-card:hover {
  background-color: var(--bg-hover);
  color: var(--foreground);
}

.featured-writing-card .card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--foreground-highlighted);
  line-height: 1.3;
}

.featured-writing-card .card-summary {
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  line-height: 1.5;
}

.featured-writing-card .card-meta {
  font-size: 0.75rem;
  color: var(--foreground-faded);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
  margin-top: 0.125rem;
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  padding: 0.5rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: var(--radius-sm);
  transition: color 150ms ease, background-color 150ms ease;
}

.view-all-link:hover {
  color: var(--foreground-highlighted);
  background-color: var(--bg-hover);
}

.view-all-link svg {
  width: 14px;
  height: 14px;
  transition: transform 150ms ease;
}

.view-all-link:hover svg {
  transform: translateX(2px);
}

/* --- Floating Dock Nav --- */
.dock-wrapper {
  pointer-events: none;
  position: fixed;
  right: 0;
  bottom: 4vh;
  left: 0;
  z-index: 100;
  display: flex;
  height: 70px;
  align-items: center;
  justify-content: center;
}

.dock-nav {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-xl);
  background: var(--dock-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--dock-border);
  box-shadow: 0 30px 60px 0 var(--dock-shadow);
}

.dock-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 25%;
  color: var(--foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.dock-item:hover {
  color: var(--foreground-highlighted);
  background-color: var(--bg-hover);
}

.dock-item.active {
  color: var(--foreground-highlighted);
}

.dock-item svg {
  width: 20px;
  height: 20px;
}

.dock-item .active-dot {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--foreground-faded);
  animation: fadeInScaleX 0.6s var(--ease-out);
}

@keyframes fadeInScaleX {
  from {
    opacity: 0;
    transform: translateX(-50%) scaleX(0);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
  }
}

/* --- Section Entrance Animations --- */
.animate-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s var(--ease-out);
}

.animate-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Text Scramble --- */
.scramble-char {
  display: inline-block;
  position: relative;
}

/* --- Arrow List (highlights) --- */
.arrow-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.arrow-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--foreground);
  line-height: 1.5;
}

.arrow-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--foreground-faded);
  font-size: 0.8rem;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 3rem 0 2rem;
  color: var(--foreground-faded);
  font-size: 0.8125rem;
}

.site-footer .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.site-footer a {
  color: var(--foreground-faded);
  transition: color 150ms ease;
}

.site-footer a:hover {
  color: var(--foreground-highlighted);
}

/* --- Writing Page Styles --- */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -0.5rem;
}

.writing-item {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--foreground);
  transition: background-color 150ms ease;
}

.writing-item:hover {
  background-color: var(--bg-hover);
  color: var(--foreground);
}

.writing-item .writing-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--foreground-highlighted);
}

.writing-item .writing-summary {
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  line-height: 1.5;
}

.writing-item .writing-meta {
  font-size: 0.75rem;
  color: var(--foreground-faded);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}

.writing-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.writing-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-faded);
  color: var(--accent);
  font-weight: 500;
}

/* --- Post Page Styles --- */
.post-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.post-meta {
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}

.post-summary {
  font-size: 1rem;
  color: var(--foreground);
  font-style: italic;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-content {
  line-height: 1.8;
}

.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li {
  margin-bottom: 0.375rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  background: var(--accent-faded);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--foreground);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.post-content video {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.post-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--foreground-faded);
  margin-bottom: 2rem;
  transition: color 150ms ease;
}

.post-back-link:hover {
  color: var(--foreground-highlighted);
}

.post-back-link svg {
  width: 14px;
  height: 14px;
}

/* --- Admin Panel Styles --- */
.admin-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem var(--page-padding);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.admin-header h1 {
  font-size: 1.25rem;
}

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.admin-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--foreground-faded);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.admin-tab:hover {
  color: var(--foreground-highlighted);
  background: var(--bg-hover);
}

.admin-tab.active {
  color: var(--foreground-highlighted);
  background: var(--bg-highlighted);
}

.admin-post-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-post-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 150ms ease;
}

.admin-post-row:hover {
  border-color: var(--border-hover);
}

.admin-post-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow: hidden;
}

.admin-post-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground-highlighted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-post-meta {
  font-size: 0.75rem;
  color: var(--foreground-faded);
}

.badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-featured {
  background: hsla(40, 90%, 55%, 0.15);
  color: hsl(40, 90%, 55%);
}

.badge-public {
  background: hsla(140, 60%, 50%, 0.15);
  color: hsl(140, 60%, 50%);
}

.badge-private {
  background: hsla(0, 60%, 50%, 0.15);
  color: hsl(0, 60%, 55%);
}

/* Admin form */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground-highlighted);
}

.form-input,
.form-textarea,
.form-select {
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--foreground-highlighted);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 150ms ease;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-textarea {
  min-height: 400px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.form-toggles {
  display: flex;
  gap: 1.5rem;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.toggle-group input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.toggle-group label {
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--foreground-highlighted);
  transition: all 150ms ease;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: hsl(0, 60%, 55%);
  border-color: hsla(0, 60%, 50%, 0.3);
}

.btn-danger:hover {
  background: hsla(0, 60%, 50%, 0.1);
  border-color: hsla(0, 60%, 50%, 0.5);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Admin preview pane */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.editor-pane,
.preview-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pane-header {
  padding: 0.5rem 0.75rem;
  background: var(--bg-highlighted);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--foreground-faded);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.editor-pane textarea {
  width: 100%;
  min-height: 500px;
  padding: 1rem;
  border: none;
  background: var(--bg-card);
  color: var(--foreground-highlighted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.preview-pane .preview-content {
  padding: 1rem;
  min-height: 500px;
  overflow-y: auto;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .page-wrapper {
    padding-top: 5rem;
  }

  .content-container {
    gap: 2rem;
  }

  .section-header {
    margin-left: 0;
  }

  .section-anchor {
    display: none;
  }

  .list-row {
    grid-template-columns: 20px 1fr auto;
  }

  .list-row-subtitle {
    display: none;
  }

  .side-quests-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 1rem 0.5rem;
  }

  .side-quest-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .dock-nav {
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .dock-item {
    width: 40px;
    height: 40px;
  }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* --- Selection --- */
::selection {
  background: var(--accent-faded);
  color: var(--foreground-highlighted);
}

/* --- Toast notification (admin) --- */
.toast {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-highlighted);
  border: 1px solid var(--border);
  color: var(--foreground-highlighted);
  font-size: 0.8125rem;
  z-index: 200;
  opacity: 0;
  transition: opacity 250ms ease, transform 250ms var(--ease-out);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
