/* ==========================================================================
   Charles Wang Portfolio – Editorial Red & Black (V5)
   Bebas Neue (display) · DM Serif Display (headings) · DM Sans (body)
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg:        #070707;
  --surface:   #0d0d0d;
  --surface2:  #141414;
  --surface3:  #1c1c1c;
  --border:    rgba(255,255,255,.07);
  --border2:   rgba(255,255,255,.12);

  --text:      #f2f0ee;
  --muted:     #9a9da6;
  --faint:     rgba(255,255,255,.28);

  --red:       #e53e3e;
  --red-dark:  #c53030;
  --red-bright:#fc5252;
  --red-dim:   rgba(229,62,62,.13);
  --red-glow:  rgba(229,62,62,.20);

  --font-display: "Bebas Neue", sans-serif;
  --font-heading: "DM Serif Display", serif;
  --font-body:    "DM Sans", sans-serif;

  --r-xs: .25rem;
  --r-sm: .45rem;
  --r-md: .75rem;
  --r-lg: 1rem;
  --r-xl: 1.25rem;

  --shadow-sm: 0 4px 14px rgba(0,0,0,.40);
  --shadow-md: 0 12px 32px rgba(0,0,0,.52);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.64);

  --ease: cubic-bezier(.22,.61,.36,1);
  --t: 180ms;
}

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

html { scroll-behavior: smooth; height: 100%; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

a { color: inherit; text-decoration: none; }
::selection { background: rgba(229,62,62,.38); }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.text-muted { color: var(--muted) !important; }

/* ---------- Sections ---------- */
.v5-section { padding: 100px 0; }

.v5-section-alt {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.v5-label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: .75rem;
}

.v5-label::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
}

.v5-section-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: var(--text);
  margin: 0;
}

.v5-body-text {
  font-size: .95rem;
  line-height: 1.85;
  color: var(--muted);
}

/* ---------- Nav ---------- */
.v5-nav {
  background: rgba(7,7,7,.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.v5-brand {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: .08em;
  color: var(--text) !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.v5-brand-slash {
  color: var(--red);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 400;
}

.v5-nav-link {
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted) !important;
  padding: .4rem .7rem !important;
  border-radius: var(--r-sm);
  transition: color var(--t) var(--ease);
}

.v5-nav-link:hover { color: var(--text) !important; }

.v5-nav-link.active {
  color: var(--red) !important;
}

/* ---------- Buttons ---------- */
.v5-btn-red {
  background: var(--red);
  border: 1px solid var(--red);
  color: #fff !important;
  font-weight: 600;
  font-size: .875rem;
  border-radius: var(--r-sm);
  transition: background var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  letter-spacing: .01em;
}

.v5-btn-red:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229,62,62,.36);
  color: #fff !important;
}

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

.v5-btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text) !important;
  font-weight: 600;
  font-size: .875rem;
  border-radius: var(--r-sm);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease);
  letter-spacing: .01em;
}

.v5-btn-outline:hover {
  border-color: rgba(229,62,62,.50);
  background: var(--red-dim);
  transform: translateY(-1px);
  color: var(--text) !important;
}

/* ---------- Social icons ---------- */
.v5-social {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 1rem;
  text-decoration: none;
  transition: border-color var(--t) var(--ease), color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease);
}

.v5-social:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-dim);
  transform: translateY(-2px);
}

/* ---------- Hero ---------- */
.v5-hero {
  min-height: 100vh;
  padding-top: 106px;
  padding-bottom: 80px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.v5-hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50vw 55vh at 80% 30%, rgba(229,62,62,.09) 0%, transparent 60%),
    radial-gradient(30vw 30vh at 10% 70%, rgba(229,62,62,.05) 0%, transparent 55%);
  pointer-events: none;
}

/* Hero eyebrow */
.v5-eyebrow {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
  display: block;
}

/* Giant display name */
.v5-hero-name {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 14vw, 10.5rem);
  line-height: .88;
  letter-spacing: .03em;
  margin: 0 0 .35rem 0;
  display: block;
}

.v5-name-white { color: var(--text); display: block; }
.v5-name-red   { color: var(--red);  display: block; }

/* Red rule under name */
.v5-hero-rule {
  width: 56px;
  height: 3px;
  background: var(--red);
  border: none;
  margin: 1.1rem 0 1.2rem;
  border-radius: 2px;
}

.v5-hero-role {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.v5-hero-bio {
  font-size: .95rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 50ch;
  margin-bottom: 0;
}

/* "Ready to Work" indicator */
.v5-ready {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  margin: .6rem 0 1rem;
}

.v5-ready-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: v5-pulse 2.4s ease-in-out infinite;
}

