/*!
 * theme-modern.css
 * Warm, cool-toned theme layer for chiehc.com.
 * Loaded AFTER css/styles.css so it overrides the base Bootstrap theme.
 * Remove the <link> tag in index.html to revert to the original look.
 *
 * Overriding the base theme
 * -------------------------
 * styles.css is the Start Bootstrap "iPortfolio" resume template. Its rules
 * live around line 11331 and look like this:
 *
 *     .resume .resume-item        { border-left: 2px solid #0563bb; }
 *     .resume .resume-item h4     { font-size: 18px; text-transform: uppercase;
 *                                   color: #0563bb; }
 *     .resume .resume-item::before{ width: 16px; height: 16px; border-radius: 50px;
 *                                   left: -9px; border: 2px solid #0563bb; }
 *
 * That last one is a timeline dot, and it is the reason a blue circle kept
 * appearing on the cards: the rule here used to target .resume-item::before
 * with no !important, so at two-class specificity the template won.
 *
 * Every override below is therefore written twice - once bare, once scoped to
 * .resume - so it wins on specificity alone, with !important as a backstop for
 * the properties that genuinely conflict. Nothing in styles.css uses
 * !important, so this is sufficient.
 */

:root {
    --c-bg:          #f7f8fb;
    --c-surface:     #ffffff;
    --c-surface-alt: #eef2f8;
    --c-text:        #1b2532;
    --c-text-soft:   #55677c;
    --c-text-muted:  #7b8b9e;
    --c-border:      #e0e7f0;
    --c-accent:      #3874ef;
    --c-accent-2:    #16b8ca;
    --c-accent-soft: #eaf1fe;
    --c-warm:        #f2994a;
    --c-warm-soft:   #fdf1e5;
    --c-gradient:    linear-gradient(120deg, #3874ef 0%, #16b8ca 100%);
    --c-radius:      16px;
    --c-shadow:      0 1px 2px rgba(27, 37, 50, .04), 0 10px 28px rgba(27, 37, 50, .06);
    --c-nav-h:       58px;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 "Hiragino Sans", "Noto Sans JP", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Sticky navigation ---------- */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--c-nav-h);
    background: rgba(247, 248, 251, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--c-border);
}

.site-nav .nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.site-nav .nav-brand {
    font-weight: 600;
    font-size: .95rem;
    color: var(--c-text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.site-nav .nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .25rem;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav .nav-links::-webkit-scrollbar { display: none; }

.site-nav .nav-links a {
    display: block;
    padding: .4rem .75rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--c-text-soft);
    text-decoration: none;
    border-radius: 999px;
    white-space: nowrap;
    transition: color .18s ease, background-color .18s ease;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a:focus-visible {
    color: var(--c-accent);
    background: var(--c-accent-soft);
}

@media (max-width: 767px) {
    .site-nav .nav-brand { display: none; }
    .site-nav .nav-inner { gap: 0; padding: 0 .75rem; }
}

/* ---------- Hero ---------- */

header.bg-image-full {
    position: relative;
    background-size: cover;
    background-position: center;
    isolation: isolate;
}

header.bg-image-full::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(160deg, rgba(27, 37, 50, .76) 0%, rgba(24, 62, 112, .70) 55%, rgba(14, 98, 118, .64) 100%);
}

header.bg-image-full #myheader img {
    border: 4px solid rgba(255, 255, 255, .9);
    box-shadow: 0 10px 30px rgba(11, 30, 55, .35);
}

header.bg-image-full h1 {
    letter-spacing: -0.02em;
    font-size: clamp(1.7rem, 4vw, 2.4rem) !important;
}

header.bg-image-full > div > p {
    color: rgba(255, 255, 255, .84) !important;
    font-size: .95rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0 4px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .28);
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform .2s ease, background-color .2s ease;
}

.social-links a:hover {
    background: rgba(255, 255, 255, .26);
    transform: translateY(-3px);
    color: #fff;
}

/* ---------- Sections ---------- */

section {
    padding: 4.5rem 0;
    scroll-margin-top: var(--c-nav-h);
}

section.bg-light {
    background-color: var(--c-surface-alt) !important;
}

.section-title {
    margin-bottom: 2rem !important;
    padding-bottom: 0 !important;
}

.section-title h2 {
    position: relative;
    display: inline-block;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    color: var(--c-text);
    padding-bottom: .6rem;
    margin-bottom: .75rem;
}

/* The template centres section headings with a 120px rule and a 40px bar,
   both absolutely positioned from 50%. Neutralise the wide rule and re-anchor
   the bar to the left so it sits under the left-aligned heading. */
.section-title h2::before {
    display: none !important;
}

.section-title h2::after {
    content: "";
    position: absolute;
    left: 0 !important;
    bottom: 0;
    width: 56px !important;
    height: 4px !important;
    border-radius: 4px;
    background: var(--c-gradient) !important;
}

.section-title p,
section p.lead {
    color: var(--c-text-soft);
    font-size: 1.02rem;
    line-height: 1.8;
    font-weight: 400;
}

.section-title p { margin-bottom: 0 !important; }

#about h2.fst-italic {
    font-style: normal !important;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    position: relative;
    display: inline-block;
    padding-bottom: .6rem;
}

#about h2.fst-italic::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 4px;
    border-radius: 4px;
    background: var(--c-gradient);
}

