/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg:         #0a0a0a;
  --text:       #ffffff;
  --muted:      #737373;
  --faint:      #404040;
  --border:     rgba(255, 255, 255, 0.07);

  --page-pad:      52px;
  --sidebar-width: 380px;

  /* Sidebar - Arc's visual identity, unchanged */
  --sb-bg:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.5), transparent 36%),
    linear-gradient(180deg, #f0ecfa 0%, #ece8f5 100%);
  --sb-text:         #1f2554;
  --sb-muted:        #7f7a99;
  --sb-line:         rgba(70, 63, 101, 0.13);
  --sb-hover:        rgba(255, 255, 255, 0.38);
  --sb-active-bg:    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 252, 0.96));
  --sb-active-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 8px 14px -10px rgba(60, 46, 114, 0.28),
    0 -2px 4px -5px rgba(60, 46, 114, 0.16);
  --sb-cmd-bg:     rgba(247, 244, 251, 0.98);
  --sb-cmd-border: rgba(109, 99, 146, 0.13);
}

/* ─── Base ───────────────────────────────────────────────────────────────── */

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* single screen - no scroll */
}

/* Dot grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }

/* ─── Layout - nominal.dev grid ──────────────────────────────────────────── */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  height: 100vh;
}

/* ─── Page - content anchored to bottom-left ─────────────────────────────── */

.page {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 28px var(--page-pad);
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.page-header {
  align-self: start;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: -0.02em;
}

/* ─── Hero - bottom of the page column ──────────────────────────────────── */

.hero {
  align-self: end;
  padding-bottom: 52px;
  max-width: 720px;
}

h1 {
  font-size: min(8vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.0;
  color: var(--text);
  margin-bottom: 20px;
}

.sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 28px;
  max-width: 44ch;
}

/* ─── Actions ────────────────────────────────────────────────────────────── */

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  background: #ffffff;
  color: #0a0a0a;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  letter-spacing: -0.01em;
  transition: background 120ms ease, transform 120ms ease;
}

.cta-primary:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 18px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  font-weight: 400;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: color 120ms ease, border-color 120ms ease;
}

.cta-secondary:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.22);
}

.footnote {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  height: 100vh;
  background: var(--sb-bg);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: -2px 0 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 8px 12px;
  gap: 10px;
}

/* ─── Search ─────────────────────────────────────────────────────────────── */

.search-area {
  position: relative;
  padding: 8px 6px 2px;
  flex-shrink: 0;
}

.search-meta {
  display: flex;
  justify-content: space-between;
  color: var(--sb-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  padding-bottom: 6px;
  text-transform: lowercase;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sb-text);
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  padding: 4px 0 10px;
  caret-color: var(--sb-text);
}

.search-input::placeholder { color: var(--sb-muted); }

/* ─── Command dropdown ───────────────────────────────────────────────────── */

.command-dropdown {
  position: absolute;
  top: calc(100% - 4px);
  left: 6px; right: 6px;
  z-index: 30;
  background: var(--sb-cmd-bg);
  border: 1px solid var(--sb-cmd-border);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(63, 48, 110, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(260px, calc(100vh - 96px));
  overflow-y: auto;
  padding: 6px;
}

.command-dropdown[hidden] { display: none; }

.command-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: transparent; border: none; border-radius: 10px;
  color: var(--sb-text); cursor: pointer; padding: 8px 10px; text-align: left;
  transition: background 80ms ease;
}
.command-item:hover, .command-item-active { background: rgba(255, 255, 255, 0.58); }
.command-item-copy { display: flex; flex-direction: column; min-width: 0; }
.command-name  { font-size: 12px; font-weight: 600; color: var(--sb-text); line-height: 1.25; }
.command-desc  { font-size: 10.5px; color: var(--sb-muted); line-height: 1.35; }
.command-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #5f5980; white-space: nowrap; }
.command-empty { font-size: 11px; color: var(--sb-muted); padding: 8px 10px; }

/* ─── Tab list ───────────────────────────────────────────────────────────── */

.tab-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-list {
  display: flex; flex-direction: column; gap: 2px;
  height: 100%; overflow: auto;
  scrollbar-width: none; overscroll-behavior: contain;
}
.tab-list::-webkit-scrollbar { display: none; }

