/* Flick — Shared header styles (announcement bar + navigation) */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --brand: #1C0F09;
  --bg: #FFFFFE;
  --announcement-h: 40px;
  --nav-h: 110px;
  --nav-h-scrolled: 70px;
  --header-h: calc(var(--announcement-h) + var(--nav-h));
  --header-h-scrolled: calc(var(--announcement-h) + var(--nav-h-scrolled));
  --page-px: 64px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-nav: "Jost", sans-serif;
}

@media (min-width: 1280px) { :root { --page-px: 128px; } }
@media (min-width: 1536px) { :root { --page-px: 160px; } }

/* ═══════════════════════════════════════
   ANNOUNCEMENT BAR
   ═══════════════════════════════════════ */

.announcement-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--announcement-h);
  background: var(--brand);
  color: #fff;
  font-family: var(--font-nav);
  font-weight: 300;
  font-size: 0.875rem;
  text-decoration: none;
  text-align: center;
  padding: 0 16px;
  transition: opacity 0.2s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  &:hover {
    opacity: 0.9;
  }
}

/* ═══════════════════════════════════════
   SITE NAV
   ═══════════════════════════════════════ */

.site-nav {
  position: fixed;
  top: var(--announcement-h);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg);
  height: var(--nav-h);
  transition: height 0.3s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  &.scrolled {
    height: var(--nav-h-scrolled);
  }
}

.nav-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0.3px;
  background: var(--brand);
}

.nav-line-top {
  top: 70px;
}

.nav-line-bottom {
  bottom: 0;
  transition: bottom 0.3s;
}

.site-nav.scrolled .nav-line-bottom {
  bottom: 0;
}

.nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  padding: 0 var(--page-px);
}

.nav-spacer {
  flex: 1;
}

.nav-logo {
  display: flex;
  align-items: center;
  transition: opacity 0.2s;

  &:hover {
    opacity: 0.8;
  }

  img {
    width: 40px;
    height: auto;
    aspect-ratio: 98.56 / 47.12;
    object-fit: contain;
  }
}

@media (min-width: 640px) {
  .nav-logo img { width: 50px; }
}

@media (min-width: 768px) {
  .nav-logo img { width: 65px; }
}

@media (min-width: 1024px) {
  .nav-logo img { width: 80px; }
}

.nav-actions {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.nav-btn {
  font-family: var(--font-nav);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 16px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-btn-outline {
  color: var(--brand);
  border: 0.5px solid var(--brand);
  background: transparent;

  &:hover {
    opacity: 0.7;
  }
}

.nav-btn-filled {
  background: var(--brand);
  color: #fff;

  &:hover {
    opacity: 0.9;
  }
}

/* Nav links row */
.nav-links {
  padding: 0 var(--page-px);
  margin-top: 8px;
  transition: opacity 0.3s, max-height 0.3s;
  opacity: 1;
  max-height: 40px;

  &.collapsed {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }
}

.nav-links-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

@media (min-width: 1024px) {
  .nav-links-inner { gap: 32px; }
}

@media (min-width: 1280px) {
  .nav-links-inner { gap: 40px; }
}

.nav-link {
  font-family: var(--font-nav);
  font-weight: 300;
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  position: relative;
  display: inline-block;
  cursor: pointer;

  &::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0.5px;
    bottom: -2px;
    left: 0;
    background-color: var(--brand);
    transition: width 0.3s ease-in-out;
  }

  &:hover::after {
    width: 100%;
  }
}

.nav-dropdown-item {
  position: relative;
  display: inline-block;

  &::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0.5px;
    bottom: -2px;
    left: 0;
    background-color: var(--brand);
    transition: width 0.3s ease-in-out;
  }

  &:hover::after {
    width: 100%;
  }
}

/* Resources dropdown */
.nav-dropdown {
  position: relative;
  cursor: pointer;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dropdown-arrow {
  transition: transform 0.2s;
}

.nav-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 12px;
  z-index: 60;
  border: 0.3px solid var(--brand);
  background: var(--bg);
  padding: 8px 12px;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;

  /* Invisible bridge so cursor can travel from trigger to menu */
  &::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
  }
}

.nav-dropdown.active .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-item {
  font-family: var(--font-nav);
  font-weight: 300;
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  width: fit-content;
}

