/* ============================================================
   Frederick Wimar — Portfolio
   Palette: Midnight / Navy Slate / Violet / Cyan / Coral
   ============================================================ */

:root {
    --midnight:   #0B1120;
    --navy-slate: #172554;
    --white:      #FFFFFF;
    --cool-gray:  #CBD5E1;
    --accent:     #7C3AED; /* Violet */
    --accent-2:   #06B6D4; /* Cyan   */
    --highlight:  #F97316; /* Coral  */

    --radius: 16px;
    --maxw: 1080px;
    --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---- Dark theme (default) ---- */
[data-theme="dark"] {
    --bg:      var(--midnight);
    --surface: var(--navy-slate);
    --text:    var(--white);
    --muted:   var(--cool-gray);
    --border:  rgba(203, 213, 225, .14);
    --card:    rgba(23, 37, 84, .55);
}

/* ---- Light theme ---- */
[data-theme="light"] {
    --bg:      #F4F7FB;
    --surface: #FFFFFF;
    --text:    #0B1120;
    --muted:   #475569;
    --border:  rgba(11, 17, 32, .10);
    --card:    #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background .4s var(--ease), color .4s var(--ease);
    overflow-x: hidden;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

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

/* ============================================================
   LOADER
   ============================================================ */
#loader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    background: var(--bg);
    transition: opacity .5s var(--ease), visibility .5s var(--ease);
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo { animation: float 2.2s ease-in-out infinite; }
.logo-shape { animation: dash 2s var(--ease) infinite alternate; transform-origin: center; }
.logo-text { fill: var(--text); font-weight: 800; font-size: 26px; font-family: inherit; }
.loader-label { color: var(--muted); letter-spacing: .35em; font-size: .72rem; text-transform: uppercase; }
.loader-label::after { content: "..."; animation: dots 1.4s steps(4, end) infinite; }

@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes dash { from { stroke-dasharray: 0 320; } to { stroke-dasharray: 320 0; } }
@keyframes dots { 0% { content: ""; } 33% { content: "."; } 66% { content: ".."; } 100% { content: "..."; } }

/* ============================================================
   NAV
   ============================================================ */
.nav {
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.05rem; letter-spacing: .02em;
}
.brand span {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); font-size: .95rem; position: relative; transition: color .25s; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
    content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
    background: var(--accent); transition: width .3s var(--ease);
}
.nav-links a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    background: var(--card); border: 1px solid var(--border); color: var(--text);
    border-radius: 10px; padding: 7px 12px; cursor: pointer; font-size: .9rem;
    transition: transform .2s, border-color .2s, background .3s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--accent); }

.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

