/* =================================================================
   CV PAGE — page-specific styles.
   Design-system primitives (tokens, frame, button, nav, sections,
   sidebar cards) live in /styles/cv3.css. This file only holds what
   is unique to the CV: hero, timeline fields, contact/skills, the
   compact CV project-row card, and edit-mode affordances.
   ================================================================= */

/* Edit-only affordances — hidden by default; revealed by
   services/cvEditor.js (localhost only) when body has .cv-edit-mode. */
.cv3-edit-only { display: none !important; }
body.cv-edit-mode .cv3-edit-only { display: revert !important; }

/* CV project cards are read-only on the CV (projects are edited from
   /projects/). Suppress all edit chrome inside them. */
.cv3-projects-list .cv3-edit-only,
body.cv-edit-mode .cv3-projects-list .cv3-edit-only { display: none !important; }

/* ===== LAYOUT-WIDE BUTTON SECTION ===== */
.cv3-section-button-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-3);
}
.cv3-section.cv3-section-button-only {
    display: block;
    border: none;
    grid-template-columns: none;
}
.cv3-section.cv3-section-button-only::before { display: none; }
.cv3-section.cv3-section-button-only > * { grid-column: auto; }
.cv3-section-button {
    display: block;
    width: 100%;
    padding: var(--sp-4) var(--sp-5);
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: var(--frame);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.cv3-section-button:hover {
    background: var(--btn-accent);
    color: var(--dark);
}
.cv3-section-button-edit {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    font-size: 0.7rem;
    color: var(--muted);
}

/* ===== HERO SECTION (01) ===== */
.cv3-hero {
    position: relative;
    overflow: hidden;
    grid-row: 1 / -1;
}
.cv3-hero-dot-grid {
    position: absolute;
    top: 0; left: 0;
    width: 90px; height: 90px;
    background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 10px 10px;
    opacity: 0.25;
    pointer-events: none;
}
.cv3-hero-inner {
    position: relative;
    z-index: 2;
    padding: var(--sp-6);
    max-width: 100%;
}
.cv3-hero-role {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: var(--sp-2);
}
.cv3-hero-name {
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.1;
    white-space: nowrap;
    margin-bottom: 0;
}
.cv3-hero-tagline {
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.75;
    max-width: 380px;
    margin-bottom: var(--sp-6);
}
.cv3-hero-links {
    display: flex;
    gap: var(--sp-6);
    flex-wrap: wrap;
}
.cv3-hero-link {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--sp-1);
    transition: opacity 0.2s;
}
.cv3-hero-link:hover,
.cv3-hero-link.is-hovered { opacity: 0.5; }

.cv3-hero-photo-wrap {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 42%;
    overflow: hidden;
}
.cv3-hero-photo-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
    filter: grayscale(100%);
    opacity: 0.6;
}
.cv3-hero-photo-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, var(--surface) 0%, transparent 55%);
}
.cv3-hero-photo-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--border) 6%, transparent);
    font-size: 0.62rem; letter-spacing: 2px; font-weight: 700;
    color: var(--muted);
}

/* ===== PER-FIELD DATE CELL (in the strip) ===== */
.cv3-strip-date {
    flex-direction: column;
    gap: 2px;
    padding: var(--sp-3) 2px;
}
.cv3-strip-date span {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--bg);
}
.cv3-strip-date-sep {
    width: 14px;
    height: 1px;
    background: color-mix(in srgb, var(--bg) 35%, transparent);
}

/* Wrapper that lets its children participate in the parent grid */
.cv3-fields { display: contents; }
.cv3-fields > * { grid-column: 2; }

/* ===== TIMELINE FIELDS ===== */
.cv3-field {
    padding: var(--sp-6);
    position: relative;
    margin-bottom: var(--sp-7);
}
.cv3-field:last-child { margin-bottom: 0; }

/* ===== FIELDS SECTION — per-company brackets =====
   Drop the section box's continuous right + bottom borders; instead the header
   and each company draw their own top/right/bottom (open on the left toward the
   strip). The right line then splits at each gap, giving one "]" per company,
   while the dark strip stays as the continuous left edge. */
.cv3-fields-section { border-right: none; border-bottom: none; }
.cv3-fields-section .cv3-section-header { border-right: var(--frame); }
.cv3-fields-section .cv3-field {
    border-top: var(--frame);
    border-right: var(--frame);
    border-bottom: var(--frame);
}
/* First company connects straight to the header (no gap, no doubled line). */
.cv3-fields-section .cv3-field:first-child { border-top: none; }
.cv3-field-date {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-6);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}
.cv3-field-content {
    flex: 1; min-width: 0;
    padding: var(--sp-6) var(--sp-6);
}
.cv3-field-logo {
    max-width: 130px;
    margin-bottom: var(--sp-3);
}
.cv3-field-logo img,
.cv3-field-logo-text,
.cv3-field-logo-placeholder {
    width: 100%; height: auto;
}
.cv3-field-logo-light { display: block; }
body.dark-mode .cv3-field-logo-light { display: none; }
.cv3-field-logo-dark { display: none; }
body.dark-mode .cv3-field-logo-dark { display: block; }
.cv3-field-logo-text {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--muted);
}
.cv3-field-title {
    font-size: 1rem; font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-1);
}
.cv3-field-title-role { opacity: 0.5; font-weight: 600; }
.cv3-field-org {
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-3);
}
.cv3-field-desc {
    font-size: 0.85rem;
    line-height: 1.75;
    color: var(--text);
    margin-top: var(--sp-4);
}

