/* ===================================================================
   imcakmak.com — personal site
   Palette pulled from the profile image (deep Bebop blue + one ember
   spark), deliberately cool rather than the default warm cream.
   Light + dark themes via [data-theme]; single-column, ~640px,
   responsive to phone widths.
   =================================================================== */

:root, [data-theme="light"] {
  --bg:        #f7f7f5;   /* cool paper */
  --surface:   #ffffff;
  --fg:        #16181d;   /* near-black ink, cool */
  --muted:     #6a6d75;   /* secondary text */
  --line:      #e4e4e0;   /* hairlines */
  --accent:    #3b4cc4;   /* Bebop blue — links */
  --accent-hi: #2f3ea8;   /* link hover */
  --ember:     #d8532a;   /* the single orange spark — used once */
  --code-bg:   #f0f0ee;
}
[data-theme="dark"] {
  --bg:        #0f1420;   /* deep blue-black */
  --surface:   #161c2b;
  --fg:        #e8eaf0;
  --muted:     #9298a8;
  --line:      #263049;
  --accent:    #7f8ff0;   /* lighter blue for contrast on dark */
  --accent-hi: #9aa8ff;
  --ember:     #f0703f;
  --code-bg:   #161c2b;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  max-width: 660px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline;
          text-underline-offset: 2px; }

/* ---- profile header ---------------------------------------------- */
.profile { margin-bottom: 8px; }
.profile img {
  width: 132px; height: 132px; object-fit: cover;
  border-radius: 14px;          /* rounded square, not a circle */
  display: block; margin-bottom: 20px;
}
.profile h1 {
  font-size: 30px; font-weight: 650; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.profile .identity { color: var(--muted); font-size: 16px; margin: 0 0 14px; }

.contacts {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  font-size: 14.5px; margin-bottom: 4px;
}
.contacts a { color: var(--muted); }
.contacts a:hover { color: var(--accent); text-decoration: none; }

/* ---- nav --------------------------------------------------------- */
nav.site {
  display: flex; align-items: center; gap: 22px;
  margin: 30px 0 8px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
nav.site a { color: var(--fg); }
nav.site a:hover { color: var(--accent); text-decoration: none; }
nav.site .spacer { flex: 1; }
#theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; width: 32px; height: 32px; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, color .2s;
}
#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---- sections ---------------------------------------------------- */
section { padding-top: 40px; scroll-margin-top: 20px; }
section h2 {
  font-size: 15px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--muted); margin: 0 0 20px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* about */
.about p { margin: 0 0 16px; }
.about ul { margin: 0; padding-left: 20px; }
.about li { margin-bottom: 8px; }

/* essays list — fchollet-style: title + date, flat */
.essays { list-style: none; padding: 0; margin: 0; }
.essays li {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line);
}
.essays li:last-child { border-bottom: none; }
.essays .title { color: var(--fg); font-size: 16.5px; }
.essays .title:hover { color: var(--accent); text-decoration: none; }
.essays .date {
  color: var(--muted); font-size: 13.5px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.essays .empty { color: var(--muted); }

/* ---- single post ------------------------------------------------- */
article { padding-top: 8px; }
article .back { font-size: 14px; color: var(--muted); }
article .back:hover { color: var(--accent); text-decoration: none; }
article h1 {
  font-size: 30px; font-weight: 650; letter-spacing: -0.02em;
  margin: 24px 0 6px; line-height: 1.2;
}
article .date { color: var(--muted); font-size: 14px;
                font-variant-numeric: tabular-nums; }
article .body { margin-top: 30px; }
article .body h1, article .body h2, article .body h3 {
  letter-spacing: -0.01em; margin-top: 1.5em; line-height: 1.25; }
article .body h2 { font-size: 22px; }
article .body h3 { font-size: 19px; }
article .body p { margin: 1em 0; }
article .body ul, article .body ol { padding-left: 1.4em; }
article .body li { margin: .4em 0; }
article .body blockquote {
  border-left: 3px solid var(--accent); margin: 1.2em 0;
  padding-left: 1em; color: var(--muted); }
article .body pre {
  background: var(--code-bg); padding: 14px 16px; border-radius: 8px;
  overflow-x: auto; font-size: 14px; line-height: 1.5; }
article .body code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 5px;
  font-size: .9em; }
article .body pre code { background: none; padding: 0; }
article .body img { max-width: 100%; height: auto; border-radius: 8px;
                    margin: 1em 0; }
article .body a { text-decoration: underline; text-underline-offset: 2px; }

/* ---- forms / admin ---------------------------------------------- */
input, textarea {
  width: 100%; padding: 11px 12px; margin: 8px 0; font: inherit;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--fg); }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent); }
textarea { min-height: 240px; resize: vertical; }
button {
  font: inherit; padding: 9px 20px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; border-radius: 8px;
  cursor: pointer; }
button:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
button.ghost { background: var(--surface); color: var(--fg);
               border-color: var(--line); }
button.ghost:hover { border-color: var(--accent); color: var(--accent);
                     background: var(--surface); }
.flash { color: var(--ember); font-size: 14px; }
.admin-item {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); padding: 12px 0; gap: 12px; }
.admin-item .meta { color: var(--muted); font-size: 13px;
                    font-variant-numeric: tabular-nums; margin-left: 10px; }
.admin-item form { margin: 0; display: inline; }
.admin-item .actions { display: flex; align-items: center; gap: 12px;
                       white-space: nowrap; }
.admin-item .actions a { font-size: 14px; }
.admin-item button { padding: 5px 12px; font-size: 13px; }
.admin-new { display: inline-block; margin-bottom: 8px; font-size: 15px; }

/* ---- footer ------------------------------------------------------ */
footer { margin-top: 64px; padding-top: 20px;
         border-top: 1px solid var(--line);
         color: var(--muted); font-size: 13px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); text-decoration: none; }

/* ===================================================================
   Responsive — phones
   =================================================================== */
@media (max-width: 560px) {
  body { padding: 36px 18px 72px; font-size: 16px; }
  .profile img { width: 108px; height: 108px; }
  .profile h1 { font-size: 26px; }
  article h1 { font-size: 25px; }
  nav.site { gap: 16px; flex-wrap: wrap; }
  .essays li { flex-direction: column; gap: 3px; }
  .essays .date { font-size: 13px; }
  .contacts { gap: 4px 14px; }
}

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