/* ─── Sticky tab ─────────────────────────────────────────────────────────── */

.sticky-tab-shell {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 5; pointer-events: none; padding: 2px 0;
  background: var(--sb-bg);
}
.sticky-tab-shell[hidden] { display: none; }
.sticky-tab-shell .tab-row,
.sticky-tab-shell .tab-btn { pointer-events: auto; }

/* ─── Separator ──────────────────────────────────────────────────────────── */

.tab-section-sep {
  display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px;
}
.tab-section-sep-line { flex: 1; height: 1px; background: var(--sb-line); }
.tab-section-sep-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--sb-muted); white-space: nowrap; opacity: 0.7;
}

/* ─── Tab section / group ────────────────────────────────────────────────── */

.tab-section { display: flex; flex-direction: column; gap: 3px; }
.tab-section + .tab-section { margin-top: 8px; }
.tab-group { display: flex; flex-direction: column; gap: 3px; }
.tab-group-children { display: flex; flex-direction: column; gap: 3px; padding-left: 18px; }

/* ─── Tab row ────────────────────────────────────────────────────────────── */

.tab-row { position: relative; display: flex; align-items: center; border-radius: 10px; }

.tab-btn {
  display: flex; align-items: center; flex: 1; min-width: 0; gap: 10px;
  min-height: 40px; padding: 8px 12px;
  background: transparent; border: none; border-radius: 13px;
  color: var(--sb-text); cursor: pointer; text-align: left;
  transition: background 120ms ease, box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.tab-btn:hover { background: var(--sb-hover); }
.tab-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(73, 67, 100, 0.16); }
.tab-row-active .tab-btn { background: var(--sb-active-bg); box-shadow: var(--sb-active-shadow); }
.tab-group-btn { padding-right: 12px; }

/* ─── Favicon ────────────────────────────────────────────────────────────── */

.tab-favicon { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; object-fit: contain; }
.tab-favicon-letter {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0;
  background: rgba(84, 76, 117, 0.1); color: #665f83;
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase;
}

/* ─── Tab text ───────────────────────────────────────────────────────────── */

.tab-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tab-title { font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--sb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-row-active .tab-title { font-weight: 600; }
.tab-url { font-size: 11px; line-height: 1.3; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ─── Folder icon ────────────────────────────────────────────────────────── */

.tab-folder { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.tab-folder-icon { width: 18px; height: 18px; }

.tab-folder-grey,
.tab-folder-gray   { color: #8f8f8f; }
.tab-folder-blue   { color: #5d8eff; }
.tab-folder-red    { color: #ff6b63; }
.tab-folder-yellow { color: #d5a219; }
.tab-folder-green  { color: #53a26a; }
.tab-folder-pink   { color: #df6ba9; }
.tab-folder-purple { color: #8e6bff; }
.tab-folder-cyan   { color: #3aa8b8; }
.tab-folder-orange { color: #ef8b32; }

.tab-group-title { font-size: 13px; }
.empty-state { font-size: 11px; color: var(--sb-muted); padding: 8px 10px; }

/* ─── New tab ────────────────────────────────────────────────────────────── */

.sidebar-new-tab { flex-shrink: 0; padding: 0 2px 4px; }

.new-tab-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 6px 12px;
  background: transparent; border: none; border-radius: 13px;
  color: var(--sb-muted); cursor: pointer; text-align: left;
  transition: background 120ms ease;
}
.new-tab-btn:hover { background: var(--sb-hover); }
.new-tab-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; color: #69637f; flex-shrink: 0; }
.new-tab-label { font-size: 12.5px; font-weight: 500; color: #6f6984; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  :root { --sidebar-width: 320px; --page-pad: 36px; }
  h1 { font-size: min(9vw, 5.2rem); }
}

@media (max-width: 780px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: auto; min-height: 100vh; }
  .page { min-height: 100svh; }
  .sidebar { height: 480px; border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.4); }
  .sticky-tab-shell { background: var(--sb-bg); }
}

@media (max-width: 520px) {
  :root { --page-pad: 20px; }
  h1 { font-size: 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-primary, .cta-secondary, .tab-btn { transition: none; }
}