@keyframes v5-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.55); }
  65%  { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0);    }
  100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0);    }
}

.v5-ready-text {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 1.4rem;
  color: rgba(242, 240, 238, 0.78);
  letter-spacing: -.01em;
  line-height: 1;
}

.v5-contact-row {
  font-size: .83rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
}

.v5-contact-row a {
  color: var(--muted);
  transition: color var(--t) var(--ease);
}

.v5-contact-row a:hover { color: var(--text); }

/* Hero photo */
.v5-photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* 4-corner bracket frame */
.v5-photo-corners {
  position: relative;
  display: inline-block;
  padding: 12px;
}

/* Top-left corner */
.v5-photo-corners::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border-top: 2px solid var(--red);
  border-left: 2px solid var(--red);
}

/* Bottom-right corner */
.v5-photo-corners::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-bottom: 2px solid var(--red);
  border-right: 2px solid var(--red);
}

/* Top-right + bottom-left via inner wrapper */
.v5-photo-inner {
  position: relative;
  display: block;
}

.v5-photo-inner::before {
  content: "";
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border-top: 2px solid var(--red);
  border-right: 2px solid var(--red);
}

.v5-photo-inner::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: -12px;
  width: 32px;
  height: 32px;
  border-bottom: 2px solid var(--red);
  border-left: 2px solid var(--red);
}

.v5-photo {
  width: 270px;
  height: 320px;
  object-fit: cover;
  display: block;
  filter: grayscale(18%);
  transition: filter var(--t) var(--ease);
}

.v5-photo-corners:hover .v5-photo {
  filter: grayscale(0%);
}

.v5-photo-badge {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-left: 2px solid var(--red);
  border-radius: var(--r-sm);
  font-size: .78rem;
  color: var(--muted);
  padding: .5rem .9rem;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 300px;
}

.v5-stats-row {
  display: flex;
  gap: .6rem;
  margin-top: .75rem;
  width: 100%;
  max-width: 300px;
  justify-content: center;
}

.v5-stat {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  border-radius: var(--r-sm);
  padding: .65rem .5rem;
  text-align: center;
}

.v5-stat-val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: .04em;
  color: var(--text);
  line-height: 1;
  display: block;
}

.v5-stat-label {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: block;
  margin-top: .2rem;
}

/* ---------- About ---------- */
.v5-about-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--border2);
}

.v5-about-img {
  width: 100%;
  display: block;
  object-fit: cover;
  transition: transform 380ms var(--ease), filter 380ms var(--ease);
  filter: grayscale(15%);
}

.v5-about-img-wrap:hover .v5-about-img {
  transform: scale(1.03);
  filter: grayscale(0%);
}

.v5-about-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 4px solid var(--red);
  pointer-events: none;
  border-radius: var(--r-md);
}

.v5-highlight {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: 1rem;
  background: var(--surface2);
  border-radius: var(--r-md);
  border-left: 3px solid var(--red);
}

.v5-highlight-icon {
  font-size: 1.2rem;
  color: var(--red);
  flex-shrink: 0;
  margin-top: .1rem;
}

.v5-highlight-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  margin-bottom: .15rem;
}

.v5-highlight-sub {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Skills (row layout) ---------- */
.v5-skills-table { width: 100%; }

.v5-skill-row {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.v5-skill-row:first-child { border-top: 1px solid var(--border); }

.v5-skill-cat {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: .06em;
  color: var(--text);
  min-width: 170px;
  padding-top: .1rem;
  flex-shrink: 0;
}

.v5-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/* ---------- Tags ---------- */
.v5-tag {
  display: inline-block;
  font-size: .73rem;
  font-weight: 500;
  padding: .25rem .65rem;
  border-radius: var(--r-xs);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--muted);
  letter-spacing: .01em;
  transition: border-color var(--t) var(--ease), color var(--t) var(--ease);
}

.v5-tag:hover {
  border-color: rgba(229,62,62,.45);
  color: var(--text);
}

/* ---------- Projects ---------- */

/* Featured project — horizontal card */
.v5-project-featured {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.v5-project-featured:hover {
  border-color: rgba(229,62,62,.35);
  box-shadow: 0 16px 40px rgba(229,62,62,.08);
}

.v5-featured-img-wrap {
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 260px;
}

.v5-featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 380ms var(--ease), filter 380ms var(--ease);
  filter: grayscale(10%);
}

.v5-project-featured:hover .v5-featured-img {
  transform: scale(1.04);
  filter: grayscale(0%);
}

.v5-featured-body {
  padding: 2rem 2rem 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
}

.v5-featured-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: .75rem;
}

