/* =========================================================
   POEMS (Şiirlerim) — ink hero, glass cards, paper reading view
   ========================================================= */

/* =========================================================
   HERO — words drift like clouds, a quill writes the title,
   a random line from the poems types itself underneath.
   ========================================================= */

.word-sky {
  position: absolute;
  inset: -20px calc(-1 * var(--gutter));
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.sky-word {
  position: absolute;
  left: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: #fff;
  white-space: nowrap;
  opacity: var(--o);
  animation: word-drift var(--dur) linear var(--delay) infinite;
}

.sky-word.is-far {
  filter: blur(1.2px);
}

@keyframes word-drift {
  from { transform: translateX(-30vw); }
  to { transform: translateX(110vw); }
}

.ink {
  position: relative;
}

.ink-title {
  position: relative;
  display: inline-block;
}

/* Written from left to right as the quill moves */
.hero-poems .hero-title {
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  animation: ink-write 2.2s cubic-bezier(.45, .05, .35, 1) 0.4s forwards;
}

@keyframes ink-write {
  to {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
  }
}

/* In this script font two i's side by side melt into a "ü" — give them room */
.hero-title .ii {
  margin-left: 0.1em;
}

.quill {
  position: absolute;
  left: 4%;
  bottom: 18%;
  width: clamp(40px, 6vw, 64px);
  height: auto;
  transform-origin: 10% 94%;
  animation:
    quill-write 2.2s cubic-bezier(.45, .05, .35, 1) 0.4s both,
    quill-rest 4s ease-in-out 2.8s infinite alternate;
}

.quill-vane {
  fill: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 4px 10px rgba(80, 60, 200, 0.5));
}

.quill-shaft {
  fill: none;
  stroke: #c3b2ff;
  stroke-width: 1.6;
  stroke-linecap: round;
}

@keyframes quill-write {
  0% { left: 4%; opacity: 0; transform: rotate(0deg); }
  8% { opacity: 1; }
  20% { transform: translateY(-6px) rotate(-6deg); }
  40% { transform: translateY(4px) rotate(4deg); }
  60% { transform: translateY(-5px) rotate(-5deg); }
  80% { transform: translateY(3px) rotate(3deg); }
  100% { left: 94%; opacity: 1; transform: none; }
}

@keyframes quill-rest {
  from { left: 94%; transform: translateY(0) rotate(0deg); }
  to { left: 94%; transform: translateY(-10px) rotate(-8deg); }
}

.hero-poems .hero-sub {
  opacity: 0;
  animation: ink-sub-in 800ms var(--ease-out) 2.4s forwards;
}

@keyframes ink-sub-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--sky);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.typed-from {
  min-height: 1.4em;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}

.typed-from.is-visible {
  opacity: 1;
}


