/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

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

:root {
  --bg: #f5f0eb;
  --text: #1a1a1a;
  --muted: #7c6f64;
  --accent: #5a7a6a;
  --accent-hover: #3e5a4c;
  --name-color: #2c3e7a;
  --font: "Georgia", serif;
  --mono: "Courier New", monospace;
}

html {
  font-size: 18px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: hidden;
  animation: bg-shift 20s ease-in-out infinite alternate;
}

@keyframes bg-shift {
  0%   { background-color: #f5f0eb; }
  33%  { background-color: #f0edf5; }
  66%  { background-color: #f5ede8; }
  100% { background-color: #edf0f5; }
}

/* Ruby logo background */
.bg-ruby {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 320px;
  height: 320px;
  opacity: 0.07;
  pointer-events: none;
  z-index: 1;
  animation: ruby-float 12s ease-in-out infinite alternate;
}

@keyframes ruby-float {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(16px) rotate(6deg); }
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 10;
  animation: grain-drift 8s steps(2) infinite;
}

@keyframes grain-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, -3%); }
  50%  { transform: translate(3%, 1%); }
  75%  { transform: translate(-1%, 4%); }
  100% { transform: translate(0, 0); }
}

/* Blobs */
.bg-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  filter: blur(90px);
  opacity: 0.5;
}

.blob-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #5a7a6a55, #7aa08822);
  top: -120px;
  left: -120px;
  animation: drift1 14s ease-in-out infinite alternate, morph1 10s ease-in-out infinite alternate;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #2c3e7a44, #5b6abf22);
  bottom: -100px;
  right: -100px;
  animation: drift2 18s ease-in-out infinite alternate, morph2 13s ease-in-out infinite alternate;
}

.blob-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, #7a8a5a44, #a0a87222);
  top: 40%;
  left: 55%;
  animation: drift3 22s ease-in-out infinite alternate, morph3 16s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate(0, 0); }
  to   { transform: translate(80px, 100px); }
}
@keyframes drift2 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-60px, -70px); }
}
@keyframes drift3 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-80px, 60px); }
}

@keyframes morph1 {
  0%   { border-radius: 60% 40% 70% 30% / 50% 60% 40% 50%; }
  50%  { border-radius: 40% 60% 30% 70% / 60% 40% 60% 40%; }
  100% { border-radius: 70% 30% 50% 50% / 40% 70% 30% 60%; }
}
@keyframes morph2 {
  0%   { border-radius: 50% 50% 60% 40% / 40% 60% 50% 50%; }
  50%  { border-radius: 70% 30% 40% 60% / 60% 40% 70% 30%; }
  100% { border-radius: 30% 70% 60% 40% / 50% 50% 40% 60%; }
}
@keyframes morph3 {
  0%   { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
  50%  { border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%; }
  100% { border-radius: 50% 50% 70% 30% / 50% 50% 60% 40%; }
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.particles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  opacity: 0;
  animation: float-up linear infinite;
}

.particles span:nth-child(1)  { width: 6px;  height: 6px;  left: 10%; background: #5a7a6a55; animation-duration: 12s; animation-delay: 0s; }
.particles span:nth-child(2)  { width: 4px;  height: 4px;  left: 25%; background: #2c3e7a44; animation-duration: 16s; animation-delay: 2s; }
.particles span:nth-child(3)  { width: 8px;  height: 8px;  left: 40%; background: #7a8a5a44; animation-duration: 10s; animation-delay: 4s; }
.particles span:nth-child(4)  { width: 5px;  height: 5px;  left: 55%; background: #5a7a6a44; animation-duration: 14s; animation-delay: 1s; }
.particles span:nth-child(5)  { width: 3px;  height: 3px;  left: 70%; background: #2c3e7a55; animation-duration: 18s; animation-delay: 3s; }
.particles span:nth-child(6)  { width: 7px;  height: 7px;  left: 80%; background: #7a8a5a33; animation-duration: 11s; animation-delay: 5s; }
.particles span:nth-child(7)  { width: 4px;  height: 4px;  left: 15%; background: #5a7a6a33; animation-duration: 20s; animation-delay: 6s; }
.particles span:nth-child(8)  { width: 6px;  height: 6px;  left: 60%; background: #2c3e7a33; animation-duration: 13s; animation-delay: 7s; }
.particles span:nth-child(9)  { width: 3px;  height: 3px;  left: 35%; background: #7a8a5a55; animation-duration: 15s; animation-delay: 2s; }
.particles span:nth-child(10) { width: 5px;  height: 5px;  left: 90%; background: #5a7a6a44; animation-duration: 17s; animation-delay: 9s; }

@keyframes float-up {
  0%   { transform: translateY(110vh) translateX(0);   opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-10vh) translateX(30px); opacity: 0; }
}

main {
  position: relative;
  z-index: 1;
  max-width: 560px;
  width: 100%;
}

.clock {
  position: fixed;
  bottom: 1.5rem;
  right: 2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  z-index: 2;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.clock:hover {
  opacity: 1;
}

.page-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  z-index: 20;
  border: 1px solid #ddd6ce;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  background: rgba(245, 240, 235, 0.7);
  backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}

.page-counter:hover {
  border-color: #bbb;
  color: var(--text);
}

.breakdown-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.6rem);
  left: 0;
  min-width: 200px;
  background: rgba(250, 247, 244, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid #ddd6ce;
  border-radius: 10px;
  padding: 0.6rem 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  z-index: 21;
}

.breakdown-popup.open {
  display: block;
  animation: popup-in 0.15s ease;
}

@keyframes popup-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
}

.breakdown-row:hover {
  background: rgba(0,0,0,0.03);
}

.breakdown-flag {
  font-size: 1rem;
  line-height: 1;
}

.breakdown-country {
  flex: 1;
  color: var(--text);
}

.breakdown-count {
  color: var(--accent);
  font-weight: bold;
}

.breakdown-empty {
  padding: 0.5rem 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: -0.02em;
  color: var(--name-color);
}

.tagline {
  color: #7a8a5a;
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.about {
  margin-bottom: 2.5rem;
}

.about p {
  color: #333;
}

.contact-btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: background 0.2s, box-shadow 0.2s;
}

.contact-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.1);
}
