/* 
=========================================================
   TENANTSAGE DESIGN SYSTEM — ARTHIT PUKHAMPUANG
   Governance-First Portfolio
========================================================= 
*/

:root {
  /* Color Palette */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(30, 41, 59, 0.7);
  
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-heading: #f1f5f9;
  
  --accent-primary: #06b6d4;
  --accent-secondary: #0891b2;
  --accent-gradient: linear-gradient(135deg, #06b6d4, #3b82f6);
  
  --border-color: rgba(148, 163, 184, 0.1);
  --border-glow: rgba(6, 182, 212, 0.5);
  
  --surface-glass: backdrop-filter: blur(12px);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.2);
  
  /* Radii & Transitions */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-heading: 'Inter', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* =========================================================
   RESET & BASE
========================================================= */

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

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 1rem;
  font-weight: 600;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: all var(--transition);
}

a:hover {
  color: var(--accent-secondary);
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  flex: 1;
  padding-top: 80px; /* Offset for fixed nav */
}

/* =========================================================
   NAVIGATION
========================================================= */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-heading);
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  letter-spacing: 1px;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-menu a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 0;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition);
}

.nav-menu a:hover, .nav-menu a.active {
  color: var(--text-heading);
}

.nav-menu a:hover::after, .nav-menu a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 20px;
  position: relative;
  z-index: 1001;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-heading);
  position: absolute;
  transition: all var(--transition);
}

.hamburger-line:nth-child(1) { top: 0; }
.hamburger-line:nth-child(2) { top: 9px; }
.hamburger-line:nth-child(3) { top: 18px; }

/* Hamburger Active State */
.nav-toggle.active .hamburger-line:nth-child(1) {
  top: 9px;
  transform: rotate(45deg);
}
.nav-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active .hamburger-line:nth-child(3) {
  top: 9px;
  transform: rotate(-45deg);
}

/* =========================================================
   HERO SECTION
========================================================= */

.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
  z-index: -1;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
}

.hero-text {
  flex: 1;
  max-width: 650px;
}

.hero-badge {
  display: inline-block;
  padding: 0.25rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 540px;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-cta {
  display: flex;
  gap: 1rem;
}

.hero-avatar-wrap {
  flex-shrink: 0;
  position: relative;
}

.hero-avatar-wrap::before {
  content: '';
  position: absolute;
  top: -15px;
  left: -15px;
  right: -15px;
  bottom: -15px;
  border-radius: 50%;
  background: var(--accent-gradient);
  opacity: 0.2;
  filter: blur(20px);
  z-index: -1;
  animation: pulse-glow 4s infinite alternate;
}

.hero-avatar {
  width: clamp(200px, 25vw, 320px);
  height: clamp(200px, 25vw, 320px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: var(--font-heading);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text-heading);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  background: rgba(6, 182, 212, 0.05);
  transform: translateY(-2px);
}

/* =========================================================
   CARDS & GRIDS
========================================================= */

.section-preview {
  padding: 6rem 0;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.5rem);
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: var(--shadow-glow), var(--shadow-card);
  background: var(--bg-card-hover);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.card-title a {
  color: var(--text-heading);
}

.card-title a::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  flex-grow: 1;
}

/* =========================================================
   PAGE HEADER & CONTENT (Markdown styling)
========================================================= */

.page-header {
  padding: 6rem 0 3rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3rem;
}

.page-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
}

.page-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

.single-page .content {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.1rem;
}

.content h2 {
  font-size: 2rem;
  margin: 3rem 0 1.5rem;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.content h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

.content p {
  margin-bottom: 1.5rem;
}

.content ul, .content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.content li {
  margin-bottom: 0.5rem;
}

.content a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-color: rgba(6, 182, 212, 0.3);
  text-underline-offset: 4px;
}

.content a:hover {
  text-decoration-color: var(--accent-primary);
}

.content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: rgba(6, 182, 212, 0.05);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-primary);
}

.content blockquote p:last-child {
  margin-bottom: 0;
}

.content code {
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #ff7b72;
}

.content pre {
  background: #0d1117;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
}

.content pre code {
  background: transparent;
  padding: 0;
  color: var(--text-primary);
}

