/* ============================================================
   MAHIR TB — PORTFOLIO
   Theme: Pearl White — Modern Editorial Light Mode
   Fonts: Playfair Display (headings) · DM Sans (body) · Fira Code (mono)
   ============================================================ */

/* ── Design Tokens ── */
:root {
  /* Backgrounds */
  --bg:              #F7F6F2;          /* warm pearl white */
  --bg-surface:      #FFFFFF;          /* pure white cards */
  --bg-subtle:       #F0EEE9;          /* slightly deeper for hover/dividers */
  --surface:         rgba(255,255,255,0.7);
  --surface-hover:   rgba(255,255,255,0.9);

  /* Text */
  --ink:             #1C1B19;          /* near-black, warm */
  --ink-muted:       #6B6760;          /* warm mid-grey */
  --ink-faint:       #B0ADA7;          /* very faint labels */

  /* Accent — deep slate-indigo */
  --accent:          #4B6CB7;          /* refined blue accent */
  --accent-lt:       rgba(75,108,183,0.12);
  --accent-dark:     #324D8A;

  /* Borders */
  --rule:            rgba(28,27,25,0.1);
  --rule-strong:     rgba(28,27,25,0.2);

  /* Typography */
  --font-serif:      'Playfair Display', Georgia, serif;
  --font-sans:       'DM Sans', system-ui, sans-serif;
  --font-mono:       'Fira Code', 'Courier New', monospace;

  /* Legacy aliases (editor.html uses these) */
  --bg-color:        var(--bg);
  --secondary-bg:    var(--bg-subtle);
  --accent-color:    var(--accent);
  --text-color:      var(--ink);
  --font-main:       var(--font-mono);

  /* Shadows */
  --shadow-sm:       0 1px 3px rgba(28,27,25,0.06), 0 1px 2px rgba(28,27,25,0.04);
  --shadow-md:       0 4px 16px rgba(28,27,25,0.08), 0 2px 6px rgba(28,27,25,0.05);
  --shadow-lg:       0 12px 40px rgba(28,27,25,0.1), 0 4px 12px rgba(28,27,25,0.06);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0 20px;
  min-height: 100vh;
}

/* ── Links ── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

a:hover {
  color: var(--accent-dark);
  opacity: 0.85;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

main,
#content {
  animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Nav / Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

header div h1 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 3px;
  line-height: 1.2;
}

header div h3 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 400;
  font-style: normal;
  margin-top: 0;
}

header div p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}

nav {
  background: var(--surface);
  padding: 10px 22px;
  border-radius: 40px;
  border: 1px solid var(--rule-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: inline-flex;
  gap: 22px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

nav a {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

nav a:hover {
  color: var(--ink);
  opacity: 1;
}

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

/* ── Page Headings ── */
h1,
h2,
h3 {
  margin-bottom: 12px;
}

h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-style: italic;
  color: var(--ink);
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-style: italic;
  color: var(--ink);
}

h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

/* ── Section Layout ── */
.section {
  padding: 60px 0;
  border-bottom: 1px solid var(--rule);
}

main > .section:first-of-type {
  padding-top: 20px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  font-weight: 500;
}

.section-header h2 {
  margin-bottom: 0;
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--rule-strong);
}

.card:last-child {
  margin-bottom: 0;
}

.card h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.card h3 a {
  color: var(--ink);
}

.card h3 a:hover {
  color: var(--accent);
  opacity: 1;
}

.card small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 12px;
}

.card p {
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.78;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--accent);
  padding: 12px 28px;
  border: 1.5px solid var(--accent);
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  box-shadow: 0 2px 8px var(--accent-lt);
}

.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 4px 16px var(--accent-lt);
  opacity: 1;
  color: #fff;
}

/* Outline variant */
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
  box-shadow: none;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
  box-shadow: none;
  opacity: 1;
}

/* ── About Section ── */
.about-grid {
  display: flex;
  gap: 60px;
  align-items: flex-start;
}

.about-text {
  flex: 2;
}

.about-text p {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin-bottom: 20px;
  line-height: 1.82;
}

.about-text p strong {
  color: var(--ink);
  font-weight: 600;
}

b,
strong {
  font-weight: 600;
}

.about-image-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.profile-pic {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--rule-strong);
  box-shadow: var(--shadow-lg);
  filter: contrast(1.05) saturate(1.05);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.profile-pic:hover {
  transform: scale(1.04);
  box-shadow: 0 20px 50px rgba(28,27,25,0.14);
}

