:root {
  --cream:#f7efe1;
  --warm:#fff8ec;
  --brown:#5b3922;
  --soft:#8a5a36;
  --gold:#d6922d;
  --red:#9d1f18;
  --blue:#0d356b;
}

* {
  box-sizing: border-box;
}

body{
  margin:0;
  min-height:100vh;
  font-family:Georgia, "Times New Roman", serif;
  color:var(--brown);
  background:
    url("paper-texture.jpg") center/cover no-repeat,
    linear-gradient(135deg,#f9ead0,#e9c9a3);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:2rem;
}

.page{
  position:relative;
  width:min(1400px,95%);
  margin: 140px auto 0;
  background:rgba(255,248,236,0.86);
  border:1px solid rgba(124,83,46,0.22);
  border-radius:34px;
  box-shadow:0 24px 70px rgba(72,43,20,0.18);
  overflow:hidden;
}

/* subtle paper texture */
.page::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0.32;
  background:
    radial-gradient(circle at 14% 18%, rgba(91,57,34,0.045) 0 1px, transparent 1.4px),
    radial-gradient(circle at 72% 34%, rgba(91,57,34,0.035) 0 1px, transparent 1.6px),
    radial-gradient(circle at 42% 81%, rgba(255,255,255,0.55) 0 1px, transparent 1.5px),
    repeating-linear-gradient(0deg, rgba(91,57,34,0.025) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.20) 0 1px, transparent 1px 8px);
  mix-blend-mode:multiply;
}

header, main, footer, .stripe {
  position:relative;
  z-index:1;
}

header{
  padding:3rem 2rem 2rem;
  background:
    linear-gradient(rgba(255,248,236,0.8),rgba(255,248,236,0.95)),
    repeating-linear-gradient(90deg,rgba(120,70,33,0.08) 0 1px,transparent 1px 50px);
}

.header-row{
  display:flex;
  align-items:baseline;
  gap:1.4rem;
}

.logo-wrap{
  display:flex;
  align-items:flex-end;
  height:clamp(2.5rem,6vw,5.4rem);
  flex:0 0 auto;
}

.logo-wrap img{
  height:2em;
  max-height:100%;
  width:auto;
  display:block;
  transform:translateY(0.08em);
  filter:drop-shadow(0 8px 12px rgba(65,38,19,0.16));
}

h1{
  margin:0;
  font-size:clamp(1.8rem,3vw,2.5rem);
  line-height:1;
  color:var(--red);
  letter-spacing:0.02em;
  text-shadow:0 2px 0 rgba(255,255,255,0.75);
}

.subtitle{
  margin:1rem 0 0;
  max-width:720px;
  color:var(--soft);
  font-size:clamp(1.1rem,2.2vw,1.45rem);
  line-height:1.65;
}

.stripe{
  height:12px;
  background:linear-gradient(90deg,var(--red),var(--gold),var(--blue),var(--gold),var(--red));
  opacity:0.8;
}

main{
  padding:2.4rem;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:1.2rem;
}

.card{
  background:rgba(255,255,255,0.45);
  border:1px solid rgba(124,83,46,0.18);
  padding:1.4rem;
  border-radius:24px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.7);
}

.form-card {
  grid-column: span 2;
  max-width: 100%;
}

.history-card {
  grid-column: 1 / -1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

form {
  display: grid;
  gap: 1rem;
  margin-top: 0.75rem;
}

label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brown);
}

input,
textarea {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(124,83,46,0.22);
  border-radius: 18px;
  background: rgba(255,255,255,0.92);
  color: var(--brown);
  font-size: 1rem;
}

textarea {
  resize: vertical;
  min-height: 160px;
}

input:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(217,146,45,0.16);
  border-color: rgba(157,31,24,0.5);
}

.form-submit {
  width: fit-content;
}

.entry-card {
  max-width: 760px;
  margin: 0 auto;
}

.entry-preview {
  margin-top: 1.5rem;
  padding: 1.2rem 1.3rem;
  border-radius: 20px;
  background: rgba(217,146,45,0.08);
  border: 1px solid rgba(217,146,45,0.16);
}

.entry-preview a {
  color: var(--blue);
  word-break: break-all;
}

.entry-body p + p {
  margin-top: 1em;
}

.media-embed {
  margin-top: 1rem;
}

.iframe-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
  border-radius: 12px;
}

.iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .iframe-container {
    padding-bottom: 40%; /* Smaller on mobile, adjust as needed */
  }
}

.media-embed video,
.media-embed img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.media-embed a {
  color: var(--blue);
  word-break: break-all;
}

.flash-messages {
  max-width: min(1400px, 95%);
  margin: 1rem auto 0;
  padding: 0 1rem;
}

.flash {
  display: inline-block;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(124,83,46,0.16);
  color: var(--brown);
  box-shadow: 0 10px 20px rgba(72,43,20,0.08);
}

