/* emretarhan.net — terminal-grid stylesheet
   black/white/high-contrast, JetBrains Mono, ch-exact rhythm.
   ascii art sizing is one fluid formula (see .ascii-frame), not media queries. */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/JetBrainsMono-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/JetBrainsMono-ExtraBold.woff2") format("woff2");
}

:root {
  --font-family: "JetBrains Mono", monospace;
  --line-height: 1.20rem;
  --border-thickness: 2px;
  --text-color: #fff;
  --text-color-alt: #aaa;
  --background-color: #000;
  --background-color-alt: #111;
  --accent: #8AB4F8;          /* pastel klasyk: sakin mavi */
  --invert-bg: #dcdcdc;       /* hover invert için kırık beyaz */
  /* char advance ratio of JetBrains Mono: 1ch == 0.6em (0.01 safety) */
  --art-advance: 0.61;

  --font-weight-normal: 500;
  --font-weight-medium: 600;
  --font-weight-bold: 800;

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: var(--font-weight-normal);
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

* + * {
  margin-top: var(--line-height);
}

html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  color: var(--text-color);
}

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--line-height) 2ch;
  max-width: calc(min(80ch, round(down, 100%, 1ch)));
  line-height: var(--line-height);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  margin: calc(var(--line-height) * 2) 0 var(--line-height);
  line-height: var(--line-height);
}

h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  margin-bottom: calc(var(--line-height) * 2);
  text-transform: uppercase;
}
h2 {
  font-size: 1rem;
  text-transform: uppercase;
}

a {
  text-decoration-thickness: var(--border-thickness);
}

a:link, a:visited {
  color: var(--text-color);
}
a:hover {
  color: var(--accent);
}

::selection {
  background: var(--accent);
  color: #000;
}

:focus-visible {
  outline: var(--border-thickness) solid var(--accent);
  outline-offset: 2px;
}