@media (min-width: 768px) {
  .nav-link, .nav-dropdown-item { font-size: 13px; }
}

@media (min-width: 1024px) {
  .nav-link, .nav-dropdown-item { font-size: 15px; }
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */

.site-footer {
  width: 100%;
  margin-top: 64px;
}

.footer-inner {
  width: 100%;
  padding-top: 48px;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-line {
  width: 100%;
  height: 0.3px;
  background: var(--brand);
}

.footer-social {
  width: 100%;
  padding: 0 var(--page-px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  height: 50px;
  align-items: center;
}

.footer-social a {
  color: var(--brand);
  transition: transform 0.3s;

  &:hover {
    transform: rotate(12deg);
  }
}

.footer-info {
  width: 100%;
  padding: 0 var(--page-px);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--brand);
  font-family: var(--font-nav);
  font-weight: 300;
  margin-top: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  .footer-info {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-copyright {
  margin-bottom: 8px;
  margin-top: 8px;
}

@media (min-width: 768px) {
  .footer-copyright {
    margin-bottom: 0;
    margin-left: 8px;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

@media (min-width: 640px) {
  .footer-links { gap: 24px; }
}

@media (min-width: 768px) {
  .footer-links {
    justify-content: flex-end;
    width: auto;
  }
  .footer-social { gap: 32px; }
}

@media (min-width: 1024px) {
  .footer-social { gap: 48px; }
}

.footer-links a {
  color: var(--brand);
  text-decoration: none;
  position: relative;
  display: inline-block;

  &::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0.5px;
    bottom: -2px;
    left: 0;
    background-color: var(--brand);
    transition: width 0.3s ease-in-out;
  }

  &:hover::after {
    width: 100%;
  }
}

/* ═══════════════════════════════════════
   MOBILE — Header responsive
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  :root {
    --page-px: 24px;
  }

  .nav-main {
    padding: 0 var(--page-px);
  }

  .nav-links {
    display: none;
  }

  .nav-actions {
    gap: 8px;
  }

  .nav-btn-outline {
    display: none;
  }

  .nav-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .nav-logo img {
    width: 50px;
  }

  .site-nav {
    height: var(--nav-h-scrolled);
  }

  .nav-line-top {
    top: 70px;
  }

  .nav-line-bottom {
    top: 70px;
  }

  .announcement-bar {
    font-size: 0.75rem;
  }
}

/* Flick Docs — Docs-specific styles (layout, sidebar, TOC, article, etc.) */
/* Shared header/footer/nav styles are in shared/header.css */

:root {
  --sidebar-width: 220px;
  --toc-width: 200px;
  --content-max: 760px;
}

/* ═══════════════════════════════════════
   DOCS LAYOUT — Sidebar + Content
   ═══════════════════════════════════════ */

.docs-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: var(--page-px);
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  border-right: 1px solid #eee;
  padding: 32px 0;
  background: var(--bg);
  transition: top 0.3s;
  z-index: 40;
}

.site-nav.scrolled~.docs-layout .docs-sidebar {
  top: var(--header-h-scrolled);
}

.sidebar-close {
  display: none;
}

.sidebar-nav {
  padding: 0 24px 0 40px;
}

.sidebar-group {
  margin-bottom: 24px;
}

.sidebar-category {
  font-family: var(--font-nav);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 8px;
}

.sidebar-list {
  list-style: none;
  padding: 0;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: #444;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;

  &:hover {
    background: #f5f3ef;
    color: var(--brand);
  }

  &.active {
    background: #f0ece4;
    color: var(--brand);
    font-weight: 500;
  }
}

/* Content */
.docs-content {
  flex: 1;
  margin-left: calc(var(--sidebar-width) + var(--page-px));
  margin-right: calc(var(--toc-width) + var(--page-px));
  padding: 40px 48px 80px;
  min-width: 0;
}

.docs-content article {
  width: 100%;
}

.sidebar-toggle {
  display: none;
}

/* Right TOC — "On this page" */
.docs-toc {
  position: fixed;
  top: var(--header-h);
  right: var(--page-px);
  width: var(--toc-width);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 32px 20px 32px 0;
  transition: top 0.3s;
}

.toc-title {
  font-family: var(--font-nav);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  border-left: 1px solid #eee;
}

.toc-item {
  padding: 0;
}

.toc-level-3 {
  padding-left: 12px;
}

.toc-link {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 0.8125rem;
  color: #888;
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;

  &:hover {
    color: var(--brand);
  }

  &.active {
    color: var(--brand);
    border-left-color: var(--brand);
  }
}

/* ═══════════════════════════════════════
   ARTICLE CONTENT
   ═══════════════════════════════════════ */

body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: #1a1a1a;
  background: var(--bg);
}

article h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.3;
}

article h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 16px;
  scroll-margin-top: var(--header-h);
}

article h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  scroll-margin-top: var(--header-h);
}

