/*
Theme Name: Dewmi Portfolio
Theme URI: https://github.com/
Author: Dewmi Athauda
Author URI: https://linkedin.com/in/dewmi-athauda-44757b32b
Description: A single-page developer portfolio theme with light/dark mode, a built-in "Ask about me" chatbot, and a status-tag design language. Built for Dewmi Athauda — Software Engineering undergraduate & WordPress/PHP web developer.
Version: 1.0.0
Requires at least: 5.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: dewmi-portfolio
*/

/* =========================================================
   0. DESIGN TOKENS
   ========================================================= */
:root {
  /* Light mode (default) */
  --bg: #FAFAF7;
  --bg-alt: #F1F0EA;
  --bg-elevated: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #5B5B6B;
  --border: #E4E2DA;
  --accent: #0F9D74;      /* emerald — "shipped" green */
  --accent-soft: #E3F5EE;
  --accent-2: #6C63FF;    /* indigo — secondary / links */
  --accent-2-soft: #ECEBFF;
  --danger: #E5484D;
  --shadow: 0 1px 2px rgba(26,26,46,0.04), 0 8px 24px rgba(26,26,46,0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font-display: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Poppins', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --max-width: 1180px;
  --transition: 200ms ease;
}

html[data-theme="dark"] {
  --bg: #12131C;
  --bg-alt: #1A1B26;
  --bg-elevated: #1A1B26;
  --text: #EDEDF5;
  --text-muted: #9A9AB0;
  --border: #2A2B3A;
  --accent: #2FE3A6;
  --accent-soft: rgba(47,227,166,0.12);
  --accent-2: #8B85FF;
  --accent-2-soft: rgba(139,133,255,0.14);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 12px 30px rgba(0,0,0,0.35);
}

/* =========================================================
   1. RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

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

.section { padding: 96px 0; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: none; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 18px;
}

.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(28px, 3.4vw, 38px); }
.section-head p { color: var(--text-muted); font-size: 17px; margin: 0; }

/* Visually hidden (skip link etc.) */
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.skip-link {
  position: absolute; top: -60px; left: 12px; background: var(--accent);
  color: #06231A; padding: 10px 16px; border-radius: var(--radius-sm);
  z-index: 999; transition: top var(--transition);
}
.skip-link:focus { top: 12px; }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================
   2. STATUS TAGS (signature element)
   ========================================================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-elevated);
}
.tag--live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }
.tag--academic { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, var(--border)); background: var(--accent-2-soft); }
.tag::before { content: "●"; font-size: 8px; line-height: 1; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.pill-btn:hover { text-decoration: none; transform: translateY(-2px); }
.pill-btn--primary { background: var(--accent); color: #06231A; box-shadow: var(--shadow); }
.pill-btn--primary:hover { box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 35%, transparent); }
.pill-btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.pill-btn--ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* =========================================================
   3. HEADER / NAV
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 16px;
  color: var(--text);
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }

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

.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(12deg); }
.theme-toggle svg { width: 19px; height: 19px; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.menu-toggle {
  display: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  align-items: center; justify-content: center;
}
.menu-toggle span, .menu-toggle::before, .menu-toggle::after {
  content: ""; display: block; width: 18px; height: 2px; background: var(--text); position: relative;
}
.menu-toggle { flex-direction: column; gap: 4px; }

/* =========================================================
   4. HERO
   ========================================================= */
.hero {
  padding: 90px 0 100px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}
.hero-kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.hero-kicker .cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent); margin-left: 4px; animation: blink 1.1s steps(1) infinite; vertical-align: -2px; }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(40px, 5.4vw, 64px);
  margin-bottom: 18px;
}
.hero h1 .accent { color: var(--accent); }
.hero-role {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 22px;
}
.hero-lede { max-width: 540px; color: var(--text-muted); font-size: 17px; margin-bottom: 34px; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 36px; }
.hero-meta { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-meta div { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.hero-meta strong { display: block; font-family: var(--font-display); font-size: 20px; color: var(--text); font-weight: 700; }

.hero-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
}
.hero-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.hero-card-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.hero-card-dot:nth-child(1) { background: #E5484D; }
.hero-card-dot:nth-child(2) { background: #F4B740; }
.hero-card-dot:nth-child(3) { background: var(--accent); }
.hero-card pre {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.9;
  margin: 0;
  overflow-x: auto;
  color: var(--text);
}
.hero-card pre .k { color: var(--accent-2); }
.hero-card pre .s { color: var(--accent); }
.hero-card pre .c { color: var(--text-muted); }

/* =========================================================
   5. ABOUT
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
  align-items: start;
}
.about-copy p { color: var(--text-muted); font-size: 16.5px; margin-bottom: 16px; }
.about-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.fact {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.fact span { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.fact strong { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; }

/* =========================================================
   6. SKILLS
   ========================================================= */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: border-color var(--transition), transform var(--transition);
}
.skill-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.skill-card h3 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.skill-card h3 em { font-style: normal; color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* =========================================================
   7. PROJECTS
   ========================================================= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.project-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-card h3 { font-size: 18px; margin: 0; }
.project-card p { color: var(--text-muted); font-size: 14.5px; margin: 0; flex-grow: 1; }
.project-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.project-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

/* =========================================================
   8. EDUCATION (commit-log timeline)
   ========================================================= */
.timeline { position: relative; padding-left: 34px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border));
}
.timeline-item { position: relative; padding-bottom: 34px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -34px; top: 4px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); margin-bottom: 6px; display: block; }
.timeline-item h3 { font-size: 17px; margin-bottom: 4px; }
.timeline-item p { color: var(--text-muted); font-size: 14.5px; margin: 0; }