.content img {
  border-radius: var(--radius-md);
  margin: 2rem auto;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.content th, .content td {
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  text-align: left;
}

.content th {
  background: var(--bg-secondary);
  font-family: var(--font-heading);
}

/* =========================================================
   LIST PAGES & META
========================================================= */

.section-list .content {
  max-width: 800px;
  margin: 0 auto 4rem auto;
  text-align: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.page-item {
  display: flex;
  flex-direction: column;
}

.card-meta, .card-period {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  display: block;
}

.card-period {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.content-tags {
  max-width: 760px;
  margin: 2rem auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.page-nav {
  max-width: 760px;
  margin: 4rem auto 0;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  flex: 1;
}

.page-nav-link:hover {
  border-color: var(--accent-primary);
  background: rgba(6, 182, 212, 0.05);
}

.page-nav-link.next {
  text-align: right;
}

.page-nav-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.page-nav-title {
  font-weight: 600;
  color: var(--text-heading);
}

/* =========================================================
   SPECIAL COMPONENTS (Governance / Showcase)
========================================================= */

.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.principle-number {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: rgba(6, 182, 212, 0.2);
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  line-height: 1;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin: 3rem 0;
}

.showcase-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 1.5rem;
}

.showcase-item img {
  border-radius: var(--radius-md);
  width: 100%;
  border: 1px solid var(--border-color);
}

.showcase-label {
  margin-top: 1.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-primary);
}

/* Home Showcase */
.showcase {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .showcase {
    flex-direction: row;
    align-items: center;
  }
}

.showcase img {
  width: 100%;
  max-width: 600px;
  border-right: 1px solid var(--border-color);
}

.showcase-caption {
  padding: 3rem;
  flex: 1;
}

.showcase-caption h3 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.showcase-caption p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Contact */
.contact-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.contact-link {
  color: var(--text-heading);
  text-decoration: none !important;
  transition: color var(--transition);
}

.contact-link:hover {
  color: var(--accent-primary);
}

/* =========================================================
   FOOTER
========================================================= */

.site-footer {
  background-color: #05080e;
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
  margin-top: 6rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-heading);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer-links {
  display: contents; /* Flattens to use parent grid */
}

@media (min-width: 768px) {
  .footer-links {
    display: flex;
    gap: 4rem;
    grid-column: 2 / -1;
    justify-content: flex-end;
  }
}

.footer-col h4 {
  color: var(--text-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.75rem;
}

.footer-col a, .footer-location {
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes pulse-glow {
  0% { opacity: 0.1; filter: blur(20px); transform: scale(0.95); }
  100% { opacity: 0.3; filter: blur(25px); transform: scale(1.05); }
}

/* Scroll Animations */
.fade-in, .slide-up, .slide-in-left, .slide-in-right {
  opacity: 0;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}

.fade-in { transform: translateY(20px); }
.slide-up { transform: translateY(40px); }
.slide-in-left { transform: translateX(-40px); }
.slide-in-right { transform: translateX(40px); }

.visible {
  opacity: 1;
  transform: translate(0, 0);
}

/* Stagger delays */
.hero .fade-in:nth-child(1) { transition-delay: 0.1s; }
.hero .fade-in:nth-child(2) { transition-delay: 0.2s; }
.hero .fade-in:nth-child(3) { transition-delay: 0.3s; }
.hero .slide-up { transition-delay: 0.4s; }
.hero .fade-in:nth-child(5) { transition-delay: 0.5s; }

.card-grid .card:nth-child(1) { transition-delay: 0.1s; }
.card-grid .card:nth-child(2) { transition-delay: 0.2s; }
.card-grid .card:nth-child(3) { transition-delay: 0.3s; }
.card-grid .card:nth-child(4) { transition-delay: 0.4s; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .fade-in, .slide-up, .slide-in-left, .slide-in-right {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   RESPONSIVE (MOBILE SPECIFIC)
========================================================= */

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    background: rgba(10, 14, 23, 0.98);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-menu.open {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }

  .hero-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 2rem;
    padding-top: 2rem;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-avatar {
    width: 160px;
    height: 160px;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav-link.next {
    text-align: left;
  }
}
