/*
 * Modern Minimal Theme - Swiss Precision × Japanese Minimalism
 * Inspired by cv.html design
 */

/* ============================
   CSS VARIABLES
   ============================ */
:root {
    --primary: #1a1a1a;
    --secondary: #4a4a4a;
    --accent: #1580eb;
    --light: #f5f5f5;
    --white: #ffffff;
    --grid: #e0e0e0;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
}

[data-theme="dark"] {
    --primary: #e8e8e8;
    --secondary: #a0a0a0;
    --accent: #ff6b6b;
    --light: #2a2a2a;
    --white: #1a1a1a;
    --grid: #333333;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
}

/* ============================
   RESET & BASE
   ============================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
    line-height: 1.7;
    color: var(--primary);
    background: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================
   TYPOGRAPHY
   ============================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h2 {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

h4 {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

p {
    color: var(--secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent);
}

/* ============================
   LAYOUT
   ============================ */
#wrapper {
    display: grid;
    grid-template-columns: 1fr 280px;
    min-height: 100vh;
}

#main {
    background: var(--bg-primary);
}

.inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5vw;
}

/* ============================
   HEADER
   ============================ */
#header {
    padding: 8vh 0 6vh;
    border-bottom: 1px solid var(--grid);
    position: relative;
}

#header .inner {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: start;
}

#header .logo {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--primary);
}

#header .logo strong {
    font-weight: 300;
    color: var(--primary);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary);
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Header icons/links */
/* Header icons on one line */
#header .icons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;           /* keep on one line */
}

#header .icons > li {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;         /* prevent label wraps */
}

#header .icons li {
    font-size: 0.95rem;
    color: var(--secondary);
}

#header .icons li a,
#header .icons li .header-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
    border: none;
}

#header .icons li a:hover,
#header .icons li .header-link:hover {
    color: var(--accent);
}

/* Font Awesome Icons in Header */
#header .icons li a.icon {
    font-size: 1.25rem;
}

/* Theme Toggle */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle-label {
    font-size: 0.85rem;
    color: var(--secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    user-select: none;
}

.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--light);
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: 2px solid var(--grid);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    border-color: var(--accent);
}

[data-theme="dark"] .theme-toggle {
    background: var(--light);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(30px);
}

.theme-toggle-slider::before {
    content: '☀';
    filter: grayscale(0);
}

[data-theme="dark"] .theme-toggle-slider::before {
    content: '☾';
}

.theme-toggle::before,
.theme-toggle::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.theme-toggle::before {
    content: '☀';
    left: 8px;
    opacity: 0.5;
}

.theme-toggle::after {
    content: '☾';
    right: 8px;
    opacity: 0.3;
}

[data-theme="dark"] .theme-toggle::before {
    opacity: 0.3;
}

[data-theme="dark"] .theme-toggle::after {
    opacity: 0.5;
}

/* ============================
   SIDEBAR
   ============================ */
#sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--grid);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: background 0.3s ease;
}

#sidebar .inner {
    padding: 8vh 2rem;
}

#menu h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

#menu ul {
    list-style: none;
}

#menu ul li {
    margin-bottom: 0.75rem;
}

#menu ul li a {
    display: block;
    padding: 0.5rem 0;
    color: var(--secondary);
    font-weight: 400;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    border: none;
}

#menu ul li a:hover {
    color: var(--accent);
}

#sidebar section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--grid);
}

#sidebar section h2 {
    color: var(--primary);
}

#sidebar section p {
    color: var(--secondary);
    font-size: 0.875rem;
}

#sidebar .contact {
    list-style: none;
}

#sidebar .contact li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--secondary);
    font-size: 0.875rem;
}

#sidebar .contact li.icon::before {
    color: var(--accent);
    font-size: 1rem;
}

#sidebar .contact li a {
    color: var(--primary);
    border: none;
}

#sidebar .contact li a:hover {
    color: var(--accent);
}

/* ============================
   BANNER
   ============================ */
#banner {
    padding: 8vh 0 6vh;
    border-bottom: 1px solid var(--grid);
}
/* Float the WRAPPER, give it an explicit width for wrapping to compute */
#banner .content .image.object {
    float: left;
    width: min(240px, 35%);
    margin: 0 1rem .5rem 0;
    display: block;            /* prevent inline-gap quirks */
    shape-outside: inset(0 round 50%); /* optional circle-like wrap */
    shape-margin: 8px;
  }
/* Make the image fill the wrapper, and look nice */
#banner .content .image.object img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    /* if your theme forces max-width: 100% elsewhere, this still works */
  }

#banner .content {
    display: block !important; /* override theme flex/grid */
    /* contain the float so parent height is correct */
    overflow: auto; /* or: display: flow-root; */
}