/* Ink colors for colored lines (e.g. the poem "Saat") */
.ink-red { color: #ff8a8a; }
.ink-blue { color: #8cc4ff; }
.ink-yellow { color: #ffd966; }
.ink-purple { color: #d7a4ff; }
.ink-green { color: #8fe0a8; }
.ink-brown { color: #e0b48a; }

.reader .ink-red { color: #c62f3b; }
.reader .ink-blue { color: #2257c4; }
.reader .ink-yellow { color: #b38900; }
.reader .ink-purple { color: #7c3aad; }
.reader .ink-green { color: #2b8a4c; }
.reader .ink-brown { color: #8a5a2b; }

/* ---------- Search ---------- */

.poem-tools {
  display: flex;
  justify-content: center;
  margin: -12px auto clamp(28px, 5vh, 44px);
}

.poem-search {
  position: relative;
  width: min(420px, 100%);
}

.poem-search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: var(--text-3);
  pointer-events: none;
}

.poem-search input {
  width: 100%;
  height: 50px;
  padding: 0 18px 0 48px;
  border-radius: var(--r-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-dark);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color var(--t-mid), box-shadow var(--t-mid), background var(--t-mid);
}

.poem-search input::placeholder {
  color: var(--text-3);
}

.poem-search input:focus {
  border-color: rgba(169, 212, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(106, 168, 255, 0.18);
}

.poem-empty {
  display: none;
  padding: 30px;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-2);
}

.poem-empty.is-visible {
  display: block;
}

/* ---------- Spoken poem (Sesli Şiir) ---------- */

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 400;
  font-style: italic;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), transparent);
}

/* The spoken poem: a cover with a play button, a little sound wave, and a
   small stage where the video plays at its own size (640px, never upscaled) */
.voice-list {
  display: grid;
  gap: 22px;
  margin-bottom: clamp(48px, 8vh, 80px);
}

.voice-card {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  padding: clamp(16px, 3vw, 26px);
  background:
    radial-gradient(60% 90% at 0% 50%, rgba(110, 160, 255, 0.18), transparent 70%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
}

.voice-cover {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 22px;
  background: #0c1236;
  box-shadow: 0 24px 50px -24px rgba(8, 10, 40, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: transform var(--t-slow) var(--ease-spring), box-shadow var(--t-mid);
}

.voice-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-out), filter var(--t-mid);
}

.voice-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(10, 14, 50, 0.05), rgba(10, 14, 50, 0.5));
}

.voice-cover:hover {
  transform: translateY(-4px) rotate(-1deg);
}

.voice-cover:hover img {
  transform: scale(1.05);
}

.voice-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin: -39px 0 0 -39px;
  border-radius: 50%;
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45), 0 12px 34px rgba(0, 0, 0, 0.35);
  animation: voice-pulse 2.4s ease-out infinite;
  transition: transform var(--t-mid) var(--ease-spring);
}

.voice-play svg {
  width: 30px;
  height: 30px;
  margin-left: 4px;
}

.voice-cover:hover .voice-play {
  transform: scale(1.1);
}

@keyframes voice-pulse {
  70% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0), 0 12px 34px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 12px 34px rgba(0, 0, 0, 0.35); }
}

.voice-time {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(10, 14, 50, 0.6);
}

.voice-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #cfe0ff;
  background: rgba(110, 160, 255, 0.16);
  border: 1px solid rgba(160, 195, 255, 0.3);
}

.voice-tag svg {
  width: 16px;
  height: 16px;
}

.voice-text h3 {
  margin-top: 14px;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 500;
  font-style: italic;
}

.voice-text p {
  max-width: 46ch;
  margin-top: 10px;
  color: var(--text-2);
}

.voice-text .note {
  font-size: 13.5px;
  color: var(--text-3);
}

/* A quiet sound wave; it moves while the poem plays */
.voice-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  margin-top: 18px;
}

.voice-wave i {
  width: 4px;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(180deg, #a9c8ff, #6b7cf5);
  transform: scaleY(var(--h, 0.3));
  transition: transform 400ms var(--ease-out);
}

.voice-wave i:nth-child(4n + 1) { --h: 0.35; }
.voice-wave i:nth-child(4n + 2) { --h: 0.7; }
.voice-wave i:nth-child(4n + 3) { --h: 0.5; }
.voice-wave i:nth-child(4n) { --h: 0.85; }
.voice-wave i:nth-child(7n) { --h: 0.25; }

.voice-card:hover .voice-wave i,
.voice-card.is-playing .voice-wave i {
  animation: voice-bar 1s ease-in-out infinite alternate;
  animation-delay: calc(var(--d, 0) * -1s);
}

.voice-wave i:nth-child(3n) { --d: 0.3; }
.voice-wave i:nth-child(3n + 1) { --d: 0.65; }
.voice-wave i:nth-child(5n) { --d: 0.9; }

@keyframes voice-bar {
  from { transform: scaleY(0.2); }
  to { transform: scaleY(1); }
}

/* The stage: a dark room with the video at its own size */
.voice-stage {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 30, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: voice-in 300ms ease both;
}

.voice-screen {
  position: relative;
  /* never larger than the video itself, so it always looks sharp */
  width: min(var(--w), 100%, (100svh - 120px) * var(--ratio));
  aspect-ratio: var(--ratio);
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.12);
  animation: voice-rise 450ms var(--ease-out) both;
}

.voice-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

@keyframes voice-in {
  from { opacity: 0; }
}

@keyframes voice-rise {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
}

@media (max-width: 760px) {
  .voice-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .voice-cover {
    max-width: 320px;
    width: 100%;
    margin: 0 auto;
  }

  .voice-text p {
    margin-inline: auto;
  }

  .voice-wave {
    justify-content: center;
  }
}

/* ---------- Poem cards ---------- */

.poem-grid {
  columns: 3 300px;
  column-gap: 20px;
}