/* =========================================================
   9. CONTACT
   ========================================================= */
.contact-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 48px;
}
.contact-links { display: flex; flex-direction: column; gap: 14px; }
.contact-link {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--text);
  font-size: 14.5px;
  transition: border-color var(--transition), transform var(--transition);
}
.contact-link:hover { border-color: var(--accent); transform: translateX(4px); text-decoration: none; }
.contact-link .ico { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }

.contact-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form label { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.04em; }
.contact-form input, .contact-form textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color var(--transition);
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); outline: none; }
.contact-form textarea { min-height: 130px; resize: vertical; }
.form-status { font-size: 14px; font-family: var(--font-mono); min-height: 20px; }
.form-status.ok { color: var(--accent); }
.form-status.err { color: var(--danger); }

/* =========================================================
   10. FOOTER
   ========================================================= */
.site-footer {
  padding: 34px 0;
  text-align: center;
}
.site-footer p { color: var(--text-muted); font-size: 13.5px; margin: 0; font-family: var(--font-mono); }
.site-footer .heart { color: var(--accent); }

/* =========================================================
   11. CHATBOT WIDGET
   ========================================================= */
.chat-toggle {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 80;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #06231A;
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform var(--transition);
}
.chat-toggle:hover { transform: scale(1.07); }
.chat-toggle svg { width: 26px; height: 26px; }
.chat-toggle .dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg); }

.chat-panel {
  position: fixed;
  right: 24px; bottom: 96px;
  z-index: 80;
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 460px;
  max-height: calc(100vh - 160px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-alt);
}
.chat-head .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.chat-head h4 { margin: 0; font-size: 14.5px; }
.chat-head span { display: block; font-size: 12px; color: var(--accent); font-family: var(--font-mono); }
.chat-head span::before { content: "● "; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 82%; font-size: 13.5px; line-height: 1.5; padding: 10px 13px; border-radius: 12px; }
.chat-msg.bot { align-self: flex-start; background: var(--bg-alt); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #06231A; border-bottom-right-radius: 4px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.chat-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
}
.chat-chip:hover { border-color: var(--accent); color: var(--accent); }

.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row input {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.chat-input-row input:focus { outline: none; border-color: var(--accent); }
.chat-input-row button {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--accent); color: #06231A; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-input-row button svg { width: 16px; height: 16px; }

/* =========================================================
   12. SCROLL REVEAL
   ========================================================= */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* =========================================================
   13. RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links { position: fixed; top: 73px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; align-items: flex-start; padding: 18px 28px; gap: 18px; display: none; }
  .nav-links.open { display: flex; }
  .menu-toggle { display: flex; }
  .section { padding: 64px 0; }
  .skills-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .about-facts { grid-template-columns: 1fr 1fr; }
  .hero-meta { gap: 18px; }
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 88px; }
  .chat-toggle { right: 16px; bottom: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .hero { padding: 60px 0 70px; }
  .about-facts { grid-template-columns: 1fr; }
}
