/* ============================================================
   SAYYAKU PORTFOLIO — GLOBAL STYLESHEET
   Brand: Editorial Dark Academic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=JetBrains+Mono:wght@300;400;500&family=Geist:wght@300;400;500;600&display=swap');

/* ── BRAND TOKENS ───────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:        #f7f3eb;
  --bg-surface:     #fdfaf4;
  --bg-elevated:    #fffdf9;
  --bg-hover:       #efe7d9;

  --border-subtle:  #e3d8c6;
  --border-default: #d2c1a6;
  --border-strong:  #bda37e;

  --text-primary:   #1f1a14;
  --text-secondary: #4f4639;
  --text-muted:     #7c705f;

  --accent-gold:    #a06f1f;
  --accent-amber:   #8e6118;
  --accent-warm:    #bb8534;
  --accent-glow:    rgba(160, 111, 31, 0.12);
  --header-bg:      rgba(247, 243, 235, 0.86);

  --danger:         #c0524a;

  /* Typography */
  --font-display:   'Cormorant Garamond', Georgia, serif;
  --font-ui:        'Geist', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  40px;
  --sp-2xl: 64px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;

  /* Layout */
  --sidebar-w:  clamp(220px, 18vw, 320px);
  --rightrail-w: clamp(240px, 22vw, 360px);

  /* Transition */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── DARK THEME OVERRIDES ──────────────────────────────── */
body.theme-dark {
  --bg-base:        #0c0b09;
  --bg-surface:     #131210;
  --bg-elevated:    #1a1916;
  --bg-hover:       #201f1c;

  --border-subtle:  #252320;
  --border-default: #302e2a;
  --border-strong:  #44413c;

  --text-primary:   #f0ece3;
  --text-secondary: #a09a90;
  --text-muted:     #5c5852;

  --accent-gold:    #d4a843;
  --accent-amber:   #b8863a;
  --accent-warm:    #e8c070;
  --accent-glow:    rgba(212, 168, 67, 0.12);
  --header-bg:      rgba(12, 11, 9, 0.85);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── LAYOUT SHELL ───────────────────────────────────────── */
.site-wrapper {
  display: flex;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ── LEFT SIDEBAR ───────────────────────────────────────── */
.sidebar-left {
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg) var(--sp-md);
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-left::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-xl);
  padding: var(--sp-sm);
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bg-base);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

/* NAV */
.sidebar-nav { display: flex; flex-direction: column; gap: var(--sp-xs); flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  transition: all 0.18s var(--ease);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

.nav-label { font-size: 0.9375rem; }

.mobile-nav-trigger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1300;
  transition: all 0.18s var(--ease);
}

.mobile-nav-trigger:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.mobile-nav-trigger svg {
  width: 19px;
  height: 19px;
}

.mobile-nav-overlay {
  display: none;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  width: 100%;
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-md);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.theme-toggle-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.theme-toggle-label {
  white-space: nowrap;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-sm);
  border-radius: var(--r-md);
  margin-top: var(--sp-lg);
  cursor: pointer;
  transition: background 0.18s;
}
.sidebar-profile:hover { background: var(--bg-hover); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-handle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── MAIN CONTENT ───────────────────────────────────────── */
.main-content {
  flex: 1 1 auto;
  min-width: 0;
  border-right: 1px solid var(--border-subtle);
  max-width: none;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--sp-md) var(--sp-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.header-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── RIGHT RAIL ─────────────────────────────────────────── */
.sidebar-right {
  width: var(--rightrail-w);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: var(--sp-lg) var(--sp-md);
  flex-shrink: 0;
  scrollbar-width: none;
}
.sidebar-right::-webkit-scrollbar { display: none; }

/* ── CARDS & SURFACES ───────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-default); }

.card-section {
  padding: var(--sp-md) var(--sp-lg);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: var(--sp-sm);
}

.card + .card { margin-top: var(--sp-md); }

/* ── FEED / POST ITEMS ──────────────────────────────────── */
.feed-item {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
  cursor: pointer;
}
.feed-item:hover { background: var(--bg-surface); }

.feed-item:last-child { border-bottom: none; }

.feed-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}

.feed-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(212, 168, 67, 0.2);
}