.poem-card {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 20px;
  padding: 26px 26px 22px;
  break-inside: avoid;
  text-align: left;
  border-radius: var(--r-l);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-m), var(--sheen);
  overflow: hidden;
  transition: transform var(--t-slow) var(--ease-spring), box-shadow var(--t-mid), border-color var(--t-mid), background var(--t-mid);
}

/* Soft colored light that follows the card's hover */
.poem-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(200, 160, 255, 0.18), transparent 50%);
  opacity: 0;
  transition: opacity var(--t-mid);
  pointer-events: none;
}

.poem-card:hover,
.poem-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-l), var(--sheen);
  outline: none;
}

.poem-card:hover::before,
.poem-card:focus-visible::before {
  opacity: 1;
}

.poem-card h2 {
  font-size: 23px;
  font-weight: 500;
  font-style: italic;
  margin-bottom: 12px;
}

.poem-preview {
  position: relative;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-2);
  white-space: pre-line;
  max-height: calc(1.75em * 5);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

.poem-preview.is-short {
  -webkit-mask-image: none;
  mask-image: none;
}

.poem-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sky);
}

.poem-more svg {
  width: 16px;
  height: 16px;
  transition: transform var(--t-mid) var(--ease-spring);
}

.poem-card:hover .poem-more svg {
  transform: translateX(4px);
}

.poem-card.is-hidden {
  display: none;
}

/* ---------- Reader (paper) ---------- */

.reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  visibility: hidden;
}

.reader.is-open {
  visibility: visible;
}

.reader-bg {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 36, 0.78);
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
}

.reader.is-open .reader-bg {
  opacity: 1;
}

.reader-paper {
  position: relative;
  width: min(640px, 100%);
  max-height: min(860px, calc(100svh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: var(--r-l);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(160deg, #fffaf1, #f7efe1);
  color: #1d2246;
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  opacity: 0;
  transform: translateY(40px) scale(0.96) rotate(-1deg);
  transition: opacity 420ms var(--ease-out), transform 620ms var(--ease-spring);
}

.reader.is-open .reader-paper {
  opacity: 1;
  transform: none;
}

/* A faint blue ruled margin, like notebook paper */
.reader-paper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 44px;
  width: 1px;
  background: rgba(200, 115, 222, 0.22);
  pointer-events: none;
}

.reader-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 18px 0 64px;
}

.reader-head h2 {
  flex: 1;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 500;
  font-style: italic;
  color: var(--blue-deep);
}

.reader-btn {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #3a4378;
  transition: background var(--t-mid), transform var(--t-mid) var(--ease-spring);
}

.reader-btn:hover {
  background: rgba(30, 58, 138, 0.08);
  transform: scale(1.08);
}

.reader-btn svg {
  width: 20px;
  height: 20px;
}

.reader-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 40px 10px 64px;
  overscroll-behavior: contain;
}

.reader-lines {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.2vw, 19px);
  line-height: 1.95;
  font-variation-settings: "SOFT" 100;
}

.reader-lines span.line {
  display: block;
  min-height: 1em;
  opacity: 0;
  transform: translateY(8px);
  animation: line-in 600ms var(--ease-out) forwards;
  animation-delay: calc(120ms + var(--n) * 45ms);
}

@keyframes line-in {
  to { opacity: 1; transform: none; }
}

.reader-signature {
  margin: 22px 0 6px;
  text-align: right;
  font-family: var(--font-script);
  font-size: 34px;
  color: #6b55c9;
  opacity: 0;
  animation: line-in 900ms var(--ease-out) forwards;
  animation-delay: var(--sig-delay, 600ms);
}

.reader-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 16px;
  border-top: 1px solid rgba(30, 58, 138, 0.08);
}

.reader-foot button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 48%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 700;
  color: #3a4378;
  transition: background var(--t-mid);
}

.reader-foot button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-foot button:hover {
  background: rgba(30, 58, 138, 0.08);
}

.reader-foot svg {
  width: 18px;
  height: 18px;
  flex: none;
}

@media (max-width: 600px) {
  .reader-paper::before {
    left: 22px;
  }

  .reader-head {
    padding-left: 36px;
  }

  .reader-body {
    padding: 14px 20px 10px 36px;
  }
}

/* English visitors: a short note that the poems are in Turkish */
.poems-lang-note {
  margin: -8px 0 18px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text-3);
}
