/* ==========================================================================
   What The Bug - Design System & Stylesheet
   Fonts: LINE Seed Sans TH
   Brand Palette: Primary #fe5722 | Secondary #ffe0b2
   ========================================================================== */

/* LINE Seed Sans TH Web Fonts */
@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('assets/fonts/LINESeedSansTH_W_Th.woff2') format('woff2'),
       url('assets/fonts/LINESeedSansTH_W_Th.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('assets/fonts/LINESeedSansTH_W_Rg.woff2') format('woff2'),
       url('assets/fonts/LINESeedSansTH_W_Rg.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('assets/fonts/LINESeedSansTH_W_Bd.woff2') format('woff2'),
       url('assets/fonts/LINESeedSansTH_W_Bd.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('assets/fonts/LINESeedSansTH_W_XBd.woff2') format('woff2'),
       url('assets/fonts/LINESeedSansTH_W_XBd.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'LINE Seed Sans TH';
  src: url('assets/fonts/LINESeedSansTH_W_He.woff2') format('woff2'),
       url('assets/fonts/LINESeedSansTH_W_He.woff') format('woff');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design Tokens & Color Palette
   ========================================================================== */
:root {
  --primary: #fe5722;
  --secondary: #ffe0b2;

  /* Dark Theme (Default) */
  --bg: #111111;
  --surface: #191919;
  --surface-hover: #222222;
  --border: #282828;
  --border-hover: #3a3a3a;
  --text-main: #f5f5f5;
  --text-muted: #8e8e8e;
  --link-hover-bg: #fe5722;
  --link-hover-text: #ffffff;

  --badge-bg: rgba(254, 87, 34, 0.14);
  --badge-border: rgba(255, 224, 178, 0.25);
  --badge-text: #ffe0b2;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Light Theme Adaptive (High Contrast & WCAG AA compliant) */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8f7f5;
    --surface: #ffffff;
    --surface-hover: #fbfaf8;
    --border: #e6e3dd;
    --border-hover: #d1cdc5;
    --text-main: #181716;
    --text-muted: #736e67;
    --link-hover-bg: #fe5722;
    --link-hover-text: #ffffff;

    --badge-bg: rgba(254, 87, 34, 0.09);
    --badge-border: rgba(254, 87, 34, 0.22);
    --badge-text: #d84315;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  }
}

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

body {
  font-family: 'LINE Seed Sans TH', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 20px;
  padding-bottom: max(40px, env(safe-area-inset-bottom, 40px));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Profile Section
   ========================================================================== */
.profile {
  text-align: center;
  margin-bottom: 28px;
  width: 100%;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin: 0 auto 16px;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  transition: transform 0.25s ease;
}

.avatar:hover {
  transform: scale(1.04);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.name {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.bio {
  font-size: 14.5px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
  word-break: keep-all;
}

/* ==========================================================================
   Links List
   ========================================================================== */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 15px 18px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.link-icon {
  font-size: 18px;
  color: var(--primary);
  width: 24px;
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.link-title {
  flex: 1;
  letter-spacing: -0.1px;
}

.link-arrow {
  color: var(--text-muted);
  opacity: 0.5;
  margin-left: 10px;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

/* Active / Clickable Links Hover */
.link-item:not(.coming-soon):hover {
  background-color: var(--link-hover-bg);
  border-color: var(--link-hover-bg);
  color: var(--link-hover-text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.link-item:not(.coming-soon):hover .link-icon,
.link-item:not(.coming-soon):hover .link-arrow {
  color: var(--link-hover-text);
  opacity: 1;
}

.link-item:not(.coming-soon):hover .link-arrow {
  transform: translate(2px, -2px);
}

.link-item:not(.coming-soon):active {
  transform: translateY(0);
}

/* Coming Soon Items */
.link-item.coming-soon {
  opacity: 0.88;
}

.link-item.coming-soon:hover {
  border-color: var(--border-hover);
  background-color: var(--surface-hover);
  transform: translateY(-1px);
}

.link-item.coming-soon:active {
  transform: scale(0.99);
}

.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 9px;
  border-radius: 6px;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  flex-shrink: 0;
}

/* ==========================================================================
   Footer & Contact Box
   ========================================================================== */
.footer {
  margin-top: 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.contact-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.contact-note {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.contact-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 9999px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.contact-link i {
  color: var(--primary);
  font-size: 13px;
  transition: transform 0.2s ease;
}

.contact-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.contact-link:hover i {
  transform: scale(1.1);
}

.contact-link:active {
  transform: translateY(0);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-meta .copyright {
  opacity: 0.7;
}

.footer-meta .dot {
  opacity: 0.35;
}

.footer-credits {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.75;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.footer-credits:hover {
  color: var(--primary);
  opacity: 1;
}

/* ==========================================================================
   Credits Page Styles (credits.html)
   ========================================================================== */
.credits-card {
  width: 100%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.credit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.credit-row:last-child {
  border-bottom: none;
}

.credit-label {
  font-size: 14px;
  color: var(--text-muted);
}

.credit-value {
  font-size: 14px;
  font-weight: 600;
  background-color: var(--badge-bg);
  padding: 5px 11px;
  border-radius: 6px;
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
}

.back-wrap {
  width: 100%;
  margin-top: 16px;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background-color: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.back-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--primary);
  padding: 11px 20px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast i {
  color: var(--primary);
  font-size: 14px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Accessibility: Focus States
   ========================================================================== */
.link-item:focus-visible,
.contact-link:focus-visible,
.footer-credits:focus-visible,
.back-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 480px) {
  body {
    padding: 36px 16px;
    padding-bottom: max(32px, env(safe-area-inset-bottom, 32px));
  }
  
  .avatar {
    width: 78px;
    height: 78px;
  }

  .name {
    font-size: 20px;
  }

  .bio {
    font-size: 14px;
  }

  .link-item {
    padding: 14px 16px;
  }

  .contact-links {
    flex-direction: column;
    width: 100%;
  }

  .contact-link {
    width: 100%;
    justify-content: center;
  }
}
