/* ===========================================================================
   Portfolio — baseline stylesheet.
   Intentionally neutral: design tokens first, so the visual direction can be
   swapped by editing :root without touching component rules.
   =========================================================================== */

:root {
    --bg:            #ffffff;
    --bg-alt:        #f6f7f9;
    --surface:       #ffffff;
    --border:        #e4e6eb;
    --text:          #16181d;
    --text-muted:    #626873;
    --accent:        #2f5bff;
    --accent-text:   #ffffff;
    --danger:        #c0392b;
    --success:       #1e7d4f;

    --radius:        12px;
    --radius-sm:     8px;
    --radius-lg:     22px;   /* öne çıkan kartların yumuşak kenarları */
    --logo-plate:        #ffffff;  /* logoların durduğu açık zemin */
    --logo-plate-border: #e9ebef;
    --ease-out:      cubic-bezier(.22, .68, .28, 1);
    --shadow:        0 1px 2px rgba(16, 18, 24, .06), 0 8px 24px rgba(16, 18, 24, .06);

    --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
    --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --container: 1120px;
}

[data-theme="dark"] {
    --bg:         #0e1014;
    --bg-alt:     #14171d;
    --surface:    #171a21;
    --border:     #262b35;
    --text:       #eceef2;
    --text-muted: #9aa2b1;
    --shadow:     0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    /* Koyu temada da logo zemini açık kalır, yoksa koyu logolar kaybolur. */
    --logo-plate:        #f2f4f7;
    --logo-plate-border: transparent;
}

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-3); }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 var(--space-4); }

.container { width: min(100% - 2 * var(--space-5), var(--container)); margin-inline: auto; }
.container.narrow { width: min(100% - 2 * var(--space-5), 760px); }
.center { text-align: center; }
.sr-only, .hp {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: -9999px; top: 0; background: var(--accent);
    color: var(--accent-text); padding: var(--space-2) var(--space-4); z-index: 100;
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* --- Header --------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--space-4); }
.brand { font-weight: 650; text-decoration: none; letter-spacing: -.01em; }
.site-nav { display: flex; align-items: center; gap: var(--space-5); }
.site-nav a { text-decoration: none; color: var(--text-muted); font-size: .95rem; }
.site-nav a:hover, .site-nav a.is-active { color: var(--text); }
.theme-toggle {
    border: 1px solid var(--border); background: transparent; color: inherit;
    border-radius: 999px; width: 32px; height: 32px; cursor: pointer;
}
.nav-toggle { display: none; background: none; border: 0; padding: var(--space-2); cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 4px 0; }

/* --- Sections ------------------------------------------------------------- */
.main { min-height: 60vh; }
.section { padding: var(--space-8) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-5); }
.section-head a { color: var(--text-muted); text-decoration: none; font-size: .95rem; }

.hero { padding: var(--space-8) 0; }
.hero-inner { max-width: 720px; }
.hero-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: var(--space-4); }
.hero-eyebrow { color: var(--text-muted); font-size: .9rem; margin-bottom: var(--space-2); }
.hero-headline { font-size: 1.25rem; color: var(--text-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* --- Grid & cards --------------------------------------------------------- */
.grid { display: grid; gap: var(--space-5); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-media img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.card-body { padding: var(--space-4); }
.card-title { margin-bottom: var(--space-2); }
.card-title a { text-decoration: none; }
.card-text { color: var(--text-muted); font-size: .95rem; margin-bottom: var(--space-3); }
.card-meta { color: var(--text-muted); font-size: .85rem; }

/* --- Bits ----------------------------------------------------------------- */
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.tag {
    font-size: .8rem; color: var(--text-muted); background: var(--bg-alt);
    border: 1px solid var(--border); border-radius: 999px; padding: 2px var(--space-3);
}
.skills { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline-item { padding: 0 0 var(--space-5) var(--space-5); position: relative; }
.timeline-item::before {
    content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--accent);
}
.timeline-range { color: var(--text-muted); font-size: .85rem; margin: 0; }
.timeline-item h3 small { font-weight: 400; color: var(--text-muted); }

.prose { line-height: 1.75; }
.prose img { border-radius: var(--radius-sm); margin: var(--space-4) 0; }
.prose pre {
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-4); overflow-x: auto; font-family: var(--font-mono); font-size: .9rem;
}
.prose code { font-family: var(--font-mono); font-size: .92em; }
.detail-cover { border-radius: var(--radius); margin: var(--space-5) 0; }
.detail-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); }
.breadcrumb { color: var(--text-muted); font-size: .9rem; }
.breadcrumb a { text-decoration: none; }
.lead { font-size: 1.1rem; color: var(--text-muted); }
.empty { color: var(--text-muted); }

.pagination { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-6); }
.pagination a {
    padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); text-decoration: none; font-size: .9rem;
}
.pagination a.is-active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* --- Buttons & forms ------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-5); border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-size: .95rem; text-decoration: none; cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--text-muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }

