/* ===============================
   Berkshire–Minimal (Dark Edition)
   Improved for accessibility & UX
   =============================== */

/* Palette */
:root{
  --bg:#050608;          /* near-black */
  --fg:#dcdfe3;          /* soft silver */
  --muted:#9aa0a6;       /* muted gray */
  --line:#262b31;        /* divider */
  --link:#86a9f6;        /* blue tint */
  --link-hover:#b9ccff;  /* lighter on hover */
  --field:#0a0c10;       /* inputs/textarea bg */
  --focus:#86a9f6;       /* focus indicator */

  /* Fluid type scale */
  --text: clamp(1rem, 0.98rem + 0.3vw, 1.0625rem);
  --h1: clamp(1.5rem, 1.2rem + 1.2vw, 1.75rem);
  --h2: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
  
  /* Spacing */
  --space-xs: 0.375rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
}

/* Reserve space for page scrollbar to avoid layout bump */
html { 
  scrollbar-gutter: stable both-edges;
  scroll-behavior: smooth;
}
body { overflow-y: scroll; }

/* Reset-ish */
*{ box-sizing: border-box; margin: 0; padding: 0; }
html,body{ height:100% }
body{
  background:var(--bg);
  color:var(--fg);
  font: var(--text)/1.6 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* Typography: serif headings for that "old web" feel */
.h1, h2, h3, h4, h5{
  font-family: Georgia, "Times New Roman", Times, serif;
  letter-spacing: 0.0125rem;
}

/* Links like the Berkshire page—underlined, slightly purple/blue */
a{
  color:var(--link);
  text-decoration: underline;
  text-underline-offset: 0.125rem;
  transition: color 0.15s ease;
}
a:hover{ color:var(--link-hover); }
a:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Layout: centered container with fluid padding */
.container{
  max-width: 61.25rem;
  margin: var(--space-xl) auto;
  padding-inline: clamp(1rem, 4vw, 1.5rem);
}
.header,.footer{
  display:block;
  text-align:center;
  padding: 1.125rem var(--space-lg);
  border-bottom:1px solid var(--line)
}
.footer{
  border-top:1px solid var(--line);
  border-bottom:none;
  opacity:.85;
  margin-top: 3rem;
}

.h1{ 
  font-size:var(--h1);
  margin:0 0 var(--space-xs) 0;
  text-transform:uppercase;
  letter-spacing: 0.0625rem;
}
.header nav{
  margin-top: var(--space-xs);
  font-family: Georgia, "Times New Roman", Times, serif;
}
.header nav a{ margin:0 0.35rem }

/* Flat sections + horizontal rules */
.card{
  background:transparent;
  border:none;
  padding:0;
  margin: 1.75rem 0;
}
.card > h2{
  font-size:var(--h2);
  margin:0 0 0.625rem 0;
  color:var(--fg);
  font-weight:600;
  border-bottom:1px solid var(--line);
  padding-bottom: var(--space-xs);
}

/* Simple vertical rhythm */
.stack > *{ display:block; margin-bottom: var(--space-md); }

/* Inputs / buttons: ultra-minimal, outlined */
input,textarea,button{
  font:inherit;
  color:inherit;
  background:var(--field);
  border:1px solid var(--line);
  border-radius:0;
  padding: var(--space-sm) 0.625rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

input:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}

button{
  background:transparent;
  cursor:pointer;
  padding: var(--space-sm) 0.875rem;
  border-color:#3a4048;
}
button:hover:not(:disabled){ background:#0d1016; }
button:focus-visible{
  outline:2px solid var(--focus);
  outline-offset:2px;
}
button:disabled, button[aria-disabled="true"]{
  opacity: 0.5;
  cursor: not-allowed;
}

.muted{ color:var(--muted); }

/* Accessible visually-hidden helper */
.sr-only{
  position:absolute !important;
  width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

/* Keep label text visible by default; use .sr-only in markup if needed */
label{ 
  position:relative;
  font-size:inherit;
  line-height:inherit;
  display: block;
}
label textarea, label input{ 
  font-size:1rem;
  line-height:1.4;
  width: 100%;
}

/* Placeholders more readable on dark */
::placeholder{ color:var(--muted); opacity:.9; }

/* Fix browser autofill on dark themes */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--fg);
  caret-color: var(--fg);
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0 1000px var(--field) inset;
  -webkit-box-shadow: 0 0 0 1000px var(--field) inset;
  border:1px solid var(--line);
}

/* Post meta & body */
.post-meta{
  display:flex;
  gap: var(--space-sm);
  align-items:baseline;
  flex-wrap: wrap;
  color:var(--muted);
  font-size: 0.875rem;
  font-family: Georgia, "Times New Roman", Times, serif;
}
.post-body{
  white-space:pre-wrap;
  margin: var(--space-sm) 0 0 0;
  word-wrap: break-word;
}

/* Rules between posts */
#feed article{
  padding: 0.875rem 0;
  border-top:1px solid var(--line);
  contain: layout style paint;
}
#feed article:first-child{ border-top:none; }

/* Comments */
.comment-list{
  margin-top: var(--space-sm);
  margin-left: 0.875rem;
  padding-left: 0.875rem;
  border-left:2px solid var(--line);
  list-style: none;
}
.comment-list li{
  margin: var(--space-sm) 0;
  padding:0;
  border:none;
  background:transparent;
}
.comment-meta{
  font-size: 0.8125rem;
  color:var(--muted);
  font-family: Georgia, "Times New Roman", Times, serif;
  display: flex;
  gap: var(--space-sm);
  align-items: baseline;
}
.comment-list p{
  margin: 0.25rem 0 0 0;
  line-height:1.45;
  word-wrap: break-word;
}

/* Textarea with auto-expand */
textarea{
  width:100%;
  line-height:1.4;
  resize:none;
  overflow-y:auto;
  overflow-wrap:break-word;
  white-space:pre-wrap;
  background:var(--field);
  border:1px solid var(--line);
  color:inherit;
  min-height: 2.8rem;
  max-height: 20rem;
}
textarea:focus{
  border-color:#48505a;
}

/* Section headers inside posts */
article section h3{
  margin: 0.875rem 0 var(--space-xs);
  font-size:1rem;
  color:var(--muted);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing: 0.05rem;
}

/* Comment form */
.comment-form{
  margin-top: var(--space-md);
}
.comment-form label{
  margin-bottom: var(--space-sm);
}

/* Footer small-print */
.footer span{
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.875rem;
  letter-spacing: 0.0125rem;
}

/* Loading states */
[aria-busy="true"]{
  opacity: 0.6;
  pointer-events: none;
}

/* Error messages */
.error{
  color: #f85149;
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

/* Success messages */
.success{
  color: #3fb950;
  font-size: 0.875rem;
}

/* Motion sensitivity */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:0.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:0.001ms !important;
  }
  html{
    scroll-behavior: auto !important;
  }
}

/* Responsive adjustments */
@media (max-width: 48rem){
  .post-meta{
    font-size: 0.8125rem;
  }
  .comment-meta{
    font-size: 0.75rem;
  }
}