#banner .content h1 {
    margin-bottom: 1rem;
}

#banner .content p {
    text-align: justify;
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 600px;
    margin: 0 0 1rem;
}

#banner .image.object {
    /* Display banner image */
    display: block;
}
.profile {
    float: left;
    width: min(220px, 35%);
    height: auto;
    margin: 0 .95rem .5rem 0;
    border-radius: 50%;
    object-fit: cover;

    /* Optional: make text follow a circle; requires float + a known box */
    shape-outside: circle(50%);
    shape-margin: 8px;
  }
/* Small screens: stack image above text */
/* @media (max-width: 640px) {
    .profile {
      float: none;
      display: block;
      margin: 0 auto 1rem;
      shape-outside: none;
      width: 160px;
    }
  } */

/* ============================
   SECTIONS
   ============================ */
section {
    padding: 8vh 0;
    border-bottom: 1px solid var(--grid);
}

section:last-of-type {
    border-bottom: none;
}

section header.major {
    margin-bottom: 3rem;
}

section header.major h2 {
    font-size: 2rem;
    position: relative;
    padding-left: 2rem;
}

section header.major h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}

section header.main {
    margin-bottom: 2rem;
}

section header.main h2 {
    font-size: 1.5rem;
}

/* ============================
   IMAGES
   ============================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.image {
    display: block;
    width: 100%;
    margin: 0 0 1.5rem 0;
    overflow: hidden;
}

.image img {
    width: 100%;
    height: auto;
    display: block;
}

.image.main {
    width: 100%;
    margin: 2rem 0;
}

.image.main img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
}

/* ============================
   POSTS/CARDS
   ============================ */
.posts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.posts article {
    background: var(--bg-primary);
    border: 1px solid var(--grid);
    padding: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    overflow: hidden;
}

.posts article:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .posts article:hover {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.05);
}

.posts article .image {
    height: 200px;
    overflow: hidden;
    margin: 0;
    border-bottom: 1px solid var(--grid);
}

.posts article .image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.posts article:hover .image img {
    transform: scale(1.05);
}

.posts article h3 {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary);
}

.posts article p {
    padding: 0 1.5rem 1rem;
    color: var(--secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.posts article .actions {
    padding: 0 1.5rem 1.5rem;
}

/* ============================
   BUTTONS
   ============================ */
.button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    font-family: inherit;
    font-weight: 400;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.button:hover {
    background: var(--primary);
    color: var(--bg-primary);
}

.button.big {
    padding: 1rem 2.5rem;
    font-size: 0.95rem;
}

ul.actions {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

ul.actions li {
    display: inline-block;
    margin-right: 1rem;
}

ul.actions li:last-child {
    margin-right: 0;
}

/* ============================
   CONTACT
   ============================ */
.contact li .icon {
    color: var(--accent);
    font-size: 1rem;
}

/* ============================
   PUBLICATIONS
   ============================ */
section h2 a {
    color: var(--primary);
    transition: color 0.3s ease;
}

section h2 a:hover {
    color: var(--accent);
}

hr.major {
    border: none;
    height: 1px;
    background: var(--grid);
    margin: 4rem 0;
}

/* ============================
   FOOTER
   ============================ */
#footer {
    padding: 6vh 0;
    text-align: center;
    color: var(--secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--grid);
    margin-top: 8vh;
}

#footer h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

/* ============================
   FONT AWESOME ICON SUPPORT
   ============================ */
.icon {
    text-decoration: none;
    position: relative;
    display: inline-block;
}

.icon::before {
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    text-transform: none !important;
    font-family: 'Font Awesome 5 Free', 'Font Awesome 5 Brands';
}

.icon.solid::before {
    font-weight: 900;
}

.icon.brands::before {
    font-family: 'Font Awesome 5 Brands';
    font-weight: 400;
}

.label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================
   UTILITIES
   ============================ */
.text-center {
    text-align: center;
}

.highlight {
    color: var(--accent);
    font-weight: 500;
}

.image-credit {
    font-size: 0.75rem;
    color: var(--secondary);
    font-style: normal;
    margin-top: 0.5rem;
    text-align: right;
}

/* ============================
   RESPONSIVE
   ============================ */
@media screen and (max-width: 980px) {
    #wrapper {
        grid-template-columns: 1fr;
    }

    #sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--grid);
        height: auto;
        position: static;
    }

    #header .inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .posts {
        grid-template-columns: 1fr;
    }

    .inner {
        padding: 0 4vw;
    }
}

@media screen and (max-width: 736px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    section {
        padding: 6vh 0;
    }

    #header {
        padding: 6vh 0 4vh;
    }
}

/* ============================
   ACCESSIBILITY
   ============================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