/* ===== PROJECT ROW CARD (compact, CV-only variant) ===== */
.cv3-project {
    display: flex;
    margin-top: var(--sp-4);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.cv3-project:hover,
.cv3-project.is-hovered { background: var(--dark); color: var(--bg); }
.cv3-project:hover .cv3-project-name,
.cv3-project.is-hovered .cv3-project-name,
.cv3-project:hover .cv3-project-date,
.cv3-project.is-hovered .cv3-project-date,
.cv3-project:hover .cv3-project-desc,
.cv3-project.is-hovered .cv3-project-desc { color: var(--bg); }
.cv3-project:hover .cv3-project-thumb,
.cv3-project.is-hovered .cv3-project-thumb {
    background: transparent;
    border-right-color: var(--bg);
}
.cv3-project:hover .cv3-project-thumb-ph,
.cv3-project.is-hovered .cv3-project-thumb-ph { color: var(--bg); }
.cv3-project-thumb {
    width: 220px; height: 140px; flex-shrink: 0;
    border-right: var(--frame);
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
    background: color-mix(in srgb, var(--border) 5%, transparent);
}
.cv3-project-thumb img,
.cv3-project-thumb video {
    width: 100%; height: 100%; object-fit: cover;
    position: absolute;
    inset: 0;
    display: block;
}
.cv3-project-thumb video {
    opacity: 0;
    pointer-events: none;
    background: #000;
    transition: opacity 0.2s ease;
}
.cv3-project-thumb-ph {
    font-size: 0.58rem; letter-spacing: 2px;
    font-weight: 700; color: var(--muted);
}
.cv3-project.has-hover-video:hover .cv3-project-thumb img,
.cv3-project.has-hover-video.is-hovered .cv3-project-thumb img { opacity: 0; }
.cv3-project.has-hover-video:hover .cv3-project-thumb video,
.cv3-project.has-hover-video.is-hovered .cv3-project-thumb video { opacity: 1; }
.cv3-project-info { flex: 1; padding: var(--sp-3) var(--sp-4); }
.cv3-project-name {
    font-size: 0.84rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    margin-bottom: var(--sp-1);
}
.cv3-project-date {
    font-size: 0.66rem; font-weight: 700;
    letter-spacing: 1.5px; color: var(--muted);
    margin-bottom: var(--sp-2); display: block;
}
.cv3-project-desc {
    font-size: 0.78rem; line-height: 1.6;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cv3-project-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.cv3-project-tag {
    font-size: 0.5rem; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    padding: 1px 5px;
    border: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
}
.cv3-project:hover .cv3-project-tag,
.cv3-project.is-hovered .cv3-project-tag {
    border-color: var(--bg);
    color: var(--bg);
}

/* ===== SIDEBAR PHOTO ===== */
.cv3-sidebar-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: var(--frame);
    flex-shrink: 0;
}
.cv3-sidebar-photo img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: 65% top;
}
.cv3-sidebar-photo-ph {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--border) 7%, transparent);
    font-size: 0.62rem; letter-spacing: 2px;
    font-weight: 700; color: var(--muted);
}

/* ===== ABOUT TEXT ===== */
.cv3-about-text {
    font-size: 0.82rem;
    line-height: 2;
    color: var(--text);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cv3-read-more {
    font-size: 0.66rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: var(--sp-2);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--sp-1);
    transition: opacity 0.2s;
}
.cv3-read-more:hover,
.cv3-read-more.is-hovered { opacity: 0.5; }

/* ===== CONTACT & INFO LIST ===== */
.cv3-info-list { list-style: none; }
.cv3-info-item {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: 18px 24px;
    margin: 0 -24px;
    border-bottom: var(--frame);
}
.cv3-info-item:first-child { padding-top: 0; }
.cv3-info-item:last-child { border-bottom: none; padding-bottom: 0; }
.cv3-info-icon {
    width: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.cv3-info-text { flex: 1; }
.cv3-info-label {
    font-size: 0.58rem; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--muted);
    display: block; margin-bottom: 3px;
}
.cv3-info-value {
    font-size: 0.88rem; color: var(--text); font-weight: 500;
}
.cv3-info-value a {
    border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
    transition: border-color 0.15s;
}
.cv3-info-value a:hover { border-color: var(--border); }

/* ===== SKILLS ===== */
.cv3-skills {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cv3-skill-tag {
    font-size: 0.62rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    padding: 8px 14px;
    border: var(--frame);
    transition: background 0.15s, color 0.15s;
}
.cv3-skill-tag:hover,
.cv3-skill-tag.is-hovered { background: var(--dark); color: var(--bg); }

/* ===== EDIT-MODE WIDGETS ===== */
.cv3-project-link-edit {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: var(--sp-3);
    font-size: 0.7rem; color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
}
.cv3-project-link-edit > span > span[data-edit-path] { color: var(--text); }
.cv3-edit-bool {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border);
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}
.cv3-edit-bool.is-on  { background: var(--accent-color, var(--dark)); color: var(--dark); }
.cv3-edit-bool.is-off { background: var(--surface); color: var(--muted); }
.cv3-project-link-btn {
    position: absolute;
    right: var(--sp-3);
    bottom: var(--sp-3);
    padding: 6px 12px;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: var(--frame);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    z-index: 2;
}
.cv3-project-link-btn:hover,
.cv3-project-link-btn.is-hovered {
    background: var(--btn-accent);
    color: var(--dark);
}

/* ===== CV-SPECIFIC RESPONSIVE ===== */
@media (max-width: 820px) {
    .cv3-main { gap: var(--sp-4); }
    .cv3-hero-inner { max-width: 100%; }
    .cv3-hero-photo-wrap { display: none; }
}
@media (max-width: 560px) {
    .cv3-field-date-col { width: 90px; }
    .cv3-hero-name { font-size: 2rem; }
}
