@import "tokens.css";

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Layout ── */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ── Site Header (compact) ── */
.site-header {
  background: var(--header-bg);
  padding: .4rem var(--space-xl);
  position: relative;
}

.site-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .45rem;
  text-decoration: none;
}

.logo-mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .55rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .02em;
}

.logo-text {
  font-size: .88rem;
  font-weight: 700;
  color: var(--header-text);
  letter-spacing: -.01em;
}

.logo-text .dot { color: var(--accent); }

/* ── Global Nav ── */
.global-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: var(--space-lg);
  flex: 1;
  min-width: 0;
}

.gn-link {
  font-size: .72rem;
  font-weight: 600;
  color: var(--header-text);
  opacity: .55;
  padding: .3rem .55rem;
  border-radius: var(--radius-sm);
  transition: opacity .15s, background .15s;
  white-space: nowrap;
  text-decoration: none;
}

.gn-link:hover {
  opacity: .85;
  background: rgba(255,255,255,.07);
  color: var(--header-text);
}

.gn-link.active {
  opacity: 1;
  background: rgba(255,255,255,.1);
}

/* ── Header Actions ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.ha-btn {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--header-text);
  opacity: .5;
  font-size: .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s, background .15s;
  line-height: 1;
}

.ha-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,.1);
}

.ha-auth {
  font-size: .68rem;
  font-weight: 500;
  color: var(--header-text);
  opacity: .5;
  text-decoration: none;
  padding: .2rem .5rem;
  transition: opacity .15s;
}

.ha-auth:hover { opacity: 1; color: var(--header-text); }

/* ── Hamburger (mobile only) ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 3.5px;
  width: 1.8rem;
  height: 1.8rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .4rem;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--header-text);
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}

.hamburger.open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ── Breadcrumb bar (below header, from block nav) ── */
.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: .3rem var(--space-xl);
  background: var(--header-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .7rem;
}

.header-breadcrumb a {
  color: var(--header-text);
  opacity: .6;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}

.header-breadcrumb a:hover { opacity: 1; color: var(--header-text); }

.bc-sep { color: var(--header-text); opacity: .3; }

.bc-current {
  color: var(--header-text);
  opacity: .7;
  font-weight: 500;
}

/* ── Responsive: nav ── */
@media (max-width: 768px) {
  .global-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--header-bg);
    padding: .5rem 0;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 100;
  }

  .global-nav.open { display: flex; }

  .gn-link {
    padding: .6rem var(--space-xl);
    border-radius: 0;
    font-size: .8rem;
  }

  .gn-link.active { background: rgba(255,255,255,.06); }

  .hamburger { display: flex; }

  .header-actions .ha-btn { display: none; }
}

@media print {
  .site-header { display: none !important; }
  .site-footer { display: none !important; }
  .container { padding-right: 0 !important; max-width: none; }
  body { padding: 0; }
}

/* ── Hero ── */
.hero {
  padding: var(--space-2xl) 0;
  text-align: center;
}

.hero-greeting {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.hero h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

.hero-sub {
  font-size: .88rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Bookmark Module Card ── */
.bm-module-card {
  position: relative;
}

.bm-module-full {
  grid-column: 1 / -1;
}

.bm-module-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.bm-module-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}

.bm-module-link:hover {
  color: var(--accent);
}

.bm-module-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.bm-module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.bm-sg-add-form {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.bm-sg-name-input {
  padding: .2rem .5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .7rem;
  width: 120px;
}

.bm-sg-name-input:focus {
  outline: none;
  border-color: var(--accent);
}

.bm-module-section {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.bm-module-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.bm-module-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.bm-module-section-label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: 7rem;
  flex-shrink: 0;
  position: relative;
  padding-top: .25rem;
}

.bm-module-section-title {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.bm-sg-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px;
  font-size: .6rem;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}

.bm-module-section-label:hover .bm-sg-edit-btn {
  opacity: .6;
}

.bm-sg-edit-btn:hover {
  opacity: 1 !important;
}

.bm-sg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}

.bm-sg-edit-form {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  gap: 4px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  align-items: center;
  white-space: nowrap;
}

.bm-sg-edit-form.show {
  display: flex;
}

.bm-module-item-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.bm-sg-move-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px;
  font-size: .6rem;
  line-height: 1;
  border-radius: 3px;
  opacity: 0;
  transition: opacity .15s;
}

.bm-module-item-wrap:hover .bm-sg-move-btn {
  opacity: 1;
}

.bm-sg-move-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
  min-width: 140px;
  padding: .2rem 0;
}

.bm-sg-move-menu.show {
  display: block;
}

.bm-move-option {
  display: block;
  width: 100%;
  padding: .35rem .7rem;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: .7rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.bm-move-option:hover {
  background: var(--surface-alt);
  color: var(--accent);
}

.bm-module-section-empty {
  font-size: .68rem;
  color: var(--text-muted);
  padding: .3rem 0;
}

.bm-module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

.bm-module-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: .72rem;
  transition: border-color .15s, box-shadow .15s;
  white-space: nowrap;
  max-width: 160px;
}

.bm-module-item:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(74, 111, 165, .1);
  color: var(--text);
}

.bm-module-favicon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bm-module-favicon img {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.bm-module-letter {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .55rem;
  font-weight: 700;
  border-radius: 2px;
}

.bm-module-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Module Split (1:2) ── */
.module-split {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.module-split-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.module-split-right {
  display: flex;
  flex-direction: column;
}

.tw-card-fill {
  flex: 1;
}

@media (max-width: 768px) {
  .module-split {
    grid-template-columns: 1fr;
  }
}

/* ── Module Grid ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
  padding-bottom: var(--space-2xl);
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: border-color .15s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
}

.module-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(74, 111, 165, .08);
}

.module-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.module-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.module-icon.blue    { background: var(--accent-soft); color: var(--accent); }
.module-icon.warm    { background: var(--warm-soft);   color: var(--warm); }
.module-icon.green   { background: var(--green-soft);  color: var(--green); }
.module-icon.red     { background: var(--red-soft);    color: var(--red); }
.module-icon.yellow  { background: var(--yellow-soft); color: var(--yellow); }

.module-title {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
}

.module-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.module-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: .7rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.live   { background: var(--green); }
.status-dot.soon   { background: var(--yellow); }
.status-dot.plan   { background: var(--border); }

.status-label.live { color: var(--green); }
.status-label.soon { color: var(--yellow); }
.status-label.plan { color: var(--text-muted); }

/* ── Site Status ── */
.site-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.ss-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.ss-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ss-icon.green { background: var(--green-soft); color: var(--green); }
.ss-icon.blue  { background: var(--accent-soft); color: var(--accent); }
.ss-icon.warm  { background: var(--warm-soft);   color: var(--warm); }
.ss-icon.red   { background: var(--red-soft);    color: var(--red); }

.ss-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ss-label {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ss-value {
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ss-val-danger { color: var(--red); }

.ss-disk .ss-body { gap: var(--space-xs); }
.ss-disk-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}

.ss-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.ss-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .3s;
}

.ss-bar-fill.warn   { background: var(--yellow); }
.ss-bar-fill.danger  { background: var(--red); }

.ss-sub {
  font-size: .62rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Site Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) var(--space-xl);
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-md); }

  .site-header { padding: .35rem var(--space-md); }
  .site-header-inner { gap: var(--space-sm); }

  .hero { padding: var(--space-xl) 0; }
  .hero h1 { font-size: 1.35rem; }

  .module-grid { grid-template-columns: 1fr; gap: var(--space-md); }

  .site-status { grid-template-columns: 1fr; }
}

