:root {
  --bg: #d4d8dd;
  --bg-soft: #2f3338;
  --bg-deep: #1f2328;
  --card: rgba(45, 49, 54, 0.95);
  --surface: rgba(68, 73, 79, 0.92);
  --surface-hover: rgba(85, 91, 98, 0.96);
  --surface-active: rgba(101, 109, 117, 0.98);
  --line: #6b7280;
  --line-soft: #9ca3af;
  --text: #ffffff;
  --text-soft: #e5e7eb;
  --accent: #ffffff;
  --accent-2: #f3f4f6;
  --shadow: 0 14px 28px rgba(17, 24, 39, 0.22);
  --anim-fast: 170ms;
  --anim-open: 620ms;
  --anim-fade: 320ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* this area is for base page layout and theme styles */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.42), transparent 36%),
    radial-gradient(circle at 88% 4%, rgba(148, 163, 184, 0.35), transparent 34%),
    linear-gradient(180deg, #e5e7eb 0%, var(--bg) 58%, #c7cdd4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(100, 116, 139, 0.12) 0 2px,
      rgba(100, 116, 139, 0) 2px 18px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(100, 116, 139, 0.1) 0 2px,
      rgba(100, 116, 139, 0) 2px 18px
    ),
    radial-gradient(circle, rgba(100, 116, 139, 0.34) 1.3px, transparent 1.4px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  pointer-events: none;
}

header,
main {
  width: min(920px, 92vw);
  margin-inline: auto;
}

header {
  margin-top: 2.5rem;
  padding: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
}

header p {
  margin: 0 0 1.35rem;
  color: var(--text-soft);
  max-width: 65ch;
}

.home-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

/* this area is for shared interactive controls like buttons and tabs */
.home-buttons a,
.switch-tab,
#aboutDocDownload,
.cert-toggle-tab {
  /* shared button look */
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  transition:
    border-color var(--anim-fast) ease,
    transform var(--anim-fast) ease,
    background-color var(--anim-fast) ease;
}

.home-buttons a {
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 11px;
}

.home-buttons a:hover,
.home-buttons a:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

main {
  margin-top: 1.5rem;
  margin-bottom: 3rem;
  display: grid;
  gap: 1rem;
}

section {
  padding: 1.85rem;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #3a3f45, var(--bg-soft));
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.3rem, 2.5vw, 1.95rem);
  color: var(--accent);
}

section p {
  margin: 0;
  color: var(--text-soft);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.switch-tab {
  padding: 0.6rem 1rem;
  border-radius: 10px;
  cursor: pointer;
}

.switch-tab:hover,
.switch-tab:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.switch-tab[aria-selected="true"] {
  border-color: var(--line-soft);
  background: var(--surface-active);
}

#aboutTextPanel h2 {
  margin-top: 0;
}

.experience-list {
  display: grid;
  gap: 0.8rem;
}

.experience-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(55, 60, 66, 0.95);
  padding: 0.9rem;
}

.experience-header {
  margin-bottom: 0.55rem;
}

.experience-role {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent-2);
}

.experience-meta {
  margin: 0.2rem 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.experience-points {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
}

.experience-points li + li {
  margin-top: 0.3rem;
}

/* this area is for about section document preview behavior */
.doc-viewer {
  margin-top: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(55, 60, 66, 0.95);
  padding: 0 0.9rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height var(--anim-open) cubic-bezier(0.22, 1, 0.36, 1),
    opacity var(--anim-fade) ease,
    margin-top var(--anim-open) cubic-bezier(0.22, 1, 0.36, 1),
    padding var(--anim-open) cubic-bezier(0.22, 1, 0.36, 1),
    border-color var(--anim-open) ease;
}

.doc-viewer.is-open {
  margin-top: 1rem;
  border-color: var(--line);
  padding: 0.9rem;
  max-height: 1300px;
  opacity: 1;
  pointer-events: auto;
}

.doc-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.doc-viewer-header h3 {
  margin: 0;
  color: var(--accent-2);
  font-size: 1.05rem;
}

#aboutDocDownload {
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 9px;
}

#aboutDocDownload:hover,
#aboutDocDownload:focus-visible {
  border-color: var(--accent);
}

#aboutDocFrame {
  width: 100%;
  height: 84vh;
  min-height: 700px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

/* this area is for section card grids and content cards */
.skills-grid,
.projects-grid,
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.skill-card,
.project-card,
.achievement-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(55, 60, 66, 0.95);
}

.skill-card h3,
.project-card h3,
.achievement-card h3 {
  margin: 0 0 0.5rem;
  color: var(--accent-2);
  font-size: 1.1rem;
}

.project-link {
  color: inherit;
  text-decoration: none;
}

.project-link:hover,
.project-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.skill-card ul,
.achievement-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
}

.skill-card li + li,
.achievement-card li + li {
  margin-top: 0.3rem;
}

.cert-toggle-tab {
  margin-top: 0.7rem;
  padding: 0.55rem 0.85rem;
  border-radius: 9px;
  cursor: pointer;
}

.cert-toggle-tab:hover,
.cert-toggle-tab:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.cert-toggle-tab[aria-expanded="true"] {
  border-color: var(--line-soft);
  background: var(--surface-active);
}

.cert-panel {
  margin-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    margin-top var(--anim-open) cubic-bezier(0.22, 1, 0.36, 1),
    max-height var(--anim-open) cubic-bezier(0.22, 1, 0.36, 1),
    opacity var(--anim-fade) ease;
}

.cert-panel.is-open {
  margin-top: 0.7rem;
  max-height: 420px;
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.certificate-card {
  transition: box-shadow var(--anim-fast) ease;
}

#achievements.certificates-view .achievements-grid {
  grid-template-columns: 1fr;
}

#achievements.certificates-view .achievement-card:not(.certificate-card) {
  display: none;
}

#achievements.certificates-view .certificate-card {
  grid-column: 1 / -1;
}

#achievements.certificates-view .cert-panel.is-open {
  max-height: 1100px;
}

.project-card p {
  margin: 0;
  color: var(--text-soft);
}

.contact-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
}

.contact-list li + li {
  margin-top: 0.4rem;
}

.contact-list a {
  color: var(--accent-2);
  text-decoration: none;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .skills-grid,
  .projects-grid,
  .achievements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #aboutDocFrame {
    height: 78vh;
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  header {
    margin-top: 1.2rem;
    padding: 1.35rem;
    border-radius: 12px;
  }

  section {
    padding: 1.3rem;
    border-radius: 12px;
  }

  .doc-viewer-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #aboutDocFrame {
    height: 66vh;
    min-height: 500px;
  }

  .skills-grid,
  .projects-grid,
  .achievements-grid {
    grid-template-columns: 1fr;
  }
}
