/* ==========================================================================
   Thairux Portfolio — Enterprise design system
   Inter typography · amber accent · strict grid · zero decoration noise
   ========================================================================== */

:root {
  /* palette */
  --bg: #13151b;
  --surface: #181b22;
  --card: #1e222b;
  --elevated: #252a36;
  --border: #2b3140;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.1);
  --emerald: #10b981;

  /* rhythm */
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 24px;
  --page-max: 1080px;

  /* type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--text); }

a { color: inherit; text-decoration: none; }

/* ---------- layout shell ---------- */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(19, 21, 27, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header .page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: grid;
  place-items: center;
  color: #0c0a09;
  font-weight: 700;
  font-size: 13px;
}

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

.site-nav a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- hero ---------- */

.hero {
  padding: 88px 0 72px;
  border-bottom: 1px solid var(--border-subtle);
}

.hero .availability {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--emerald);
  margin-bottom: 24px;
}

.hero .availability::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.hero h1 {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 720px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .lead {
  margin-top: 20px;
  max-width: 620px;
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.7;
}

.hero .actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #0c0a09;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover { background: var(--elevated); border-color: #3a4252; }

/* ---------- sections ---------- */

.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.section:last-child { border-bottom: 0; }

.section-head {
  margin-bottom: 40px;
}

.section-head .kicker {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head p {
  margin-top: 10px;
  color: var(--text-2);
  max-width: 560px;
}

/* ---------- skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
}

.skill-group {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 22px;
}

.skill-group h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-group h3::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 11px;
  background: var(--elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-2);
  transition: color 0.15s, border-color 0.15s;
}

.skill-tag:hover { color: var(--accent); border-color: rgba(245, 158, 11, 0.35); }

/* ---------- experience timeline ---------- */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--border));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.timeline-item.current::before {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}

.timeline-role {
  font-size: 17px;
  font-weight: 600;
}

.timeline-role .org {
  color: var(--accent);
  font-weight: 600;
}

.timeline-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin: 4px 0 12px;
}

.timeline-item ul {
  list-style: none;
}

.timeline-item li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}

.timeline-item li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

/* ---------- projects ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, transform 0.2s;
}

.project-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-3px);
}

.project-card .badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.project-card h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-card p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
  flex: 1;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-stack span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--elevated);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.15s;
}

.project-card:hover .project-link { gap: 10px; }

/* ---------- now / building ---------- */

.now-panel {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.now-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

.now-head h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.now-head .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.now-head time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.now-body { padding: 24px; }

.now-body ul { list-style: none; }

.now-body li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 12px;
  color: var(--text-2);
  font-size: 14px;
}

.now-body li:last-child { margin-bottom: 0; }

.now-body li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ---------- contact / footer ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.contact-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.contact-card:hover { border-color: rgba(245, 158, 11, 0.35); }

.contact-card .label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.contact-card .value {
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-3);
  font-size: 13px;
}

.site-footer .page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.social-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.social-links a {
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  transition: all 0.15s;
}

.social-links a:hover {
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.35);
}

/* ---------- blog ---------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}

.post-card:hover { border-color: rgba(245, 158, 11, 0.3); }

.post-card time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.post-card h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 8px 0;
  letter-spacing: -0.01em;
}

.post-card p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}

.post-card .read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- article ---------- */

.article { max-width: 720px; }

.article-head { padding: 56px 0 40px; }

.article-head time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}

.article-head h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-top: 12px;
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-2);
}

.article-body h2, .article-body h3 {
  color: var(--text);
  margin: 36px 0 12px;
  letter-spacing: -0.015em;
}

.article-body h2 { font-size: 24px; }
.article-body h3 { font-size: 19px; }

.article-body p { margin-bottom: 18px; }

.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--elevated);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent);
}

.article-body pre {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 24px 0;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.article-body ul, .article-body ol {
  margin: 0 0 18px 22px;
}

.article-body li { margin-bottom: 8px; }

.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- article head ---------- */

.article-head .kicker {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.article-head .lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 640px;
  margin-top: 14px;
}

.article-head .post-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin-top: 14px;
}

.article-head .post-meta span { margin-left: 12px; }

.article-body { max-width: 720px; }

.article-head .project-meta-note {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 14px;
}

.article-head .project-meta-note a { color: var(--accent); }

/* ---------- project detail ---------- */

.project-technologies {
  margin-top: 48px;
  max-width: 720px;
}

.project-technologies h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.technologies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag {
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-2);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
  max-width: 720px;
}

.post-footer {
  max-width: 720px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.post-footer .back-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- cv ---------- */

.cv-contact {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-3);
  margin-top: 10px;
}

.cv-contact a { color: var(--accent); }

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.cv-body h2 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cv-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin: -4px 0 12px;
}

.cv-skills {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
}

.cv-skills strong { color: var(--text); }

.cv-skill-list {
  columns: 2;
  column-gap: 32px;
  margin-bottom: 20px;
}

.cv-skill-list li { break-inside: avoid; }

.cv-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
  margin-left: 8px;
}

.cv-stack {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin-top: -6px;
}

/* ---------- print / pdf export ---------- */

@media print {
  .site-header, .site-footer, .cv-actions, .availability { display: none !important; }

  body, html { background: #fff !important; }

  .page { padding: 0 !important; max-width: none !important; }

  .article-head { padding: 0 0 16px !important; }

  .article-head h1 { color: #111 !important; font-size: 26px !important; }

  .article-head .lead { color: #333 !important; font-size: 13px !important; }

  .cv-contact { color: #444 !important; font-size: 11px !important; }
  .cv-contact a { color: #b45309 !important; text-decoration: none !important; }

  .cv-body {
    color: #1a1a1a !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
  }

  .cv-body h2 {
    color: #111 !important;
    font-size: 14pt !important;
    border-bottom: 1px solid #ccc !important;
    margin: 18px 0 8px !important;
    page-break-after: avoid;
  }

  .cv-body h3 {
    color: #111 !important;
    font-size: 12pt !important;
    page-break-after: avoid;
  }

  .cv-body p, .cv-body li { color: #1a1a1a !important; }

  .cv-body a { color: #b45309 !important; text-decoration: none !important; }

  .cv-meta { color: #666 !important; }

  .cv-status { color: #b45309 !important; border-color: #d4a25a !important; }

  .cv-stack { color: #666 !important; }

  .cv-skill-list { columns: 2; }

  h2, h3 { break-after: avoid-page; }
  ul, li { break-inside: avoid; }

  @page { margin: 1.5cm 1.6cm; }
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .page { padding: 0 20px; }
  .hero { padding: 56px 0 48px; }
  .section { padding: 52px 0; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 6px 10px; font-size: 12px; }
  .cv-skill-list { columns: 1; }
}

/* ---------- cv print button (js hook) ---------- */

#cv-print-btn {
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}

#cv-print-btn:hover { background: var(--accent-hover); }