article p {
  margin-bottom: 16px;
}

article ul,
article ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

article li {
  margin-bottom: 4px;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

article figure {
  margin: 24px 0;
}

article figcaption {
  font-size: 0.875rem;
  color: #666;
  margin-top: 8px;
}

article blockquote {
  border-left: 3px solid #ddd;
  padding-left: 16px;
  margin: 16px 0;
  color: #555;
}

article pre {
  background: #f5f5f5;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

article code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.875em;
}

article p code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
}

article hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 32px 0;
}

.callout {
  display: flex;
  gap: 12px;
  background: #f8f8f8;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.callout-icon {
  font-size: 1.25em;
  flex-shrink: 0;
}

article details {
  margin: 16px 0;
}

article summary {
  cursor: pointer;
  font-weight: 600;
}

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

article th,
article td {
  border: 1px solid #eee;
  padding: 8px 12px;
  text-align: left;
}

article th {
  background: #f8f8f8;
  font-weight: 600;
}

article a {
  color: #2563eb;
}

.bookmark {
  display: block;
  padding: 12px 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin: 16px 0;
  text-decoration: none;
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  margin: 16px 0;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* ═══════════════════════════════════════
   PREVIOUS / NEXT NAV
   ═══════════════════════════════════════ */

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid #eee;
}

.prev-next-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s;
  min-width: 0;

  &:hover {
    border-color: var(--brand);
  }
}

.prev-next-next {
  text-align: right;
  margin-left: auto;
}

.prev-next-label {
  font-family: var(--font-nav);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
}

.prev-next-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--brand);
}

/* ═══════════════════════════════════════
   FEEDBACK WIDGET
   ═══════════════════════════════════════ */

.feedback-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #eee;
}

.feedback-question {
  font-size: 0.875rem;
  color: #666;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: #666;
  background: none;
  border: 1px solid #eee;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;

  &:hover {
    border-color: var(--brand);
    color: var(--brand);
  }
}

.feedback-thanks {
  display: none;
  font-size: 0.875rem;
  color: #888;
}

/* ═══════════════════════════════════════
   TOC SEARCH
   ═══════════════════════════════════════ */

.toc-search {
  position: relative;
  margin-bottom: 20px;
}

.toc-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px 12px;
  max-width: 210px;
  transition: border-color 0.15s;

  &:focus-within {
    border-color: var(--brand);
  }
}

.toc-search-icon {
  flex-shrink: 0;
  color: #888;
}

.toc-search-input {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--brand);
  border: none;
  outline: none;
  background: none;
  width: 100%;
  padding: 0;

  &::placeholder {
    color: #bbb;
  }
}

.toc-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid #eee;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;

  &.open {
    display: block;
  }
}

.search-result-item {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.1s;

  &:last-child {
    border-bottom: none;
  }

  &:hover {
    background: #f8f8f8;
  }
}

.search-result-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand);
}

.search-result-excerpt {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-empty {
  padding: 12px;
  font-size: 0.8125rem;
  color: #888;
  text-align: center;
}

/* ═══════════════════════════════════════
   RESPONSIVE — Tablet (hide TOC)
   ═══════════════════════════════════════ */

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

  .docs-content {
    margin-right: 0;
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Mobile (docs-specific)
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  :root {
    --header-h: calc(var(--announcement-h) + var(--nav-h-scrolled));
  }

  /* Sidebar as overlay on mobile */
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid #eee;
    padding-top: 60px;
    box-shadow: none;

    &.open {
      transform: translateX(0);
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
    }
  }

  .sidebar-close {
    display: block;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    margin-bottom: 24px;
    padding: 0;
    font-size: 14px;
  }

  .docs-content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
}