.checkbox-label {
  align-items: center;
  gap: 8px;
  margin: 1rem 0;
  font-size: 0.9rem;
  cursor: pointer;
  align-self: flex-start;
  width: fit-content;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

.checkbox-label a {
  color: var(--brown);
  text-decoration: underline;
}

.card h2{
  margin:0 0 0.6rem;
  font-size:1.3rem;
  color:var(--blue);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.history-table th,
.history-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(124,83,46,0.16);
}

.history-table th {
  background: rgba(217,146,45,0.08);
  font-weight: 600;
  color: var(--brown);
}

.history-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-row:hover {
  background: rgba(217,146,45,0.08);
}

.share-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-link {
  font-size: 0.9rem;
  color: var(--blue);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.copy-btn {
  background: var(--red);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.copy-btn:hover {
  background: var(--blue);
}

.delete-btn {
  background: var(--red);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.delete-btn:hover {
  background: #c9302c;
}

.edit-btn {
  display: inline-block;
  background: var(--blue);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s ease;
}

.edit-btn:hover {
  background: #0a254a;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.8rem 0 1.2rem;
  flex-wrap: wrap;
}

.search-form input {
  flex: 1 1 240px;
  max-width: 420px;
}

.search-btn {
  background: var(--gold);
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

.search-btn:hover {
  background: #b8741f;
}

.entry-header-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.entry-header-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.page-info {
  font-weight: 600;
  color: var(--brown);
}

.edit-btn.disabled {
  background: rgba(13, 53, 107, 0.35);
  cursor: not-allowed;
  pointer-events: none;
}

.card p{
  margin:0;
  line-height:1.6;
  font-size:1.02rem;
}

.card .date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0 0;
}

footer{
  text-align:center;
  padding:1.4rem 2rem 2rem;
  color:var(--soft);
  font-size:0.98rem;
}

@media(max-width:760px){
  body{padding:1rem;}
  header{padding-top:2rem;}
  .header-row{
    align-items:center;
    gap:1rem;
  }
  .logo-wrap{
    height:clamp(2.1rem,8vw,3.2rem);
  }
  h1{
    font-size:clamp(2rem,8vw,3.2rem);
  }
  main{
    grid-template-columns:1fr;
    padding:1.2rem;
  }
  .share-link {
    display: none;
  }
}

.header-row{
  display:flex;
  align-items:stretch;
  gap:1.5rem;
}

.text-block{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.logo-wrap{
  display:flex;
  align-items:stretch;
}

.logo-wrap img{
  height:100%;
  width:auto;
}


body::after {
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:radial-gradient(
    circle at center,
    transparent 60%,
    rgba(90,60,30,0.25) 100%
  );
}


.top-menu {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(1400px, 95%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: rgba(255, 248, 236, 0.82);
  border: 1px solid rgba(124,83,46,0.22);
  border-radius: 22px;
  box-shadow: 0 12px 36px rgba(72,43,20,0.16);
  backdrop-filter: blur(8px);
}

.top-menu img {
  height: 100px;
  width: auto;
  display: block;
}

.menu-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-link {
  color: var(--brown);
  text-decoration: none;
  font-weight: 600;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu-link:hover {
  background: rgba(217,146,45,0.14);
  color: var(--blue);
}

.menu-user {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  font-weight: 600;
  color: var(--brown);
  cursor: pointer;
}

.user-menu {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(124,83,46,0.22);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(72,43,20,0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  min-width: 160px;
  margin-top: 0.5rem;
}

.user-menu:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--brown);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.dropdown-menu a:first-child {
  border-radius: 12px 12px 0 0;
}

.dropdown-menu a:last-child {
  border-radius: 0 0 12px 12px;
}

.dropdown-menu a:hover {
  background-color: rgba(217,146,45,0.14);
  color: var(--blue);
}

.menu-button {
  text-decoration: none;
  color: var(--warm);
  background: var(--red);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(72,43,20,0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(72,43,20,0.22);
}

body {
  padding-top: 6.5rem;
}

@media(max-width:760px){
  .top-menu {
    top: 0.7rem;
    width: calc(100% - 1rem);
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .menu-links {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .top-menu img {
    height: 34px;
  }

  .menu-button,
  .menu-link,
  .menu-user {
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
  }

  body {
    padding-top: 5.8rem;
  }
}

.kofi-support {
  text-align: center;
  margin-top: 0.8rem;
}

.kofi-support a {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(157, 31, 24, 0.08); /* VERY soft red */
  color: #9d1f18;
  text-decoration: none;
  border-radius: 14px;
  font-size: 0.85rem;
  border: 1px solid rgba(157, 31, 24, 0.2);
  transition: all 0.2s ease;
}

.kofi-support a:hover {
  background: rgba(157, 31, 24, 0.15);
}

.kofi-about {
  margin-top: 1rem;
}

.kofi-text {
  font-size: 0.9rem;
  color: #6d5a4b;
  margin-bottom: 0.3rem;
}

.kofi-about a {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(157, 31, 24, 0.08);
  color: #9d1f18;
  text-decoration: none;
  border-radius: 16px;
  border: 1px solid rgba(157, 31, 24, 0.2);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.kofi-about a:hover {
  background: rgba(157, 31, 24, 0.15);
}

.kofi-about a:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