.social-links {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.social-links a {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: 30px;
  padding: 8px 20px;
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.social-links a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-lt);
  opacity: 1;
}

/* ── Editor-specific ── */
.editor-container {
  background: var(--bg-surface);
  min-height: 400px;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  outline: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  display: flex;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.toolbar button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ink-muted);
  transition: all 0.2s ease;
}

.toolbar button:hover,
.toolbar button.active {
  background: var(--accent-lt);
  color: var(--accent);
}

/* ── Form elements ── */
.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

input[type="text"],
input[type="date"],
select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  color: var(--ink);
  transition: all 0.25s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lt);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
}

footer,
footer * {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.07em;
}

/* ── Article / Detail View ── */
article h2#detail-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-style: italic;
  margin-bottom: 12px;
  color: var(--ink);
}

article small#detail-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

article #detail-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--ink);
  margin-top: 32px;
}

article #detail-body p {
  margin-bottom: 1.2rem;
}

article #detail-body h3 {
  margin: 2rem 0 1rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
}

article #detail-body a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-lt);
}

article #detail-body a:hover {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  opacity: 1;
}

/* ── Stack tags ── */
.stack-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--rule-strong) !important;
  padding: 5px 12px !important;
  border-radius: 6px;
  color: var(--ink-muted);
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
}

.stack-tag:hover {
  border-color: var(--accent) !important;
  background: var(--accent-lt) !important;
  transform: translateY(-2px);
  color: var(--accent);
}

/* Remove inline top-padding to align gap with About Me Section */
#skills > div:nth-of-type(2) > div:nth-child(1),
#skills > div:nth-of-type(2) > div:nth-child(2) {
  padding-top: 0 !important;
}

#experience > div:nth-of-type(2) {
  padding-top: 0 !important;
}

/* ── Responsive ── */

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  body {
    padding: 0 24px;
  }
  .container {
    max-width: 100%;
  }
  h1 {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
  }
}

/* ── Mobile / Small Tablet (≤768px) ── */
@media (max-width: 768px) {
  body {
    padding: 0 18px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 0;
  }

  nav {
    gap: 14px;
    flex-wrap: wrap;
    border-radius: 14px;
  }

  h1 {
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .hero-section {
    padding: 24px 0 40px !important;
  }

  .hero-heading {
    font-size: clamp(2rem, 8vw, 2.8rem) !important;
  }

  .hero-tags {
    gap: 8px;
  }

  /* Stats row */
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    display: flex !important;
    flex-direction: column !important;
  }

  div[style*="grid-template-columns: repeat(3, 1fr)"]>div {
    border-right: none !important;
    border-bottom: 1px solid var(--rule);
    padding: 24px 0 !important;
  }

  div[style*="grid-template-columns: repeat(3, 1fr)"]>div:last-child {
    border-bottom: none;
  }

  /* Skills grid */
  div[style*="grid-template-columns: repeat(2, 1fr)"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  div[style*="grid-template-columns: repeat(2, 1fr)"]>div {
    border-right: none !important;
    padding: 20px 0 !important;
  }

  #skills > div:nth-of-type(2) > div:nth-child(2) {
    padding-top: 20px !important;
  }

  /* Experience grid */
  div[style*="grid-template-columns: 160px 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 24px 0 !important;
  }

  .about-grid {
    flex-direction: column;
    gap: 32px;
  }

  .about-image-card {
    order: -1;
    width: 100%;
    align-items: center;
  }

  .profile-pic {
    width: 160px;
    height: 160px;
  }

  .section {
    padding: 40px 0;
  }

  .social-links {
    flex-wrap: wrap;
    gap: 10px;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 24px 0;
  }

  #resume-modal>div {
    width: 96vw !important;
    height: 92vh !important;
  }

  article h2#detail-title {
    font-size: 1.8rem;
  }

  .btn {
    padding: 11px 22px;
    font-size: 0.8rem;
  }
}

/* ── Small phones (≤480px) ── */
@media (max-width: 480px) {
  body {
    padding: 0 16px;
  }

  header div h1 {
    font-size: 1.35rem;
  }

  nav {
    gap: 10px;
  }

  nav a {
    font-size: 0.78rem;
  }

  .section {
    padding: 32px 0;
  }

  .profile-pic {
    width: 130px;
    height: 130px;
  }

  .social-links a {
    padding: 8px 16px;
    font-size: 0.75rem;
  }

  footer {
    gap: 8px;
  }

  div[style*="grid-template-columns: repeat(3, 1fr)"] div[style*="font-size: 2.4rem"] {
    font-size: 2rem !important;
  }
}