/* Language menu */
.lang-switch { position: relative; }
.lang-menu {
    position: absolute; right: 0; top: 120%; list-style: none; min-width: 190px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: all .22s var(--ease); box-shadow: 0 18px 40px rgba(0,0,0,.28);
}
.lang-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: .9rem; }
.lang-menu a:hover { background: var(--accent); color: #fff; }

.nav-burger { display: none; }

/* ============================================================
   SECTIONS
   ============================================================ */
section { padding: 96px 0; }
.section-index { color: var(--accent-2); font-weight: 700; letter-spacing: .3em; font-size: .8rem; margin-bottom: 10px; }
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 12px; }
.section-sub { color: var(--muted); margin-bottom: 36px; max-width: 60ch; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* HERO */
.hero { padding-top: 120px; padding-bottom: 80px; }
.hero-title {
    font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.08; margin-bottom: 14px; font-weight: 800;
}
.hero-role {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 600; margin-bottom: 18px;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-tagline { color: var(--muted); max-width: 58ch; font-size: 1.1rem; margin-bottom: 34px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 12px;
    font-weight: 600; font-size: .95rem; cursor: pointer; border: 1px solid transparent;
    transition: transform .2s var(--ease), box-shadow .25s, background .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 10px 26px rgba(124,58,237,.35); }
.btn-accent:hover { box-shadow: 0 14px 32px rgba(124,58,237,.5); }
.btn-outline { border-color: var(--accent-2); color: var(--text); }
.btn-outline:hover { background: var(--accent-2); color: #03222a; }
.btn-ghost { border-color: var(--highlight); color: var(--highlight); }
.btn-ghost:hover { background: var(--highlight); color: #1a0c02; }

.loader-logo img { display: block; border-radius: 18px; object-fit: contain; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 34px 24px; text-align: center; transition: transform .3s var(--ease), border-color .3s;
}
.stat-card:hover { transform: translateY(-6px); border-color: var(--accent); }
.stat-num {
    display: block; font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 800; line-height: 1;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-num::after { content: "+"; color: var(--highlight); -webkit-text-fill-color: var(--highlight); }
.stat-label { color: var(--muted); font-size: .95rem; margin-top: 10px; display: block; }

/* ABOUT */
.about-bio { color: var(--muted); max-width: 70ch; font-size: 1.1rem; margin-bottom: 36px; }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.about-block {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
}
.about-block h3 { margin-bottom: 12px; color: var(--accent-2); font-size: 1.05rem; }
.about-block .muted-line { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.cert-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.cert-list li { color: var(--muted); font-size: .92rem; padding-left: 18px; position: relative; }
.cert-list li::before { content: "▹"; position: absolute; left: 0; color: var(--highlight); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border: 1px solid var(--border); color: var(--text);
    padding: 7px 14px; border-radius: 999px; font-size: .85rem;
}

/* PORTFOLIO */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.project-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0 0 22px; overflow: hidden; transition: transform .3s var(--ease), border-color .3s;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--accent-2); }
.project-thumb {
    height: 180px; overflow: hidden;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.project-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .5s var(--ease);
}
.project-card:hover .project-thumb img { transform: scale(1.06); }
.project-card h3 { padding: 18px 22px 6px; }
.project-card p { padding: 0 22px; color: var(--muted); font-size: .95rem; }

/* TIMELINE (work experience) */
.timeline { position: relative; margin-top: 12px; }
.timeline::before {
    content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px;
    background: linear-gradient(var(--accent), var(--accent-2));
}
.timeline-item { position: relative; padding: 0 0 34px 44px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: 3px; top: 4px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--bg); border: 3px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
.timeline-content {
    display: block; width: 100%; text-align: left; cursor: pointer; position: relative;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 48px 20px 24px; color: inherit; font: inherit;
    transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
/* Expand on hover (desktop) OR when toggled open (click / touch) — and lift with a shadow */
.timeline-content:hover,
.timeline-item.open .timeline-content {
    transform: translateX(4px); border-color: var(--accent-2);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.timeline-date {
    display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em;
    color: var(--highlight); margin-bottom: 8px;
}
.timeline-content h3 { font-size: 1.15rem; margin-bottom: 2px; }
.timeline-org { color: var(--accent-2); font-size: .92rem; font-weight: 600; margin-bottom: 8px; }
.timeline-summary { color: var(--muted); font-size: .95rem; }

/* Collapsible full detail */
.timeline-body {
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .45s var(--ease), opacity .35s var(--ease), margin .35s var(--ease);
}
.timeline-content:hover .timeline-body,
.timeline-item.open .timeline-body { max-height: 640px; opacity: 1; margin-top: 14px; }
.timeline-body ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.timeline-body li { color: var(--muted); font-size: .92rem; padding-left: 18px; position: relative; line-height: 1.55; }
.timeline-body li::before { content: "▹"; position: absolute; left: 0; color: var(--accent-2); }

/* +/- toggle indicator */
.timeline-toggle {
    position: absolute; top: 22px; right: 20px; width: 18px; height: 18px;
}
.timeline-toggle::before, .timeline-toggle::after {
    content: ""; position: absolute; background: var(--accent); border-radius: 2px;
    transition: transform .3s var(--ease), opacity .3s;
}
.timeline-toggle::before { top: 8px; left: 0; width: 18px; height: 2px; }
.timeline-toggle::after  { left: 8px; top: 0; width: 2px; height: 18px; }
.timeline-content:hover .timeline-toggle::after,
.timeline-item.open .timeline-toggle::after { transform: rotate(90deg); opacity: 0; }

/* ACCORDION (ongoing projects) */
.accordion { display: flex; flex-direction: column; gap: 14px; }
.accordion-item {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    transition: border-color .3s, box-shadow .3s;
}
.accordion-item.open { border-color: var(--accent); box-shadow: 0 16px 40px rgba(0, 0, 0, .3); }
.accordion-header {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
    padding: 18px 22px; font-weight: 700; font-size: 1.05rem; text-align: left;
}
.accordion-header:hover { color: var(--accent-2); }
.accordion-icon {
    flex: none; width: 28px; height: 28px; display: grid; place-items: center;
    border-radius: 8px; background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent); font-weight: 700; transition: transform .3s var(--ease);
}
.accordion-item.open .accordion-icon { transform: rotate(45deg); }
.accordion-panel {
    max-height: 0; overflow: hidden; transition: max-height .5s var(--ease);
}
.accordion-item.open .accordion-panel { max-height: 1400px; }
.accordion-panel-inner { padding: 0 22px 22px; }
.accordion-panel-inner img {
    width: 100%; border-radius: 12px; display: block; border: 1px solid var(--border);
}
.accordion-panel-inner p { color: var(--muted); margin-top: 14px; font-size: .95rem; white-space: pre-line; }
.ongoing-empty {
    background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
    padding: 28px; text-align: center; color: var(--muted);
}

/* CONTACT */
.contact-form { max-width: 640px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form input, .contact-form textarea {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 14px 16px; color: var(--text); font: inherit; width: 100%; resize: vertical;
    transition: border-color .25s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--muted); }
.form-success {
    background: color-mix(in srgb, var(--accent-2) 18%, transparent);
    border: 1px solid var(--accent-2); color: var(--text);
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
}
.form-error {
    background: color-mix(in srgb, var(--highlight) 18%, transparent);
    border: 1px solid var(--highlight); color: var(--text);
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
}

/* FOOTER */
.footer { border-top: 1px solid var(--border); padding: 36px 0; }
.footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { color: var(--muted); font-size: .9rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .stats-grid, .project-grid, .about-grid, .form-row { grid-template-columns: 1fr; }
    .nav-links {
        position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0;
        background: var(--surface); border-bottom: 1px solid var(--border);
        max-height: 0; overflow: hidden; transition: max-height .35s var(--ease);
    }
    .nav-links.open { max-height: 320px; }
    .nav-links a { padding: 16px 24px; border-bottom: 1px solid var(--border); }
    .nav-burger { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
}
