/* ============================================================
   pae-tun-ngao-portfolio — ตัวอย่างเว็บพอร์ตโฟลิโอของพี่ตูนเงา
   ตอบสนองทุกขนาดหน้าจอ เขียนด้วย HTML/CSS/JavaScript ล้วนๆ
   ============================================================ */

:root {
  --color-bg: #f5f3ec;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-soft: #4b5563;
  --color-muted: #6b7280;
  --color-accent: #6d5cff;
  --color-accent-hover: #5b4be0;
  --color-accent-light: #eef0ff;
  --color-amber: #d97706;
  --color-amber-light: #fef3c7;
  --color-border: #e5e7db;
  --color-success: #15803d;
  --color-danger: #b91c1c;
  --radius: 18px;
  --shadow: 0 14px 38px -14px rgba(16, 24, 40, 0.10),
            0 6px 12px -6px rgba(16, 24, 40, 0.06);
  --font-main: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  font-size: 1rem;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------- Header ------------------------- */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(245, 243, 236, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  z-index: 60;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--color-text);
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--color-text-soft);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.menu-toggle .bar {
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
}
.menu-toggle .bar::before,
.menu-toggle .bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.menu-toggle .bar::before { top: -7px; }
.menu-toggle .bar::after { top: 7px; }

body.menu-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: fixed;
    inset: 72px 0 0 auto;
    width: 260px;
    height: calc(100vh - 72px);
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    flex-direction: column;
    padding: 24px;
    gap: 18px;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    box-shadow: var(--shadow);
    z-index: 70;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links a {
    display: block;
    padding: 10px 0;
    font-size: 1rem;
  }
}

/* ------------------------- Buttons ------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

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

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 6px 16px -6px rgba(109, 92, 255, 0.35);
}

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

.btn-outline {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-text-soft);
}

.btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-danger {
  background: #fef2f2;
  color: var(--color-danger);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fecaca;
}

/* ------------------------- Hero ------------------------- */
.hero {
  padding: 108px 20px 80px;
  background: linear-gradient(180deg, #faf8f3 0%, #f1ede1 100%);
  border-bottom: 1px solid var(--color-border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.hero-content h1 {
  font-size: clamp(2rem, 4.5vw + 0.5rem, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-content .lead {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--color-text-soft);
  max-width: 520px;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-portrait {
  width: min(360px, 92vw);
  height: min(360px, 92vw);
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto;
  border: 8px solid var(--color-surface);
  box-shadow: var(--shadow);
  background: var(--color-border);
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  .hero-content .lead {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ------------------------- Sections ------------------------- */
.section {
  padding: 72px 20px;
}

.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}

.section-header .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.section-header p {
  color: var(--color-text-soft);
  font-size: 1.05rem;
}

/* ------------------------- Cards ------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 24px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.card-image {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  object-fit: cover;
  background: #eef0f3;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  line-height: 1.35;
}

.card p {
  color: var(--color-text-soft);
  font-size: 0.95rem;
  margin-bottom: 16px;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tag {
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-soft);
  background: var(--color-surface);
  white-space: nowrap;
}

/* ------------------------- Timeline ------------------------- */
.timeline {
  position: relative;
  max-width: 860px;
  margin: 0 auto 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
  transform: translateX(-50%);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 64px;
  position: relative;
  align-items: center;
}

.timeline-item:nth-child(even) .timeline-content {
  text-align: right;
  grid-column: 2;
}

.timeline-marker {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-accent);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.timeline-year {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.timeline-content h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.timeline-content p {
  color: var(--color-text-soft);
  font-size: 0.98rem;
}

@media (max-width: 768px) {
  .timeline::before {
    left: 24px;
    top: 0;
    bottom: auto;
    height: 70%;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    padding-left: 40px;
    position: relative;
  }

  .timeline-item:nth-child(even) .timeline-content {
    text-align: left;
    grid-column: 1;
  }

  .timeline-marker {
    left: 24px;
    transform: none;
  }
}

/* ------------------------- Values ------------------------- */
.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.value-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.value-card .value-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 1.4rem;
}

.value-card h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

/* ------------------------- Learning notes ------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  align-items: center;
}

.filter-bar input[type="text"],
.filter-bar input[type="search"] {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 0.95rem;
  width: 240px;
  max-width: 100%;
}

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

.note-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.note-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.note-card h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.note-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--color-text-soft);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.note-card p {
  color: var(--color-text-soft);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.detail-toggle {
  margin-top: auto;
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 0;
}

/* ------------------------- Footer ------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 40px 20px 28px;
  margin-top: 64px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.footer-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-text);
}

.footer-note {
  color: var(--color-text-soft);
  font-size: 0.88rem;
}

/* ------------------------- Personal area ------------------------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
}

.lock-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 44px 32px;
  width: min(430px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.lock-card h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.lock-card p {
  color: var(--color-text-soft);
  font-size: 0.95rem;
  margin-bottom: 26px;
}

.lock-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 18px;
}

.lock-actions {
  display: flex;
  gap: 10px;
}

.error-text {
  color: var(--color-danger);
  font-size: 0.85rem;
  min-height: 1.25em;
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  margin-bottom: 18px;
}

.status-ok {
  background: #f0fdf4;
  color: var(--color-success);
  border-color: #bbf7d0;
}

.personal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-soft);
  margin-bottom: 7px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 0.98rem;
}

.note-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}

.note-item header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.note-item h3 {
  font-size: 1.08rem;
}

.note-meta {
  color: var(--color-text-soft);
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.note-content {
  white-space: pre-wrap;
  color: var(--color-text-soft);
  font-size: 0.96rem;
  margin-bottom: 14px;
}

.note-actions {
  display: flex;
  gap: 10px;
}

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

  .hero-actions {
    flex-direction: column;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}