p {
  margin-bottom: var(--line-height);
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

strong {
  font-weight: var(--font-weight-bold);
}
em {
  font-style: italic;
}

/* ------------------------------------------------------------- tables */

table {
  position: relative;
  top: calc(var(--line-height) / 2);
  width: calc(round(down, 100%, 1ch));
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
}

th, td {
  border: var(--border-thickness) solid var(--text-color);
  padding:
    calc((var(--line-height) / 2))
    calc(1ch - var(--border-thickness) / 2)
    calc((var(--line-height) / 2) - (var(--border-thickness)))
  ;
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}
table tbody tr:first-child > * {
  padding-top: calc((var(--line-height) / 2) - var(--border-thickness));
}

th {
  font-weight: 700;
}
.width-min {
  width: 0%;
}
.width-auto {
  width: 100%;
}

.header {
  margin-bottom: calc(var(--line-height) * 2);
}
.header h1 {
  margin: 0;
}
.header tr td:last-child {
  text-align: right;
}

/* -------------------------------------------------- details (projects) */

details {
  border: var(--border-thickness) solid var(--text-color);
  padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
  margin-bottom: var(--line-height);
  position: relative;
}

summary {
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
summary::marker {
  content: '▶ ';
}
details[open] summary {
  margin-bottom: var(--line-height);
}
details[open] summary::marker {
  content: '▼ ';
}

details :last-child {
  margin-bottom: 0;
}

/* smooth open/close in modern browsers, instant elsewhere */
@supports (interpolate-size: allow-keywords) {
  :root {
    interpolate-size: allow-keywords;
  }
  details::details-content {
    block-size: 0;
    overflow: hidden;
    transition:
      block-size 300ms ease,
      content-visibility 300ms allow-discrete;
  }
  details[open]::details-content {
    block-size: auto;
  }
}

/* terminal-style invert on closed cards.
   focus tarafı :focus-visible ile: mouse ile tıklayınca invert "yapışması",
   klavye ile gezerken yine belli olur. */
details:not([open]) {
  transition: background-color 120ms linear;
}
details:not([open]):hover,
details:not([open]):has(summary:focus-visible) {
  background-color: var(--invert-bg);
}
details:not([open]):hover summary,
details:not([open]):has(summary:focus-visible) summary {
  color: var(--background-color);
}

/* badge yalnızca kart açıkken görünsün */
.sum-right {
  display: none;
  position: absolute;
  margin: 0;
  top: 0.67rem;
  right: 0.5rem;
  background-color: var(--accent);
  font-weight: var(--font-weight-bold);
  color: #000;
  padding: 5px 10px;
}
details[open] .sum-right {
  display: inline-block;
}

/* ------------------------------------------------------------- ascii art
   every art block declares --art-width (its longest line, measured in PHP).
   one formula fits it to the container at any viewport — crisp font-glyph
   scaling, no transform blur, no per-art media queries. --art-scale is an
   optional per-art multiplier (project JSON: art_scale) for manual tuning.
   the 3px floor matches the old tiny-map look instead of overflowing. */

.ascii-frame {
  container-type: inline-size;
}
.ascii-frame pre {
  margin: 0;
  width: 100%;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
}
.ascii-frame pre code {
  display: block;
  width: max-content;
  font-family: var(--font-family);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  font-size: calc(max(3px, min(1rem, 100cqw / (var(--art-width) * var(--art-advance)))) * var(--art-scale, 1));
}

/* ----------------------------------------------------------- hero scene
   bulutlar / hero yazısı / zemin: ascii postcard. hepsi saf css —
   translateX + steps() ile kare kare süzülme, js yok. bulutlar aynı
   hızda filo halinde uçar (farklı hızlar frame-bug gibi görünüyor);
   negative delay'ler açılışta gökyüzünü doldurur. mobilde yalnızca
   kompakt bulut şeridi kalır, yazı+zemin gizlenir. */

.scene {
  position: relative;
  height: calc(var(--line-height) * 13);
  overflow: hidden;
}
.scene .cloud {
  position: absolute;
  margin: 0;
  line-height: var(--line-height);
  white-space: pre;
  font-family: var(--font-family);
  animation: drift 32s linear infinite;
}
.scene .cloud code {
  display: block;
}
.scene .cloud-a { top: 0; animation-delay: -5.1s; }
.scene .cloud-b {
  top: calc(var(--line-height) * 0.5);
  color: var(--text-color-alt);
  animation-delay: -19.4s;
}
.scene .cloud-c { top: calc(var(--line-height) * 1); animation-delay: -26s; }
.scene .cloud-d { top: calc(var(--line-height) * 0.25); animation-delay: -12s; }
.scene .cloud-e {
  top: calc(var(--line-height) * 0.75);
  color: var(--text-color-alt);
  animation-delay: -31.4s;
}

.scene-text {
  position: absolute;
  top: calc(var(--line-height) * 5.5);
  left: 0;
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: var(--font-weight-bold);
  text-wrap: balance;
  padding: 0 2ch;
}

.scene .terrain-frame {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
}
.terrain-frame pre {
  margin: 0;
  overflow-x: hidden; /* fit genişliği aşılırsa zemin sağdan kırpılır, kaydırılamaz */
}
.terrain-frame pre code {
  display: block;
  width: max-content;
}

/* mobilde sahnede zemin yok; sayfanın en altında, footer'ın altında */
.terrain-end {
  display: none;
}

/* sahne yazısının mobil kopyası: mobilde sahnede yer yok, akışta göster */
.hero-text-mobile {
  display: none;
  font-weight: var(--font-weight-bold);
}

@keyframes drift {
  from { transform: translateX(-16ch); }
  to   { transform: translateX(96ch); }
}
@keyframes drift-sm {
  from { transform: translateX(-14ch); }
  to   { transform: translateX(58ch); }
}

@media screen and (max-width: 580px) {
  .scene {
    height: calc(var(--line-height) * 5);
    /* body padding'ini iptal et: bulutlar kenardan kenara aksın */
    margin-inline: calc(-1 * 1ch);
  }
  .scene .cloud { animation-name: drift-sm; }
  /* 46 kolonluk sahneye 5 bulut sığmaz: ikisi gizli, üçü çakışmayacak fazlarda */
  .scene .cloud-d, .scene .cloud-e { display: none; }
  .scene .cloud-a { animation-delay: -13.8s; }
  .scene .cloud-b { animation-delay: -6.2s; }
  .scene .cloud-c { animation-delay: -21.8s; }
  .scene-text, .scene .terrain-frame { display: none; }
  .hero-text-mobile { display: block; }
  .terrain-end {
    display: block;
    margin-inline: calc(-1 * 1ch);
    margin-bottom: calc(-1 * var(--line-height));
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene .cloud { animation: none; }
  .scene .cloud-a { transform: translateX(6ch); }
  .scene .cloud-b { transform: translateX(26ch); }
  .scene .cloud-c { transform: translateX(46ch); }
  .scene .cloud-d { transform: translateX(64ch); }
  .scene .cloud-e { transform: translateX(80ch); }
}

.now-playing {
  margin-bottom: var(--line-height);
}
.np-icon {
  color: var(--accent);
}
.np-note {
  color: var(--text-color-alt);
  font-size: 11px;
}

/* vurgulu link: underline yetmez, chip gibi belli olsun.
   inline-block + daraltılmış line-height: arkaplan tüm satırı değil,
   sadece metni sarsın (yukarı/aşağı birkaç px kırpılmış). */
.link-chip {
  display: inline-block;
  margin: 0.15em 0;
  padding: 0.05em 0.5ch;
  line-height: 1.05;
  background: var(--accent);
  color: #000;
  text-decoration: none;
}
.link-chip:hover {
  color: #000;
  text-decoration: underline;
  text-decoration-thickness: var(--border-thickness);
}

/* ------------------------------------------------------------- lists */

ul {
  list-style-type: square;
  padding: 0 0 0 2ch;
  margin: 0 0 var(--line-height);
}

li {
  margin: 0;
  padding: 0;
}
li::marker {
  line-height: 0;
}

/* log section — terminal lines, newest first */
ul.log {
  list-style: none;
  padding: 0;
}
ul.log li {
  line-height: var(--line-height);
}
.log-date {
  color: var(--text-color-alt);
}

/* ------------------------------------------------------- stack tree */

.tree, .tree ul {
  position: relative;
  padding-left: 0;
  list-style-type: none;
  line-height: var(--line-height);
}
.tree ul {
  margin: 0;
}
.tree ul li {
  position: relative;
  padding-left: 1.5ch;
  margin-left: 1.5ch;
  border-left: var(--border-thickness) solid var(--text-color);
}
.tree ul li:before {
  position: absolute;
  display: block;
  top: calc(var(--line-height) / 2);
  left: 0;
  content: "";
  width: 1ch;
  border-bottom: var(--border-thickness) solid var(--text-color);
}
.tree ul li:last-child {
  border-left: none;
}
.tree ul li:last-child:after {
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  content: "";
  height: calc(var(--line-height) / 2);
  border-left: var(--border-thickness) solid var(--text-color);
}
.tree > li > p {
  margin: 0;
}

/* ------------------------------------------------------------- forms
   (used by admin.php, which reuses this stylesheet) */

input, button, textarea {
  border: var(--border-thickness) solid var(--text-color);
  padding:
    calc(var(--line-height) / 2 - var(--border-thickness))
    calc(1ch - var(--border-thickness));
  margin: 0;
  font: inherit;
  font-weight: inherit;
  height: calc(var(--line-height) * 2);
  width: auto;
  overflow: visible;
  background: var(--background-color);
  color: var(--text-color);
  line-height: normal;
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;
  -webkit-appearance: none;
}

input[type=checkbox],
input[type=radio] {
  display: inline-grid;
  place-content: center;
  vertical-align: top;
  width: 2ch;
  height: var(--line-height);
  cursor: pointer;
}
input[type=checkbox]:checked:before,
input[type=radio]:checked:before {
  content: "";
  width: 1ch;
  height: calc(var(--line-height) / 2);
  background: var(--text-color);
}
input[type=radio],
input[type=radio]:before {
  border-radius: 100%;
}

button:focus, input:focus {
  --border-thickness: 3px;
}
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: var(--border-thickness) solid var(--accent);
  outline-offset: 2px;
}

input {
  width: calc(round(down, 100%, 1ch));
}
::placeholder {
  color: var(--text-color-alt);
  opacity: 1;
}
button::-moz-focus-inner {
  padding: 0;
  border: 0;
}

button {
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}
button:hover {
  background: var(--background-color-alt);
}
button:active {
  transform: translate(2px, 2px);
}

label {
  display: block;
  width: calc(round(down, 100%, 1ch));
  height: auto;
  line-height: var(--line-height);
  font-weight: var(--font-weight-medium);
  margin: 0;
}
label input {
  width: 100%;
}

textarea {
  height: auto;
  width: calc(round(down, 100%, 1ch));
  line-height: var(--line-height);
}

/* --------------------------------------------------------- utilities */

.center {
  max-width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.text-center {
  text-align: center;
}
.text-alt {
  color: var(--text-color-alt);
}
.text-sm {
  font-size: 10px;
}
.text-xs {
  font-size: 11px;
}
.mt-spec {
  margin-top: 1.5rem;
}
.mt0 {
  margin-top: 0;
}
.mb0 {
  margin-bottom: 0.25rem;
}
.mb1 {
  margin-bottom: 1.5rem;
}

footer {
  margin-top: calc(var(--line-height) * 2);
}
footer p {
  margin-bottom: 0;
}

::-webkit-scrollbar {
  height: var(--line-height);
}

/* --------------------------------------------------------- responsive */

@media screen and (max-width: 580px) {
  :root {
    font-size: 14px;
  }
  body {
    padding: var(--line-height) 1ch;
  }
}

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