.feed-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.feed-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: var(--sp-sm);
  color: var(--text-primary);
  transition: color 0.15s;
}
.feed-item:hover .feed-title { color: var(--accent-warm); }

.feed-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: var(--sp-md);
}

.feed-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.15s;
}
.feed-action:hover { color: var(--accent-gold); }
.feed-action svg { width: 15px; height: 15px; }

/* ── WRITING STYLES ─────────────────────────────────────── */
.writing-item {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}
.writing-item:hover { background: var(--bg-surface); }

.writing-number {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-xs);
}

.writing-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: var(--sp-xs);
  transition: color 0.15s;
}
.writing-item:hover .writing-title { color: var(--accent-warm); }

.writing-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-sm);
}

.writing-meta-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  padding: 2px 8px;
  border-radius: 4px;
}

.tag-accent {
  color: var(--accent-gold);
  border-color: rgba(212, 168, 67, 0.3);
  background: var(--accent-glow);
}

.read-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── PROFILE HERO (HOME) ─────────────────────────────────── */
.profile-hero {
  padding: var(--sp-xl) var(--sp-lg);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(212, 168, 67, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--accent-gold);
  margin-bottom: var(--sp-md);
}

.hero-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: var(--sp-xs);
}

.hero-handle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
}

.hero-bio {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: var(--sp-lg);
}

.hero-stats {
  display: flex;
  gap: var(--sp-xl);
}

.stat-item { display: flex; flex-direction: column; gap: 2px; }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── PROJECT ITEMS ──────────────────────────────────────── */
.project-item {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
  cursor: pointer;
}
.project-item:hover { background: var(--bg-surface); }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-sm);
}

.project-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.15s;
}
.project-item:hover .project-name { color: var(--accent-warm); }

.project-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-sm);
}

.project-stack {
  display: flex;
  gap: var(--sp-xs);
  flex-wrap: wrap;
}

/* ── RIGHT RAIL COMPONENTS ──────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-sm) var(--sp-md);
  margin-bottom: var(--sp-md);
  transition: border-color 0.18s;
}
.search-bar:focus-within { border-color: var(--accent-gold); }

.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  padding: var(--sp-md) var(--sp-lg);
}

.skill-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}
.skill-chip:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-glow);
}

.contact-links { padding: var(--sp-md) var(--sp-lg); display: flex; flex-direction: column; gap: var(--sp-sm); }

.contact-link {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: var(--sp-xs) 0;
  transition: color 0.15s;
}
.contact-link:hover { color: var(--accent-gold); }
.contact-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-sm) 0;
}

/* ── TABS ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--sp-md) var(--sp-lg);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.18s;
}
.tab:hover { color: var(--text-primary); background: var(--bg-surface); }
.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-gold);
  font-weight: 500;
}

/* ── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeUp 0.5s var(--ease) both; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.10s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.20s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.30s; }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--r-lg);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.18s var(--ease);
}

.btn-primary {
  background: var(--accent-gold);
  color: var(--bg-base);
}
.btn-primary:hover { background: var(--accent-warm); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sidebar-right { display: none; }
  .main-content {
    max-width: none;
    border-right: none;
  }
}

@media (max-width: 1100px) {
  .mobile-nav-trigger {
    display: inline-flex;
  }

  .mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 11, 9, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 1190;
  }

  .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 300px);
    max-width: 300px;
    height: 100dvh;
    background: var(--bg-base);
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    z-index: 1200;
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.28);
  }

  body.drawer-open .sidebar-left {
    transform: translateX(0);
  }

  body.drawer-open .mobile-nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .page-header {
    padding-left: 64px;
  }
}

@media (max-width: 480px) {
  :root { --sp-lg: 16px; }
  .mobile-nav-trigger {
    top: 10px;
    left: 10px;
    width: 38px;
    height: 38px;
  }
  .hero-name { font-size: 1.5rem; }
}
