/* ─────────────────────────────────────────────
   MNSTR Source — v2 Styles
   ───────────────────────────────────────────── */

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

/* === THEME VARIABLES === */
:root {
  --bg:          #fafaf8;
  --bg-card:     #ffffff;
  --bg-card-h:   #f5f5f3;
  --text:        #141414;
  --text-muted:  #7a7a78;
  --border:      rgba(0, 0, 0, 0.07);
  --border-h:    rgba(0, 0, 0, 0.13);
  --nav-blur-bg: rgba(250, 250, 248, 0.88);
  --nav-border:  rgba(0, 0, 0, 0.07);
  --footer-border: rgba(0, 0, 0, 0.07);
  --toggle-bg:   rgba(0, 0, 0, 0.06);
  --toggle-h:    rgba(0, 0, 0, 0.11);
  --mnstr-filter: invert(1) brightness(0);
  --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius:      16px;
  --nav-h:       64px;
}

[data-theme="dark"] {
  --bg:          #141414;
  --bg-card:     #1c1c1a;
  --bg-card-h:   #242422;
  --text:        #f5f5f3;
  --text-muted:  #888886;
  --border:      rgba(255, 255, 255, 0.07);
  --border-h:    rgba(255, 255, 255, 0.14);
  --nav-blur-bg: rgba(20, 20, 20, 0.88);
  --nav-border:  rgba(255, 255, 255, 0.06);
  --footer-border: rgba(255, 255, 255, 0.06);
  --toggle-bg:   rgba(255, 255, 255, 0.07);
  --toggle-h:    rgba(255, 255, 255, 0.12);
  --mnstr-filter: none;
}

/* === BASE === */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
}

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

/* === LOGO SWITCHING (light/dark) === */
[data-theme="light"] .logo-white { display: none; }
[data-theme="dark"]  .logo-black { display: none; }

/* === NAVIGATION === */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background var(--transition), border-color var(--transition), backdrop-filter var(--transition);
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: var(--nav-blur-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--nav-border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo img {
  height: 22px;
  width: auto;
  filter: var(--mnstr-filter);
  opacity: 0.85;
  transition: opacity var(--transition), filter var(--transition);
}
.nav-logo:hover img { opacity: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 100px;
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.01em;
}
.nav-link:hover {
  color: var(--text);
  background: var(--toggle-bg);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === THEME TOGGLE === */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--toggle-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--toggle-h);
  color: var(--text);
  transform: rotate(20deg);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* === HAMBURGER === */
.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-menu-btn span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-menu-btn.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-menu-btn.open span:nth-child(2) { opacity: 0; }
.nav-menu-btn.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* === MOBILE MENU === */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--nav-blur-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  padding: 20px 24px;
  border-bottom: 1px solid var(--nav-border);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition), opacity var(--transition);
}
.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.mobile-menu ul { display: flex; flex-direction: column; gap: 2px; }
.mobile-link {
  display: block;
  padding: 10px 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: color var(--transition);
}
.mobile-link:last-child { border-bottom: none; }
.mobile-link:hover { color: var(--text); }

/* === MAIN LAYOUT === */
.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 48px) 40px 80px;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* === PAGE HEADER === */
.page-header {
  text-align: center;
  margin-bottom: 56px;
}

.page-title {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 20px;
  color: var(--text);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

.page-title .title-sans {
  font-family: 'DM Sans', sans-serif;
  font-style: normal;
  font-weight: 400;
}

.page-title .circled {
  position: relative;
  display: inline-block;
  padding: 0.04em 0.3em 0.06em;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

.page-title .circled::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--text);
  border-radius: 50%;
  transform: rotate(-2deg);
  pointer-events: none;
  opacity: 0.65;
  transition: border-color var(--transition);
}

.page-subtitle {
  font-size: 1.35rem;
  color: var(--text);
  line-height: 1.5;
  /*max-width: 560px;*/
  margin: 0 auto;
  transition: color var(--transition);
}

.page-subtitle strong {
  color: var(--text);
  font-weight: 500;
}

/* === TOOLS GRID === */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* === TOOL CARD === */
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition:
    background 300ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  background: var(--bg-card-h);
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .tool-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.tool-card-logo {
  padding: 40px 32px 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 140px;
}

.tool-card-logo img {
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  object-position: left center;
  transition: filter var(--transition);
}


.tool-number {
  display: block;
  padding: 0 32px 12px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--text);
  transition: color var(--transition);
}

.tool-card-meta {
  margin-right: 32px;
  margin-left: 32px;
  padding: 25px 0;
  border-top: 1px solid var(--text);
  transition: border-color var(--transition);
}

.tool-desc {
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--text-muted);
  transition: color var(--transition);
}

/* === FOOTER === */
.footer {
  padding: 32px 40px;
  border-top: 1px solid var(--footer-border);
  transition: border-color var(--transition);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo img {
  height: 18px;
  width: auto;
  filter: var(--mnstr-filter);
  opacity: 0.5;
  transition: opacity var(--transition), filter var(--transition);
}
.footer-logo:hover img { opacity: 0.8; }

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* === REVEAL ANIMATIONS === */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }
.reveal-d4 { transition-delay: 0.32s; }

/* Restore card hover transitions after reveal completes — .reveal overrides them otherwise */
.tool-card.reveal.visible {
  transition:
    background 300ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tool-card.reveal.visible:hover {
  transform: translateY(-6px);
  background: var(--bg-card-h);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .tool-card.reveal.visible:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 3px; }

/* === SELECTION === */
::selection { background: rgba(0, 0, 0, 0.1); }
[data-theme="dark"] ::selection { background: rgba(255, 255, 255, 0.12); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: flex; }
  .mobile-menu { display: block; }
  .nav-inner { padding: 0 24px; }

  .main {
    padding: calc(var(--nav-h) + 32px) 24px 60px;
    justify-content: flex-start;
    padding-top: calc(var(--nav-h) + 48px);
  }

  .page-header { margin-bottom: 40px; }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-card { flex-direction: row; align-items: center; }
  .tool-card-logo {
    padding: 24px 24px 24px;
    min-height: auto;
    width: 180px;
    flex-shrink: 0;
  }
  .tool-card-meta {
    padding: 20px 24px 20px;
    border-top: none;
    border-left: 1px solid var(--border);
  }

  .footer { padding: 24px; }
  .footer-inner { justify-content: center; flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .tool-card { flex-direction: column; }
  .tool-card-logo { width: 100%; }
  .tool-card-meta { border-left: none; border-top: 1px solid var(--border); }
}
