/* --- Variables (jasny pergamin — jak na mobile) --- */
:root {
  color-scheme: light;
  --parchment-base: #efe6d6;
  --parchment-mid: #f7f2ea;
  --parchment-light: #fcfaf6;
  --parchment-stain: rgba(175, 145, 105, 0.1);
  --parchment-edge: rgba(130, 100, 65, 0.14);
  --text-main: #3a332e;
  --text-soft: #5a5048;
  --gold: #b8923f;
  --gold-light: #dcc98a;
  --gold-dark: #8a6b2e;
  --card-bg: rgba(255, 253, 249, 0.92);
  --card-border: rgba(154, 123, 60, 0.28);
  --shadow-soft: 0 12px 32px rgba(120, 95, 65, 0.1);
  --card-hover-shadow: 0 16px 40px rgba(120, 95, 65, 0.16);
  --footer-fade: rgba(245, 238, 226, 0.7);
  --footer-end: rgba(237, 228, 214, 0.92);
  --footer-border: rgba(154, 123, 60, 0.22);
  --legal-divider: rgba(196, 163, 90, 0.1);
  --grain-filter: url(#parchment-grain);
  --grain-bg: #e5d9c6;
  --grain-opacity: 0.2;
  --grain-blend: multiply;
  --bg-fiber-1: rgba(150, 120, 85, 0.018);
  --bg-fiber-2: rgba(130, 100, 70, 0.014);
  --stain-2: rgba(190, 160, 120, 0.08);
  --stain-3: rgba(170, 140, 100, 0.09);
  --stain-4: rgba(180, 150, 110, 0.07);
  --toggle-bg: rgba(255, 252, 247, 0.94);
  --stamp-highlight: rgba(255, 252, 245, 0.55);
  --stamp-depth: rgba(180, 150, 100, 0.1);
  --stamp-outer-shadow: rgba(100, 75, 45, 0.14);
  --stamp-dash: rgba(184, 146, 63, 0.38);
  --stamp-icon: var(--gold-dark);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Nunito Sans", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --parchment-base: #1e1812;
  --parchment-mid: #2a221a;
  --parchment-light: #352b22;
  --parchment-stain: rgba(90, 68, 48, 0.45);
  --parchment-edge: rgba(0, 0, 0, 0.55);
  --text-main: #ebe0d0;
  --text-soft: #b8a898;
  --gold: #d4b35c;
  --gold-light: #e8d49a;
  --gold-dark: #a88638;
  --card-bg: rgba(48, 38, 30, 0.78);
  --card-border: rgba(212, 179, 92, 0.32);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.45);
  --card-hover-shadow: 0 20px 52px rgba(0, 0, 0, 0.55);
  --footer-fade: rgba(30, 24, 18, 0.75);
  --footer-end: rgba(22, 17, 13, 0.95);
  --footer-border: rgba(212, 179, 92, 0.22);
  --legal-divider: rgba(212, 179, 92, 0.15);
  --grain-filter: url(#parchment-grain-dark);
  --grain-bg: #3d3028;
  --grain-opacity: 0.45;
  --grain-blend: soft-light;
  --bg-fiber-1: rgba(80, 60, 40, 0.06);
  --bg-fiber-2: rgba(60, 45, 30, 0.05);
  --stain-2: rgba(70, 52, 38, 0.35);
  --stain-3: rgba(55, 40, 28, 0.4);
  --stain-4: rgba(65, 48, 34, 0.32);
  --toggle-bg: rgba(48, 38, 30, 0.92);
  --stamp-highlight: rgba(110, 90, 65, 0.45);
  --stamp-depth: rgba(0, 0, 0, 0.22);
  --stamp-outer-shadow: rgba(0, 0, 0, 0.4);
  --stamp-dash: rgba(212, 179, 92, 0.45);
  --stamp-icon: var(--gold-light);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--parchment-base);
  color: var(--text-main);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text-main);
  background: transparent;
  line-height: 1.6;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --- Tło: pergamin --- */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(
      93deg,
      transparent 0,
      transparent 40px,
      var(--bg-fiber-1) 40px,
      var(--bg-fiber-1) 41px
    ),
    repeating-linear-gradient(
      3deg,
      transparent 0,
      transparent 58px,
      var(--bg-fiber-2) 58px,
      var(--bg-fiber-2) 59px
    ),
    radial-gradient(ellipse 120% 90% at 50% 45%, var(--parchment-light) 0%, var(--parchment-mid) 42%, var(--parchment-base) 100%);
}

