/* ═══════════════════════════════════════════════════
   BASE.CSS — Shared foundation for all themes
   Variables, reset, layout, modal, gear, accessibility
════════════════════════════════════════════════════ */

/* ── Font size scale ── */
html[data-font-size="sm"] { --fs-base: 11px; }
html[data-font-size="md"] { --fs-base: 13px; }
html[data-font-size="lg"] { --fs-base: 15px; }

/* ── Dark/Light mode via data-color-scheme ── */
html[data-color-scheme="light"] {
  color-scheme: light;
  --bg:          #ffffff;
  --bg-subtle:   #f5f5f5;
  --bg-card:     #ffffff;
  --text:        #111111;
  --text-muted:  #555555;
  --text-faint:  #888888;
  --border:      #e0e0e0;
  --border-soft: #ebebeb;
}

html[data-color-scheme="dark"] {
  color-scheme: dark;
  --bg:          #0f0f0f;
  --bg-subtle:   #1a1a1a;
  --bg-card:     #161616;
  --text:        #f0f0f0;
  --text-muted:  #aaaaaa;
  --text-faint:  #666666;
  --border:      #2a2a2a;
  --border-soft: #222222;
}

html[data-color-scheme="system"] {
  color-scheme: light dark;
  --bg:          #ffffff;
  --bg-subtle:   #f5f5f5;
  --bg-card:     #ffffff;
  --text:        #111111;
  --text-muted:  #555555;
  --text-faint:  #888888;
  --border:      #e0e0e0;
  --border-soft: #ebebeb;
}

@media (prefers-color-scheme: dark) {
  html[data-color-scheme="system"] {
    --bg:          #0f0f0f;
    --bg-subtle:   #1a1a1a;
    --bg-card:     #161616;
    --text:        #f0f0f0;
    --text-muted:  #aaaaaa;
    --text-faint:  #666666;
    --border:      #2a2a2a;
    --border-soft: #222222;
  }
}

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

body {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--fs-base, 13px);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

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

/* ── Layout ── */
.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

/* ── Gear button ── */
.gear-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: transform 0.3s ease, box-shadow 0.2s ease;
}

.gear-btn svg {
  width: 20px;
  height: 20px;
}

.gear-btn:hover {
  transform: rotate(45deg);
}

.gear-btn.open {
  transform: rotate(90deg);
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

/* ── Modal box ── */
.modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  border-radius: 10px;
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-weight: 500;
  font-size: 13px;
  border-bottom: 0.5px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 0.5px solid var(--border);
}

.modal-hint {
  font-size: 10px;
  color: var(--text-faint);
}

/* ── Setting groups ── */
.setting-group {}

.setting-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.btn-group {
  display: flex;
  gap: 6px;
}

.opt-btn {
  flex: 1;
  padding: 7px 6px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.opt-btn:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--text-faint);
}

.opt-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.scheme-icon {
  font-size: 12px;
}

/* ── Shared section structure ── */
.section {
  margin-bottom: 2.4rem;
}

/* ── Job / Education shared ── */
.job {
  margin-bottom: 1.6rem;
}

.job-header,
.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.job-company {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.job-date {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.job-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.job-desc,
.about-text,
.edu-degree {
  color: var(--text-muted);
  line-height: 1.8;
}

.edu-school {
  font-weight: 500;
}

/* ── Skills row ── */
.skills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Projects grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.project-name {
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.project-desc {
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 10px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Contact icons ── */
.contact-icons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-link svg {
  width: 14px;
  height: 14px;
}

.icon-link:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-subtle);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .job-header, .edu-header {
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 420px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .wrap {
    padding: 2rem 1.25rem 5rem;
  }
}