.v5-featured-label::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--red);
  display: inline-block;
}

.v5-featured-title {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: .04em;
  color: var(--text);
  margin: 0 0 .75rem;
  line-height: 1.1;
}

.v5-featured-desc {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1.25rem;
  flex: 1;
}

/* Standard project card */
.v5-project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.v5-project-card:hover {
  border-color: rgba(229,62,62,.35);
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(229,62,62,.08);
}

.v5-project-img-wrap {
  position: relative;
  overflow: hidden;
}

.v5-project-img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  filter: grayscale(12%);
  transition: transform 340ms var(--ease), filter 340ms var(--ease);
}

.v5-project-card:hover .v5-project-img {
  transform: scale(1.05);
  filter: grayscale(0%);
}

.v5-project-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7,7,7,.68);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}

.v5-project-card:hover .v5-project-overlay,
.v5-project-featured:hover .v5-featured-overlay { opacity: 1; }

.v5-overlay-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.20);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: .4rem .9rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}

.v5-overlay-btn:hover {
  background: rgba(229,62,62,.45);
  border-color: rgba(229,62,62,.60);
  color: #fff;
}

.v5-project-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  border-top: 2px solid transparent;
  transition: border-color var(--t) var(--ease);
}

.v5-project-card:hover .v5-project-body {
  border-top-color: var(--red);
}

.v5-project-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: .04em;
  color: var(--text);
  margin: 0;
  line-height: 1.1;
}

.v5-project-desc {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

/* ---------- Timeline ---------- */
.v5-tl-col-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.75rem;
}

.v5-tl-col-title::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--red);
  display: inline-block;
}

.v5-timeline { position: relative; }

.v5-tl-item {
  display: flex;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  position: relative;
}

.v5-tl-item:last-child { padding-bottom: 0; }

.v5-tl-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.v5-tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--red);
  flex-shrink: 0;
  margin-top: .25rem;
}

.v5-tl-line {
  width: 1px;
  flex: 1;
  background: var(--border2);
  margin-top: 6px;
}

.v5-tl-item:last-child .v5-tl-line { display: none; }

.v5-tl-title {
  font-weight: 600;
  font-size: .925rem;
  color: var(--text);
  margin-bottom: .2rem;
}

.v5-tl-org {
  font-size: .85rem;
  color: var(--red);
  margin-bottom: .15rem;
}

.v5-tl-meta {
  font-size: .78rem;
  color: var(--muted);
}

/* ---------- Contact ---------- */
.v5-contact-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  border-radius: var(--r-lg);
  padding: 2.25rem 1.75rem;
  height: 100%;
}

.v5-contact-panel-title {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: .04em;
  line-height: .95;
  color: var(--text);
  margin: 1rem 0 1.5rem;
}

.v5-contact-panel-title span {
  color: var(--red);
  display: block;
}

.v5-contact-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: none;
  transition: color var(--t) var(--ease);
  padding: .4rem 0;
}

.v5-contact-item:hover { color: var(--text); }

.v5-contact-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--red-dim);
  border: 1px solid rgba(229,62,62,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: var(--red);
  flex-shrink: 0;
}

.v5-form-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 2rem 2.25rem;
}

.v5-label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .4rem;
  letter-spacing: .02em;
}

.v5-input {
  display: block;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: .7rem 1rem;
  font-size: .9rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  resize: vertical;
}

.v5-input::placeholder { color: var(--faint); }

.v5-input:focus {
  border-color: rgba(229,62,62,.55);
  box-shadow: 0 0 0 3px rgba(229,62,62,.14);
  background: var(--surface3);
}

.v5-form-status {
  font-size: .8rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.v5-footer {
  color: var(--muted);
  font-size: .85rem;
  border-color: var(--border) !important;
}

.v5-footer-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.25);
  margin-top: .3rem;
}

/* ---------- Divider ---------- */
.v5-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  border: none;
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .v5-section { padding: 72px 0; }
  .v5-hero-name { font-size: clamp(4.5rem, 16vw, 7rem); }
  .v5-photo { width: 220px; height: 260px; }
  .v5-section-title { font-size: 2rem; }
  .v5-featured-body { padding: 1.5rem; }
  .v5-skill-cat { min-width: 130px; }
}

@media (max-width: 767.98px) {
  .v5-section { padding: 56px 0; }
  .v5-hero-name { font-size: clamp(4rem, 20vw, 6rem); }
  .v5-photo { width: 190px; height: 225px; }
  .v5-skill-row { flex-direction: column; gap: .65rem; }
  .v5-skill-cat { min-width: unset; }
  .v5-featured-img-wrap { min-height: 200px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