.page-bg__grain {
  position: absolute;
  inset: 0;
  background: var(--grain-bg);
  opacity: var(--grain-opacity);
  filter: var(--grain-filter);
  mix-blend-mode: var(--grain-blend);
  pointer-events: none;
}

.page-bg__stains {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 40% at 12% 18%, var(--parchment-stain) 0%, transparent 62%),
    radial-gradient(ellipse 45% 35% at 88% 22%, var(--stain-2) 0%, transparent 58%),
    radial-gradient(ellipse 50% 45% at 72% 78%, var(--stain-3) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 25% 82%, var(--stain-4) 0%, transparent 50%);
  pointer-events: none;
}

.page-bg__vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px 30px var(--parchment-edge);
  pointer-events: none;
}

/* --- Theme toggle --- */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
  background: var(--toggle-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: var(--card-hover-shadow);
  outline: none;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.theme-toggle__icon {
  font-size: 1rem;
  line-height: 1;
  color: var(--gold);
}

/* --- Header --- */
.site-header {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
}

.site-header__eyebrow {
  font-family: var(--font-body);
  font-size: clamp(0.62rem, 2.2vw, 0.72rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: none;
  color: var(--text-soft);
  margin-bottom: 0.75rem;
  max-width: 28em;
  margin-inline: auto;
  line-height: 1.5;
}

.site-header__name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-main);
  line-height: 1.15;
}

.site-header__divider {
  width: 80px;
  height: 1px;
  margin: 1.5rem auto 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold-light) 20%,
    var(--gold) 50%,
    var(--gold-light) 80%,
    transparent
  );
}

/* --- Main content & cards --- */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3.5rem;
}

.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 2.5rem);
  width: 100%;
}

.framed-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.framed-card:hover,
.framed-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
  outline: none;
}

.framed-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.service-card {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
}

.service-card__inner {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  align-content: start;
  text-align: center;
  height: 100%;
  min-height: 0;
  width: 100%;
  padding: 2rem 1.25rem 1.75rem;
  row-gap: 0.65rem;
  box-sizing: border-box;
}

.service-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--gold);
  opacity: 0.85;
}

.service-card__title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1.15;
  min-height: 2.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.service-card__text {
  align-self: start;
  width: 100%;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.55;
  max-width: 22ch;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* --- Nav rectangles --- */
.nav-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
  width: 100%;
}

.nav-card {
  min-height: 4.75rem;
  padding: 1.25rem 1rem;
}

.nav-card__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-main);
  text-align: center;
  position: relative;
  z-index: 1;
}

/* --- Golden corner ornaments: double intersecting L-lines --- */
.frame-corner {
  --len: 26px;
  --gap: 7px;
  --w: 2px;
  position: absolute;
  width: calc(var(--len) + var(--gap) + var(--len));
  height: calc(var(--len) + var(--gap) + var(--len));
  pointer-events: none;
}

.frame-corner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--gold), var(--gold)) 0 0 / var(--len) var(--w) no-repeat,
    linear-gradient(var(--gold), var(--gold)) 0 0 / var(--w) var(--len) no-repeat,
    linear-gradient(var(--gold), var(--gold)) var(--gap) var(--gap) / calc(var(--len) - 6px) var(--w) no-repeat,
    linear-gradient(var(--gold), var(--gold)) var(--gap) var(--gap) / var(--w) calc(var(--len) - 6px) no-repeat;
}

/* Krótkie kreski przecinające się u wierzchołka */
.frame-corner::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(
      135deg,
      transparent 46%,
      var(--gold-light) 46%,
      var(--gold) 50%,
      var(--gold-light) 54%,
      transparent 54%
    ),
    linear-gradient(
      45deg,
      transparent 46%,
      var(--gold-light) 46%,
      var(--gold) 50%,
      var(--gold-light) 54%,
      transparent 54%
    );
  opacity: 0.9;
}

.frame-corner--tl {
  top: 12px;
  left: 12px;
}

.frame-corner--tr {
  top: 12px;
  right: 12px;
  transform: scaleX(-1);
}

.frame-corner--bl {
  bottom: 12px;
  left: 12px;
  transform: scaleY(-1);
}