section a {
    color: var(--c-accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(56, 116, 239, .3);
    transition: border-color .18s ease;
}

section a:hover {
    color: var(--c-accent);
    border-bottom-color: var(--c-accent);
}

/* ---------- Cards ---------- */

.resume-title,
.resume .resume-title {
    font-size: .78rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--c-accent) !important;
    margin: 1.6rem 0 .75rem !important;
}

.resume-title:first-child,
.resume .resume-title:first-child { margin-top: 0 !important; }

.resume-item,
.resume .resume-item {
    position: relative;
    background: var(--c-surface) !important;
    border: 1px solid var(--c-border) !important;
    border-left: 1px solid var(--c-border) !important;
    border-radius: var(--c-radius) !important;
    box-shadow: var(--c-shadow);
    padding: 1.15rem 1.3rem !important;
    margin: 0 0 1rem !important;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

/* Replaces the template's 16px timeline dot with a full-height accent bar
   that fades in on hover. Every geometry property the dot set is reset. */
.resume-item::before,
.resume .resume-item::before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 4px !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--c-gradient) !important;
    opacity: 0;
    transition: opacity .22s ease;
}

.resume-item:hover,
.resume .resume-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 2px 4px rgba(27, 37, 50, .05), 0 16px 34px rgba(27, 37, 50, .09);
}

.resume-item:hover::before,
.resume .resume-item:hover::before { opacity: 1; }

.resume-item:last-child,
.resume .resume-item:last-child { padding-bottom: 1.15rem !important; }

.resume-item h4,
.resume .resume-item h4 {
    font-family: inherit !important;
    font-size: 1.02rem !important;
    font-weight: 600 !important;
    color: var(--c-text) !important;
    text-transform: none !important;
    letter-spacing: -0.01em !important;
    line-height: 1.35 !important;
    margin: 0 0 .4rem !important;
}

.resume-item h5,
.resume .resume-item h5 {
    display: inline-block;
    font-size: .75rem !important;
    font-weight: 500 !important;
    color: var(--c-accent) !important;
    background: var(--c-accent-soft) !important;
    padding: .18rem .6rem !important;
    border-radius: 999px;
    margin: 0 0 .55rem !important;
}

.resume-item p,
.resume .resume-item p {
    margin: 0 0 .6rem !important;
    line-height: 1.65;
}

.resume-item p:last-child,
.resume .resume-item p:last-child { margin-bottom: 0 !important; }

.resume-item p em,
.resume .resume-item p em {
    font-style: normal;
    color: var(--c-text-muted);
    font-size: .875rem;
}

.resume-item ul,
.resume .resume-item ul {
    padding-left: 1.1rem !important;
    margin: 0 !important;
    list-style: disc;
}

.resume-item ul li,
.resume .resume-item ul li {
    color: var(--c-text-soft);
    font-size: .93rem;
    line-height: 1.65;
    padding: 0 !important;
    margin: 0 0 .4rem !important;
}

.resume-item ul li::marker,
.resume .resume-item ul li::marker { color: var(--c-warm); }

.resume-item ul li:last-child,
.resume .resume-item ul li:last-child { margin-bottom: 0 !important; }

[lang="ja"] .resume-item p,
[lang="zh-Hant"] .resume-item p {
    font-size: .93rem;
    line-height: 2;
    color: var(--c-text-soft);
}

/* ---------- Side photo ----------
   Constrained and un-rotated. The template sets `section { overflow: hidden }`,
   so a rotated element that overhangs its column gets clipped rather than
   flowing, which is what made this overlap the text beside it. */

.side-photo {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: 0 auto;
    border-radius: var(--c-radius);
    border: 1px solid var(--c-border);
    box-shadow: var(--c-shadow);
    transition: transform .3s ease;
}

.side-photo:hover { transform: translateY(-3px); }

.photo-note {
    display: block;
    width: fit-content;
    margin: .85rem auto 0;
    padding: .3rem .75rem;
    font-size: .8rem;
    color: #9a5a17;
    background: var(--c-warm-soft);
    border-radius: 999px;
}

/* ---------- Photo gallery ---------- */

#gallery .photo-grid figure {
    border-radius: var(--c-radius) !important;
    border: 1px solid var(--c-border);
    box-shadow: var(--c-shadow);
    background: var(--c-surface) !important;
    transition: transform .22s ease, box-shadow .22s ease;
}

#gallery .photo-grid figure:hover {
    transform: translateY(-4px);
    box-shadow: 0 2px 4px rgba(27, 37, 50, .05), 0 18px 36px rgba(27, 37, 50, .11);
}

#gallery .photo-grid figcaption {
    color: var(--c-text-muted) !important;
    padding: .55rem .8rem .75rem !important;
    font-weight: 500;
}

/* ---------- Footer ---------- */

footer.bg-dark {
    background: linear-gradient(120deg, #1b2532 0%, #1e3654 60%, #164b5e 100%) !important;
    border-top: 1px solid var(--c-border);
}

footer.bg-dark p {
    color: rgba(255, 255, 255, .7) !important;
    font-size: .875rem;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .resume-item,
    .resume .resume-item,
    .resume-item::before,
    .resume .resume-item::before,
    .side-photo,
    #gallery .photo-grid figure,
    #gallery .photo-grid img,
    .social-links a {
        transition: none;
    }
    .resume-item:hover,
    .resume .resume-item:hover,
    .side-photo:hover,
    #gallery .photo-grid figure:hover,
    .social-links a:hover {
        transform: none;
    }
}