.form { display: grid; gap: var(--space-4); margin-top: var(--space-5); }
.field { display: grid; gap: var(--space-2); }
.field label { font-size: .9rem; font-weight: 550; }
.field input, .field textarea, .field select {
    font: inherit; padding: var(--space-3); border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.field-error { color: var(--danger); font-size: .85rem; margin: 0; }
.contact-list { list-style: none; padding: 0; color: var(--text-muted); }

.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin: var(--space-4) 0; font-size: .95rem; }
.alert-success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.alert-error   { background: color-mix(in srgb, var(--danger) 12%, transparent);  color: var(--danger); }

/* --- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-6) 0; color: var(--text-muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.social { display: flex; gap: var(--space-4); }
.social a { text-decoration: none; }


/* --- Öne çıkan projeler ----------------------------------------------------
   Grid + yumuşak kenarlar + sayfa açılışında kademeli beliren kartlar.
   -------------------------------------------------------------------------- */
.featured-grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.featured-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    isolation: isolate;
    transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .35s var(--ease-out);
}
.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.featured-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.featured-link { display: block; text-decoration: none; color: inherit; height: 100%; }

/* Logonun durduğu üst alan: kapak görseli varsa arkada yumuşatılmış olarak durur. */
.featured-top {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 132px;
    padding: var(--space-5);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.featured-cover {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: .14; z-index: -1;
    transition: transform .5s var(--ease-out), opacity .35s var(--ease-out);
}
.featured-card:hover .featured-cover { transform: scale(1.06); opacity: .2; }

.featured-logo-plate {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 88px;
    padding: var(--space-4) var(--space-5);
    background: var(--logo-plate);
    border: 1px solid var(--logo-plate-border);
    border-radius: 18px;
}

.featured-logo {
    max-height: 48px;
    max-width: 78%;
    width: auto;
    object-fit: contain;
    filter: grayscale(1);
    opacity: .82;
    transition: filter .35s var(--ease-out), opacity .35s var(--ease-out), transform .35s var(--ease-out);
}
.featured-card:hover .featured-logo { filter: none; opacity: 1; transform: scale(1.04); }

.featured-logo-fallback {
    display: grid; place-items: center;
    width: 56px; height: 56px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-weight: 650; font-size: 1.05rem; letter-spacing: .02em;
}

.featured-body { padding: var(--space-4) var(--space-5) var(--space-5); }
.featured-title { font-size: 1.1rem; margin-bottom: var(--space-2); }
.featured-text { color: var(--text-muted); font-size: .93rem; margin-bottom: var(--space-3); }

/* --- Açılış animasyonu ------------------------------------------------------
   Gizleme yalnızca JS varken uygulanır (html.js), böylece JS kapalıyken
   veya observer çalışmazsa içerik her hâlükârda görünür kalır.
   -------------------------------------------------------------------------- */
.js .reveal { opacity: 0; }

/* Transition yerine keyframe: kart belirdikten sonra hover geçişi
   kendi hızında kalsın, gecikmeyi miras almasın. */
.js .reveal.is-visible {
    animation: reveal-in .6s var(--ease-out) calc(var(--i, 0) * 90ms) both;
}

@keyframes reveal-in {
    from { opacity: 0; transform: translateY(20px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; }
    .js .reveal.is-visible { animation: none; }
    .featured-card:hover { transform: none; }
}

/* --- AI assistant widget --------------------------------------------------- */
.ai-widget { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 60; }
.ai-launcher {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-5); border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow); font: inherit; font-size: .9rem;
}
.ai-launcher-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.ai-panel {
    position: absolute; right: 0; bottom: calc(100% + var(--space-3));
    width: min(380px, calc(100vw - 2 * var(--space-5))); height: 480px;
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.ai-panel[hidden] { display: none; }
.ai-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
}
.ai-panel-header small { display: block; color: var(--text-muted); font-size: .8rem; }
.ai-close { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-muted); }
.ai-messages { flex: 1; overflow-y: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.ai-msg { padding: var(--space-3); border-radius: var(--radius-sm); font-size: .92rem; max-width: 88%; white-space: pre-wrap; }
.ai-msg-bot { background: var(--bg-alt); align-self: flex-start; }
.ai-msg-user { background: var(--accent); color: var(--accent-text); align-self: flex-end; }
.ai-msg-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); align-self: flex-start; }
.ai-msg-typing { color: var(--text-muted); font-style: italic; }
.ai-form { display: flex; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--border); }
.ai-form input {
    flex: 1; font: inherit; padding: var(--space-3); border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.ai-form button {
    font: inherit; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
    border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer;
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .site-nav {
        position: absolute; inset: 64px 0 auto; flex-direction: column; align-items: flex-start;
        gap: var(--space-3); padding: var(--space-4) var(--space-5);
        background: var(--bg); border-bottom: 1px solid var(--border); display: none;
    }
    .site-nav.is-open { display: flex; }
    .section { padding: var(--space-7) 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