.frame-corner--br {
  bottom: 12px;
  right: 12px;
  transform: scale(-1, -1);
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--footer-fade) 35%,
    var(--footer-end) 100%
  );
  border-top: 1px solid var(--footer-border);
  padding: 2.5rem 1.5rem 2rem;
}

.site-footer__inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.site-footer__brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.site-footer__copy {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 1.25rem;
}

.site-footer__legal ul {
  list-style: none;
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--text-soft);
  opacity: 0.9;
}

.site-footer__legal li + li {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--legal-divider);
}

.site-footer__legal li:first-child {
  border-top: none;
  padding-top: 0;
}

/* --- Subpages --- */
.site-header--sub {
  padding: 2.5rem 1.5rem 1.75rem;
}

.back-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-decoration: none;
  margin-bottom: 1.25rem;
  transition: color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--gold);
  outline: none;
}

.site-header--sub .site-header__name {
  font-size: clamp(2rem, 6vw, 3rem);
}

.main-content--sub {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

.subpage-card {
  width: 100%;
  max-width: 520px;
  min-height: 14rem;
  padding: 2.5rem 2rem;
}

.subpage-card__inner {
  text-align: center;
  position: relative;
  z-index: 1;
}

.subpage-card__status {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.subpage-card__text {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 32ch;
  margin-inline: auto;
}

/* --- Kontakt --- */
.subpage-card--contact {
  max-width: 560px;
  padding: 2.25rem 1.75rem 2rem;
}

.subpage-card__inner--contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.subpage-card__inner--contact .subpage-card__status {
  text-align: center;
  margin-bottom: 1.5rem;
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  width: 100%;
  max-width: 22rem;
  margin-inline: auto;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  width: 100%;
}

.contact-stamp {
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  box-shadow:
    inset 0 0 0 1px var(--gold-light),
    0 2px 8px var(--stamp-outer-shadow);
  background: radial-gradient(
    circle at 32% 28%,
    var(--stamp-highlight) 0%,
    var(--card-bg) 55%,
    var(--stamp-depth) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.contact-stamp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px dashed var(--stamp-dash);
  pointer-events: none;
}

.contact-stamp svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: var(--stamp-icon);
  fill: none;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
  z-index: 1;
}

.contact-item__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.contact-item__body br {
  display: none;
}

.contact-item__label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.contact-item__value {
  display: block;
  font-size: 0.88rem;
  color: var(--text-soft);
  text-decoration: none;
  word-break: break-word;
  line-height: 1.5;
  transition: color 0.2s ease;
}

.contact-item__value:hover,
.contact-item__value:focus-visible {
  color: var(--gold);
  outline: none;
}

[data-theme="dark"] .contact-item__value:hover,
[data-theme="dark"] .contact-item__value:focus-visible {
  color: var(--gold-light);
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .main-content {
    max-width: 100%;
    padding-inline: 0.75rem;
  }

  .services {
    gap: 0.65rem;
    align-items: stretch;
  }

  .service-card {
    aspect-ratio: unset;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .service-card__inner {
    flex: 1;
    height: auto;
    padding: 1rem 0.4rem 1.85rem;
    row-gap: 0.3rem;
  }

  .service-card__icon {
    height: 1.1rem;
    font-size: 0.95rem;
  }

  .service-card__title {
    font-size: clamp(1rem, 3.8vw, 1.35rem);
    min-height: 0;
    line-height: 1.2;
    padding-inline: 0.1rem;
  }

  .service-card__text {
    font-size: clamp(0.6rem, 2.5vw, 0.72rem);
    line-height: 1.38;
    max-width: 100%;
    padding-inline: 0.1rem;
  }

  .frame-corner {
    --len: 14px;
    --gap: 4px;
    --w: 1.5px;
  }

  .frame-corner::after {
    width: 10px;
    height: 10px;
  }

  .frame-corner--tl {
    top: 6px;
    left: 6px;
  }

  .frame-corner--tr {
    top: 6px;
    right: 6px;
  }

  .frame-corner--bl {
    bottom: 6px;
    left: 6px;
  }

  .frame-corner--br {
    bottom: 6px;
    right: 6px;
  }

  .nav-links {
    grid-template-columns: 1fr;
    max-width: min(300px, 90vw);
    margin-inline: auto;
  }

  .subpage-card--contact {
    padding: 2rem 1.25rem 1.75rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  .framed-card {
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}
